Skip to content

Commit

Permalink
FEAT - Modificar fechas en job citas
Browse files Browse the repository at this point in the history
* **auth:** filtro profesional habilitado en login ([#1958](#1958)) ([fb0eec6](fb0eec6))
  • Loading branch information
MCele authored and JuanIRamirez committed Oct 9, 2024
1 parent d67741b commit 412c8c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function createPayload(user, authOrg, prof) {
*/
export async function findTokenData(username: number, organizacion: ObjectId) {
const pAuth = AuthUsers.findOne({ usuario: username, 'organizaciones._id': organizacion });
const pProfesional = Profesional.findOne({ documento: String(username) }, { nombre: true, apellido: true });
const pProfesional = Profesional.findOne({ documento: String(username), habilitado: { $ne: false } }, { nombre: true, apellido: true });
const [auth, prof]: [any, any] = await Promise.all([pAuth, pProfesional]);
if (auth) {
const authOrganizacion = auth.organizaciones.find(item => String(item._id) === String(organizacion));
Expand Down Expand Up @@ -106,7 +106,7 @@ export async function getTokenPayload(token, userData) {

export async function findUser(username) {
const pAuth = AuthUsers.findOne({ usuario: username });
const pProfesional = Profesional.findOne({ documento: username }, { matriculas: true, especialidad: true });
const pProfesional = Profesional.findOne({ documento: username, habilitado: { $ne: false } }, { matriculas: true, especialidad: true });
const [auth, prof] = await Promise.all([pAuth, pProfesional]);
if (auth) {
return {
Expand Down
2 changes: 1 addition & 1 deletion jobs/actualizarAgendasJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import moment = require('moment');
function run(done) {
const fechaActualizar = moment(new Date());
const start = (moment(fechaActualizar).startOf('day').subtract(1, 'days').toDate() as any);
const end = (moment(fechaActualizar).endOf('day').toDate() as any);
const end = (moment(start).endOf('day').toDate() as any);
Promise.all([
agendaCtrl.actualizarTiposDeTurno(),
agendaCtrl.actualizarEstadoAgendas(start, end)
Expand Down

0 comments on commit 412c8c4

Please sign in to comment.