seguimos depurando la api
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user