seguimos depurando la api
Some checks failed
build-and-deploy / filter (push) Successful in 2s
Sync to GitHub / sync (push) Failing after 1s
build-and-deploy / build (push) Successful in 8s
build-and-deploy / deploy (push) Successful in 15s

This commit is contained in:
2025-05-30 12:51:47 -06:00
parent 97b879433d
commit 49829d9d2e
4 changed files with 7 additions and 6 deletions

View File

@@ -69,7 +69,7 @@ router.post('/', async (req, res) => {
res.status(201).json(nuevaPlanilla);
} catch (e) {
if (e instanceof Prisma.PrismaClientKnownRequestError) {
if (e.code === 'P2003' && e.meta?.field_name?.includes('empleado_id')) {
if (e.code === 'P2003') {
return res.status(400).json({ message: 'El empleado_id proporcionado no existe.' });
}
}
@@ -113,7 +113,7 @@ router.put('/:id', async (req, res) => {
if (e.code === 'P2025') {
return res.status(404).json({ message: 'Planilla no encontrada para actualizar.' });
}
if (e.code === 'P2003' && e.meta?.field_name?.includes('empleado_id')) {
if (e.code === 'P2003') {
return res.status(400).json({ message: 'El empleado_id proporcionado no existe.' });
}
}