26 lines
762 B
TypeScript
26 lines
762 B
TypeScript
"use server";
|
|
|
|
import { createCorrelationId } from "@/features/housekeeping/foundation/correlation";
|
|
import {
|
|
type HousekeepingInboxResponse,
|
|
loadHousekeepingInbox,
|
|
} from "@/features/housekeeping/foundation/inbox/inbox-service";
|
|
import { getHousekeepingCapabilityContext } from "@/features/housekeeping/foundation/server-capability-context";
|
|
|
|
function failedInbox(): HousekeepingInboxResponse {
|
|
return {
|
|
items: [],
|
|
errors: [{ sourceId: "inbox", code: "INTERNAL" }],
|
|
correlationId: createCorrelationId(),
|
|
};
|
|
}
|
|
|
|
export async function executeHousekeepingInbox(): Promise<HousekeepingInboxResponse> {
|
|
try {
|
|
const context = await getHousekeepingCapabilityContext();
|
|
return await loadHousekeepingInbox(context);
|
|
} catch {
|
|
return failedInbox();
|
|
}
|
|
}
|