linking stuff
This commit is contained in:
@@ -91,8 +91,10 @@ const userProductSchema = Joi.object({
|
||||
// Spreader settings for granular products
|
||||
spreaderSettings: Joi.array().items(
|
||||
Joi.object({
|
||||
id: Joi.number().optional(), // For frontend temporary IDs
|
||||
spreaderBrand: Joi.string().max(100).required(),
|
||||
id: Joi.number().optional(), // For existing settings
|
||||
equipmentId: Joi.number().integer().positive().optional(), // Link to user_equipment
|
||||
// Legacy fields for backward compatibility
|
||||
spreaderBrand: Joi.string().max(100).optional(),
|
||||
spreaderModel: Joi.alternatives().try(
|
||||
Joi.string().max(100).allow(''),
|
||||
Joi.allow(null)
|
||||
@@ -106,7 +108,7 @@ const userProductSchema = Joi.object({
|
||||
Joi.string().allow(''),
|
||||
Joi.allow(null)
|
||||
).optional()
|
||||
})
|
||||
}).or('equipmentId', 'spreaderBrand') // Must have either equipment reference or brand
|
||||
).optional()
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user