feat(storage): complete phase 3 branding foundation
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { apiError, apiSuccess } from "@/server/api/responses";
|
||||
import { domainActorFromSession } from "@/server/auth/domain-actor";
|
||||
import { getSessionContextFromHeaders } from "@/server/auth/session";
|
||||
import { getBrandingService, getPublicBranding } from "@/server/branding/runtime";
|
||||
import { DomainError } from "@/server/domain/errors";
|
||||
|
||||
export function GET() {
|
||||
return apiSuccess(getPublicBranding());
|
||||
}
|
||||
|
||||
export async function PATCH(request: Request) {
|
||||
const context = await getSessionContextFromHeaders(new Headers(request.headers));
|
||||
if (!context) return apiError(new DomainError("UNAUTHENTICATED", "Oturum gerekli."));
|
||||
|
||||
try {
|
||||
const branding = getBrandingService().update(
|
||||
domainActorFromSession(context),
|
||||
await request.json(),
|
||||
);
|
||||
return apiSuccess(branding);
|
||||
} catch (error) {
|
||||
return apiError(error);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user