Loading...
;
}
- const event =
- typeof attempt.event === "object" ? (attempt.event as EventFull) : null;
+ const event = attempt.event ? (attempt.event as EventFull) : null;
return (
@@ -33,7 +32,8 @@ const AttemptDetails = ({
{}}
diff --git a/internal/portal/src/scenes/Destination/Events/Attempts.tsx b/internal/portal/src/scenes/Destination/Events/Attempts.tsx
index 49299775..284270a4 100644
--- a/internal/portal/src/scenes/Destination/Events/Attempts.tsx
+++ b/internal/portal/src/scenes/Destination/Events/Attempts.tsx
@@ -67,10 +67,9 @@ const Attempts: React.FC = ({
searchParams.set("limit", "15");
}
- searchParams.set("destination_id", destination.id);
searchParams.set("include", "event");
- return `attempts?${searchParams.toString()}`;
+ return `destinations/${destination.id}/attempts?${searchParams.toString()}`;
}, [destination.id, timeRange, urlSearchParams]);
const {
@@ -85,10 +84,7 @@ const Attempts: React.FC = ({
const table_rows = attemptsList?.models
? attemptsList.models.map((attempt) => {
- const event =
- typeof attempt.event === "object"
- ? (attempt.event as EventSummary)
- : null;
+ const event = attempt.event ? (attempt.event as EventSummary) : null;
return {
id: attempt.id,
active: attempt.id === (attemptId || ""),
@@ -109,7 +105,8 @@ const Attempts: React.FC = ({
)}
{
diff --git a/internal/portal/src/typings/Event.ts b/internal/portal/src/typings/Event.ts
index 8a07bdbf..0894aec7 100644
--- a/internal/portal/src/typings/Event.ts
+++ b/internal/portal/src/typings/Event.ts
@@ -25,14 +25,16 @@ interface EventFull extends EventSummary {
// Attempt represents a delivery attempt for an event to a destination
interface Attempt {
id: string;
+ event_id: string;
+ destination_id: string;
status: "success" | "failed";
delivered_at: string;
code?: string;
response_data?: Record;
attempt_number: number;
- // Expandable fields - string (ID) or object depending on expand param
- event: string | EventSummary | EventFull;
- destination: string;
+ manual: boolean;
+ // Expandable field - only present when using include=event
+ event?: EventSummary | EventFull;
}
interface SeekPagination {
diff --git a/internal/services/builder.go b/internal/services/builder.go
index a8be0188..b3c0e71b 100644
--- a/internal/services/builder.go
+++ b/internal/services/builder.go
@@ -201,13 +201,14 @@ func (b *ServiceBuilder) BuildAPIWorkers(baseRouter *gin.Engine) error {
PortalConfig: b.cfg.GetPortalConfig(),
GinMode: b.cfg.GinMode,
},
- b.logger,
- svc.redisClient,
- svc.deliveryMQ,
- svc.tenantStore,
- svc.logStore,
- eventHandler,
- b.telemetry,
+ apirouter.RouterDeps{
+ TenantStore: svc.tenantStore,
+ LogStore: svc.logStore,
+ Logger: b.logger,
+ DeliveryPublisher: svc.deliveryMQ,
+ EventHandler: eventHandler,
+ Telemetry: b.telemetry,
+ },
)
// Mount API handler onto base router (everything except /healthz goes to apiHandler)
diff --git a/internal/util/testutil/testutil.go b/internal/util/testutil/testutil.go
index a9024240..4719b9c0 100644
--- a/internal/util/testutil/testutil.go
+++ b/internal/util/testutil/testutil.go
@@ -93,10 +93,10 @@ func RandomString(length int) string {
}
func RandomPortNumber() int {
- return 3500 + mathrand.Intn(100)
+ return 10000 + mathrand.Intn(50000)
}
-// Create a random port number between 3500 and 3600
+// RandomPort returns a random port string in the range :10000–:59999.
func RandomPort() string {
return ":" + strconv.Itoa(RandomPortNumber())
}