feat(09-01): add classification column to setupItems with service layer and tests

- Add classification text column (default 'base') to setupItems schema
- Add classificationSchema and updateClassificationSchema Zod validators
- Add UpdateClassification type inferred from Zod schema
- Implement updateItemClassification service function
- Modify getSetupWithItems to return classification field
- Modify syncSetupItems to preserve classifications across re-sync
- Add tests for classification CRUD, preservation, and cross-setup independence
- Generate and apply Drizzle migration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 15:11:18 +01:00
parent 0e23996986
commit 4491e4c6f1
9 changed files with 642 additions and 3 deletions

View File

@@ -73,3 +73,10 @@ export const updateSetupSchema = z.object({
export const syncSetupItemsSchema = z.object({
itemIds: z.array(z.number().int().positive()),
});
// Classification schemas
export const classificationSchema = z.enum(["base", "worn", "consumable"]);
export const updateClassificationSchema = z.object({
classification: classificationSchema,
});

View File

@@ -17,6 +17,7 @@ import type {
syncSetupItemsSchema,
updateCandidateSchema,
updateCategorySchema,
updateClassificationSchema,
updateItemSchema,
updateSetupSchema,
updateThreadSchema,
@@ -37,6 +38,7 @@ export type ResolveThread = z.infer<typeof resolveThreadSchema>;
export type CreateSetup = z.infer<typeof createSetupSchema>;
export type UpdateSetup = z.infer<typeof updateSetupSchema>;
export type SyncSetupItems = z.infer<typeof syncSetupItemsSchema>;
export type UpdateClassification = z.infer<typeof updateClassificationSchema>;
// Types inferred from Drizzle schema
export type Item = typeof items.$inferSelect;