ADDED - Save an unfinished project as a draft
- Add a Save as draft button that bypasses the completeness gate: the user can save partial work and finish later - projectDraftInputSchema makes the user-facing copy (title, summary, service label, client) optional; the action auto-generates a slug from the title (or draft-<timestamp>), defaults the year to the current year, and forces the project unpublished - Drafts drop not-yet-valid sections/assets instead of failing the save - Pass intent via a hidden field set on click so the server reliably sees it - Tests: draft schema accepts empty copy a strict save rejects, and still requires a slug and a valid year
This commit is contained in:
@@ -123,3 +123,21 @@ export const projectInputSchema = z.object({
|
||||
sections: z.array(sectionInputSchema),
|
||||
assets: z.array(assetInputSchema),
|
||||
});
|
||||
|
||||
/**
|
||||
* Draft variant: the user-facing copy fields are optional so an unfinished
|
||||
* project can be saved and completed later. The action still guarantees a
|
||||
* slug, a category, and a year (auto-filled), and forces the project unpublished.
|
||||
*/
|
||||
export const projectDraftInputSchema = projectInputSchema.extend({
|
||||
titleAr: optionalTrimmedText,
|
||||
titleEn: optionalTrimmedText,
|
||||
titleDe: optionalTrimmedText,
|
||||
summaryAr: optionalTrimmedText,
|
||||
summaryEn: optionalTrimmedText,
|
||||
summaryDe: optionalTrimmedText,
|
||||
serviceLabelAr: optionalTrimmedText,
|
||||
serviceLabelEn: optionalTrimmedText,
|
||||
serviceLabelDe: optionalTrimmedText,
|
||||
clientName: optionalTrimmedText,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user