xfgsgs
This commit is contained in:
@@ -194,10 +194,8 @@ router.get('/spreaders', async (req, res, next) => {
|
|||||||
LEFT JOIN equipment_categories ec ON ue.category_id = ec.id
|
LEFT JOIN equipment_categories ec ON ue.category_id = ec.id
|
||||||
WHERE ue.user_id = $1
|
WHERE ue.user_id = $1
|
||||||
AND ue.is_active = true
|
AND ue.is_active = true
|
||||||
AND (ec.name ILIKE '%spreader%'
|
-- Temporarily show all equipment so user can identify spreaders
|
||||||
OR ue.spreader_type IS NOT NULL
|
-- TODO: Add proper spreader identification/categorization
|
||||||
OR ue.custom_name ILIKE '%spreader%'
|
|
||||||
OR ue.manufacturer ILIKE '%spreader%')
|
|
||||||
ORDER BY ue.custom_name, ue.manufacturer, ue.model`,
|
ORDER BY ue.custom_name, ue.manufacturer, ue.model`,
|
||||||
[req.user.id]
|
[req.user.id]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -109,10 +109,10 @@ const userProductSchema = Joi.object({
|
|||||||
Joi.allow(null)
|
Joi.allow(null)
|
||||||
).optional()
|
).optional()
|
||||||
}).when('equipmentId', {
|
}).when('equipmentId', {
|
||||||
is: Joi.exist(),
|
is: Joi.number().positive(),
|
||||||
then: Joi.object(), // When equipmentId exists, spreaderBrand is optional
|
then: Joi.object(), // When equipmentId is a positive number, spreaderBrand is optional
|
||||||
otherwise: Joi.object({
|
otherwise: Joi.object({
|
||||||
spreaderBrand: Joi.string().max(100).required() // When no equipmentId, require spreaderBrand
|
spreaderBrand: Joi.string().max(100).required() // When no valid equipmentId, require spreaderBrand
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
).optional()
|
).optional()
|
||||||
|
|||||||
Reference in New Issue
Block a user