trying to fix validator default not working

This commit is contained in:
2023-03-22 17:38:37 +01:00
parent af521a84e3
commit 5570f5d3a9
+14 -1
View File
@@ -58,6 +58,20 @@ router.post('/:serverId/kill', (req, res, next) => {
router.post(
'/:serverId/kill',
param('serverId').exists().toInt().isInt(),
body([
'attacker_current_weapon_mods',
'attacker_weapon_1_mods',
'attacker_weapon_2_mods',
'attacker_weapon_3_mods',
'attacker_offhand_weapon_1',
'attacker_offhand_weapon_2',
'victim_current_weapon_mods',
'victim_weapon_1_mods',
'victim_weapon_2_mods',
'victim_weapon_3_mods',
'victim_offhand_weapon_1',
'victim_offhand_weapon_2'
]).default(0),
body([
'attacker_current_weapon_mods',
'attacker_weapon_1_mods',
@@ -72,7 +86,6 @@ router.post(
'victim_offhand_weapon_1',
'victim_offhand_weapon_2'
])
.customSanitizer((value) => value || 0)
.toInt()
.isInt()
.withMessage('must be a valid int'),