This commit is contained in:
@@ -203,6 +203,23 @@ export const UpdatePartSchema = z
|
||||
})
|
||||
.strict();
|
||||
|
||||
// Clone a part (or whole assembly) into the same parent. Operations are
|
||||
// re-seeded with fresh QR tokens and `status: "pending"`, `unitsCompleted: 0`
|
||||
// — travelers printed for the copy need new QRs or they'd collide with the
|
||||
// original. includeOperations=false gives you just the skeleton if the recipe
|
||||
// is being reworked.
|
||||
export const DuplicatePartSchema = z.object({
|
||||
code: Code,
|
||||
name: NonEmpty.optional(),
|
||||
includeOperations: z.boolean().default(true).optional(),
|
||||
});
|
||||
|
||||
export const DuplicateAssemblySchema = z.object({
|
||||
code: Code,
|
||||
name: NonEmpty.optional(),
|
||||
includeOperations: z.boolean().default(true).optional(),
|
||||
});
|
||||
|
||||
// ---- operations ---------------------------------------------------------
|
||||
|
||||
// "partial" = an operation that was started, had units logged, and then paused.
|
||||
@@ -347,6 +364,19 @@ export const ReceivePOSchema = z.object({
|
||||
.min(1),
|
||||
});
|
||||
|
||||
// Admin correction of a time log. Most common use: the operator forgot to
|
||||
// pause overnight so endedAt is null (or absurdly late) and plan-vs-actual
|
||||
// reporting is poisoned. We allow startedAt nudges too for paper-log
|
||||
// backfills. The route enforces endedAt >= startedAt and audits the diff.
|
||||
export const UpdateTimeLogSchema = z
|
||||
.object({
|
||||
startedAt: z.coerce.date().optional(),
|
||||
endedAt: z.coerce.date().nullable().optional(),
|
||||
unitsProcessed: z.coerce.number().int().min(0).max(1_000_000).nullable().optional(),
|
||||
note: OptionalText,
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const ReleaseOperationSchema = z.object({
|
||||
unitsProcessed: z.coerce.number().int().min(0).max(1_000_000).nullable().optional(),
|
||||
note: OptionalText,
|
||||
|
||||
Reference in New Issue
Block a user