// Used for PATCH
export const trainingToBeInsertedSchema = createInsertSchema(TB_Trainings, {
name: (schema) => schema.optional(),
description: (schema) => schema.optional(),
posterId: (schema) => schema.min(1).optional(),
})
.extend({
categoryIds: z.array(z.string()).min(1).optional(),
})
.pick({
name: true,
description: true,
duration: true,
categoryIds: true,
posterId: true,
isFree: true,
isVisible: true,
isNew: true,
});
// Used for PATCH
export const trainingToBeInsertedSchema = createInsertSchema(TB_Trainings, {
name: (schema) => schema.optional(),
description: (schema) => schema.optional(),
posterId: (schema) => schema.min(1).optional(),
})
.extend({
categoryIds: z.array(z.string()).min(1).optional(),
})
.pick({
name: true,
description: true,
duration: true,
categoryIds: true,
posterId: true,
isFree: true,
isVisible: true,
isNew: true,
});