Skip to content

Commit

Permalink
Traducciones
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo3829l committed Apr 5, 2024
1 parent fcde841 commit 3c44674
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 30 deletions.
30 changes: 23 additions & 7 deletions arquitecture/Controllers/answer.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
}
}

Expand All @@ -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')
})
}
}

Expand All @@ -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')
})
}
}

Expand All @@ -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')
})
}
}
24 changes: 12 additions & 12 deletions arquitecture/Controllers/schedule.service.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
});
}

Expand All @@ -405,15 +405,15 @@ 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'),
});
}

const service = await Service.findById(existingService.service)
if(!service){
return res.json({
success: false,
msg: "no se encontro el servicio"
msg: req.t('schedule.cancelService.dontService'),
});
}

Expand All @@ -430,15 +430,15 @@ 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) {
console.log("Error");
console.log(error);
return res.json({
success: false,
msg: 'Error canceling service',
msg: req.t('schedule.cancelService.error'),
});
}
};
Expand All @@ -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'),
});
}

Expand All @@ -471,15 +471,15 @@ 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')
});
}

// Verifica si la fecha proporcionada es mayor que la fecha actual del servicio
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')
});
}

Expand All @@ -491,15 +491,15 @@ 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')
});
}

const service = await Service.findById(existingService.service)
if(!service){
return res.json({
success: false,
msg: "no se encontro el servicio"
msg: req.t('schedule.rescheduleService.dontService')
});
}

Expand All @@ -515,15 +515,15 @@ export const rescheduleService = async (req, res) => {

return res.json({
success: true,
msg: "Service rescheduled successfully",
msg: req.t('schedule.rescheduleService.success')
});

} catch (error) {
console.log("Error");
console.log(error);
return res.json({
success: false,
msg: 'Error rescheduling service',
msg: req.t('schedule.rescheduleService.error')
});
}
};
11 changes: 0 additions & 11 deletions arquitecture/Controllers/user.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
36 changes: 36 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
}
}
}
36 changes: 36 additions & 0 deletions locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
}
}
}

0 comments on commit 3c44674

Please sign in to comment.