From 32d9a3ace1a2b5a96ec5c74ecdce576a583bd8e3 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 16 Dec 2024 09:57:48 +0100 Subject: [PATCH] fix: refs #7028 remove ifs --- loopback/locale/es.json | 5 +---- modules/ticket/back/methods/ticket-request/deny.js | 4 ---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 73efce216..a47195d07 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -398,8 +398,5 @@ "An item type with the same code already exists": "Un tipo con el mismo código ya existe", "Holidays to past days not available": "Las vacaciones a días pasados no están disponibles", "All tickets have a route order": "Todos los tickets tienen orden de ruta", - "Price cannot be blank": "Price cannot be blank", - "Worker not found": "Trabajador no encontrado", - "Invalid request or related ticket/client data": "Solicitud no válida o datos de ticket/cliente relacionados" - + "Price cannot be blank": "Price cannot be blank" } diff --git a/modules/ticket/back/methods/ticket-request/deny.js b/modules/ticket/back/methods/ticket-request/deny.js index c6a1d35af..b96d8a244 100644 --- a/modules/ticket/back/methods/ticket-request/deny.js +++ b/modules/ticket/back/methods/ticket-request/deny.js @@ -44,7 +44,6 @@ module.exports = Self => { try { const userId = ctx.req.accessToken.userId; const worker = await models.Worker.findById(userId, myOptions); - if (!worker) throw new UserError('Worker not found'); const params = { isOk: false, @@ -66,9 +65,6 @@ module.exports = Self => { } }, myOptions); - if (!request || !request.ticket() || !request.ticket().client()) - throw new UserError('Invalid request or related ticket/client data'); - const url = await models.Url.getUrl(); const requesterId = request.ticket().client().salesPersonFk; const message = $t('Deny buy request', {