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

@@ -59,7 +59,7 @@ router.post('/', async (req, res) => {
res.status(201).json(fixBigInt(nuevo))
} catch (e) {
if (e instanceof Prisma.PrismaClientKnownRequestError) {
if (e.code === 'P2002' && e.meta?.target?.includes('cedula')) {
if (e.code === 'P2002') {
return res.status(400).json({ message: 'Ya existe un cliente con esa cédula.' })
}
}
@@ -101,7 +101,7 @@ router.put('/:id', async (req, res) => {
res.json(fixBigInt(actualizado))
} catch (e) {
if (e instanceof Prisma.PrismaClientKnownRequestError) {
if (e.code === 'P2002' && e.meta?.target?.includes('cedula')) {
if (e.code === 'P2002') {
return res.status(400).json({ message: 'Ya existe un cliente con esa cédula.' })
}
if (e.code === 'P2025') {