fix: allow visibility-only setup updates without name
updateSetupSchema required name as mandatory, causing ZodError when ShareModal sent visibility-only updates. Made name optional in update schema and guarded against setting undefined name in service layer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -183,9 +183,11 @@ export async function updateSetup(
|
||||
if (!existing) return null;
|
||||
|
||||
const updateData: Record<string, unknown> = {
|
||||
name: data.name,
|
||||
updatedAt: new Date(),
|
||||
};
|
||||
if (data.name !== undefined) {
|
||||
updateData.name = data.name;
|
||||
}
|
||||
if (data.visibility !== undefined) {
|
||||
updateData.visibility = data.visibility;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export const createSetupSchema = z.object({
|
||||
});
|
||||
|
||||
export const updateSetupSchema = z.object({
|
||||
name: z.string().min(1, "Setup name is required"),
|
||||
name: z.string().min(1, "Setup name is required").optional(),
|
||||
visibility: z.enum(["private", "link", "public"]).optional(),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user