Skip to content

Commit

Permalink
[FIX] find registration period
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaryoshida committed Dec 14, 2023
1 parent e9fe073 commit 4ef4812
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions backend/controllers/SuperuserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ exports.openRegistrationPeriod = async (req, res) => {
exports.getRegistrationPeriod = async (req, res) => {
try {
const currentPeriod = await Registration.findOne({
attributes: [
[sequelize.fn('max', sequelize.col('createdAt')), 'maxCreatedAt']
]
});

res.json(currentPeriod);
where: { id: 1 }
});
if (!currentPeriod) {
res.status(404).json({ error: 'Período de matrícula não encontrado.' });
return;
}
res.json(currentPeriod);
} catch (error) {
console.error('Error fetching current registration period:', error);
res.status(500).json({ error: 'Erro ao buscar o período de matrícula atual.' });
console.error('Erro ao buscar o período de matrícula atual:', error);
res.status(500).json({ error: 'Erro ao buscar o período de matrícula atual.' });
}
};
};

1 comment on commit 4ef4812

@vercel
Copy link

@vercel vercel bot commented on 4ef4812 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

matriculai – ./frontend

matriculai-matriculai.vercel.app
matriculai-git-main-matriculai.vercel.app
matriculai.vercel.app

Please sign in to comment.