fix(housekeeping): address task 14 review round 3
This commit is contained in:
1 parent
c524b305d7
commit
d1160eb65a
7 files changed
+243
-40
No files matched your search
@@ -5,6 +5,9 @@ import type { ContentMutationSnapshot } from "@/features/housekeeping/domains/co
|
||||
import { createCorrelationId } from "@/features/housekeeping/foundation/contracts";
|
||||
import { requireStaff, type StaffUser } from "@/lib/admin/guard";
|
||||
|
||||
const PARTIAL_ERROR =
|
||||
"Logo change completed partially; verify storage and audit state";
|
||||
|
||||
async function executeAuditedLogoMutation(
|
||||
staff: StaffUser,
|
||||
input: unknown,
|
||||
@@ -37,11 +40,18 @@ export async function saveLogo(
|
||||
if (!file) return { success: false, error: "No file provided" };
|
||||
const result = await executeAuditedLogoMutation(staff, { file });
|
||||
revalidatePath("/", "layout");
|
||||
const url =
|
||||
typeof result.output?.url === "string" ? result.output.url : undefined;
|
||||
if (result.completion?.status === "partial") {
|
||||
return {
|
||||
success: false,
|
||||
...(url ? { url } : {}),
|
||||
error: PARTIAL_ERROR,
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
...(typeof result.output?.url === "string"
|
||||
? { url: result.output.url }
|
||||
: {}),
|
||||
...(url ? { url } : {}),
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user