feat(housekeeping): compose operational inbox
This commit is contained in:
1 parent
bcb0ca977f
commit
300ac0ef95
13 files changed
+1594
-7
No files matched your search
@@ -0,0 +1,25 @@
|
||||
"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();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user