diff --git a/arquitecture/Controllers/answer.controller.js b/arquitecture/Controllers/answer.controller.js index 50a489f..392c3f6 100644 --- a/arquitecture/Controllers/answer.controller.js +++ b/arquitecture/Controllers/answer.controller.js @@ -8,19 +8,23 @@ export const getAnswers = async (request, response) => { if(!asnwers){ return response.json({ success : false, - msg : 'No se pudo obtener las preguntas' + msg : req.t('answer.getAnswers.dontGet') }) } return response.json({ success : true, - msg : 'Preguntas obtenidas', + msg : req.t('answer.getAnswers.get'), asnwers }) } catch (error) { console.log('error asl obteber las preguntas') console.log(error) + return response.json({ + success : false, + msg : req.t('answer.getAnswers.error') + }) } } @@ -40,11 +44,15 @@ export const addAnwer = async (request, response) => { return response.json({ success : true, - msg : 'Pregunta agregada' + msg : req.t('answer.addAnwer.add') }) } catch (error) { console.log('error asl agregar una pregunta') console.log(error) + return response.json({ + success : false, + msg : req.t('answer.addAnwer.error') + }) } } @@ -57,18 +65,22 @@ export const removeAnswer = async (request, response) => { if(!deleteAnswer){ return response.json({ success : false, - msg : 'No se pudo eliminar' + msg : req.t('answer.removeAnswer.dontRemove') }) } return response.json({ success : true, - msg : 'Pregunta elimnada con exito' + msg : req.t('answer.removeAnswer.remove') }) } catch (error) { console.log('error asl eliminar una pregunta') console.log(error) + return response.json({ + success : false, + msg : req.t('answer.removeAnswer.error') + }) } } @@ -82,16 +94,20 @@ export const updateAnswer = async (request, response) => { if(!answer){ return response.json({ success : false, - msg : 'No se pudo editar' + msg : req.t('answer.updateAnswer.dontUpdate') }) } return response.json({ success : true, - msg : 'Pregunta editada con exito' + msg : req.t('answer.updateAnswer.update') }) } catch (error) { console.log('error asl editar una pregunta') console.log(error) + return response.json({ + success : false, + msg : req.t('answer.updateAnswer.error') + }) } } \ No newline at end of file diff --git a/arquitecture/Controllers/schedule.service.controller.js b/arquitecture/Controllers/schedule.service.controller.js index 5279b63..74e9819 100644 --- a/arquitecture/Controllers/schedule.service.controller.js +++ b/arquitecture/Controllers/schedule.service.controller.js @@ -394,7 +394,7 @@ export const cancelService = async (req, res) => { if (!existingService) { return res.json({ success: false, - msg: "Service does not exist", + msg: req.t('schedule.cancelService.dontExist'), }); } @@ -405,7 +405,7 @@ export const cancelService = async (req, res) => { if(!user){ return res.json({ success: false, - msg: "no se encontro al usuario", + msg: req.t('schedule.cancelService.notUser'), }); } @@ -413,7 +413,7 @@ export const cancelService = async (req, res) => { if(!service){ return res.json({ success: false, - msg: "no se encontro el servicio" + msg: req.t('schedule.cancelService.dontService'), }); } @@ -430,7 +430,7 @@ export const cancelService = async (req, res) => { // mandar el email de cancelacion return res.json({ success: true, - msg: "Service canceled successfully", + msg: req.t('schedule.cancelService.candeled') }); } catch (error) { @@ -438,7 +438,7 @@ export const cancelService = async (req, res) => { console.log(error); return res.json({ success: false, - msg: 'Error canceling service', + msg: req.t('schedule.cancelService.error'), }); } }; @@ -455,7 +455,7 @@ export const rescheduleService = async (req, res) => { if (!existingService) { return res.json({ success: false, - msg: "Service does not exist", + msg: req.t('schedule.rescheduleService.dontService'), }); } @@ -471,7 +471,7 @@ export const rescheduleService = async (req, res) => { if (differenceInDays <= 4) { return res.json({ success: false, - msg: "Cannot reschedule service more than 4 days before the scheduled date", + msg: req.t('schedule.rescheduleService.day') }); } @@ -479,7 +479,7 @@ export const rescheduleService = async (req, res) => { if (new Date(newDate) <= existingService.dates.scheduledTime) { return res.json({ success: false, - msg: "Cannot reschedule service to a date before the scheduled date", + msg: req.t('schedule.rescheduleService.date') }); } @@ -491,7 +491,7 @@ export const rescheduleService = async (req, res) => { if(!user){ return res.json({ success: false, - msg: "no se encontro al usuario", + msg: req.t('schedule.rescheduleService.dontUser') }); } @@ -499,7 +499,7 @@ export const rescheduleService = async (req, res) => { if(!service){ return res.json({ success: false, - msg: "no se encontro el servicio" + msg: req.t('schedule.rescheduleService.dontService') }); } @@ -515,7 +515,7 @@ export const rescheduleService = async (req, res) => { return res.json({ success: true, - msg: "Service rescheduled successfully", + msg: req.t('schedule.rescheduleService.success') }); } catch (error) { @@ -523,7 +523,7 @@ export const rescheduleService = async (req, res) => { console.log(error); return res.json({ success: false, - msg: 'Error rescheduling service', + msg: req.t('schedule.rescheduleService.error') }); } }; diff --git a/arquitecture/Controllers/user.controller.js b/arquitecture/Controllers/user.controller.js index c9968fe..e5eee85 100644 --- a/arquitecture/Controllers/user.controller.js +++ b/arquitecture/Controllers/user.controller.js @@ -370,17 +370,6 @@ export const resendcode = async (req,res)=>{ req.t('email.recover.tittle'), ) - // const template = getTemplate( - // user.name, - // code, - // "recover") - // await sendEmail( - // email, - // 'Verification', - // template, - // "Verification code" - // ) - return res.json({ success: true, msg: 'Codigo enviado correctamente' diff --git a/locales/en.json b/locales/en.json index 9535cda..7ff9508 100644 --- a/locales/en.json +++ b/locales/en.json @@ -115,6 +115,21 @@ "prOne": "Your service has been quoted, check it out from the 'my services' section on the page", "tittle": "Quoted Service" } + }, + "cancelService": { + "dontExist": "Service does not exist", + "notUser": "User does not exist", + "dontService": "Service not found", + "canceled": "Service successfully canceled", + "error": "Error canceling service" + }, + "rescheduleService": { + "dontService": "Service does not exist", + "days": "Service cannot be rescheduled more than 4 days before the scheduled date", + "date": "Service cannot be rescheduled to a date before the scheduled date", + "dontUser": "User not found", + "success": "Service successfully rescheduled", + "error": "Error rescheduling service" } }, "services": { @@ -148,5 +163,26 @@ "existService": "Service type not found", "success": "The suspension status of the service type has been updated" } + }, + "answer": { + "getAnswers": { + "dontGet": "Failed to get questions", + "get": "Questions obtained", + "error": "Failed to get" + }, + "addAnwer": { + "add": "Question added", + "error": "Failed to add" + }, + "removeAnswer": { + "dontRemove": "Failed to remove question", + "remove": "Question successfully removed", + "error": "Failed to remove" + }, + "updateAnswer": { + "dontUpdate": "Failed to edit", + "update": "Question successfully edited", + "error": "Failed to update" + } } } \ No newline at end of file diff --git a/locales/es.json b/locales/es.json index 6426cde..de79ea6 100644 --- a/locales/es.json +++ b/locales/es.json @@ -115,6 +115,21 @@ "prOne": "Tu servicio ha sido cotizado, revisalo desde la seccion de 'mis servicios' en la pagina", "tittle": "Servicio cotizado" } + }, + "cancelService" : { + "dontExist" : "El servicio no exite", + "notUser" : "No existe el usuario", + "dontService" : "no se encontro el servicio", + "canceled" : "El service se cancelo con exito", + "error" : "Error canceling service" + }, + "rescheduleService" : { + "dontService" : "El servicio no existe", + "days" : "No se puede reprogramar el servicio más de 4 días antes de la fecha programada", + "date" : "No se puede reprogramar el servicio a una fecha anterior a la fecha programada", + "dontUser" : "No se encontro al usuario", + "success" : "Servicio reagendado con exito", + "error" : "Error al reagendar el servicio" } }, "services": { @@ -148,5 +163,26 @@ "existService": "Tipo de servicio no encontrado", "success": "El estado de suspensión del tipo de servicio ha sido actualizado" } + }, + "answer" : { + "getAnswers" : { + "dontGet" : "No se pudo obtener las preguntas", + "get" : "Pregnutas obtenidas", + "error" : "No se pudo obtener" + }, + "addAnwer" : { + "add" : "Pregunta agregada", + "error" : "No se pudo agregar" + }, + "removeAnswer" : { + "dontRemove" : "No se pudo eliminar la pregunta", + "remove" : "Pregunta eliminada con exito", + "error" : "No se pudo eliminar" + }, + "updateAnswer" : { + "dontUpdate" : "No se pudo editar", + "update" : "Pregunta editada con exito", + "error" : "No se pudo actualizar" + } } } \ No newline at end of file