Compare commits

..

No commits in common. "6844b1fb24c3539b6999c04f6ea0430f5975c12a" and "fbd199c39aab12ec70e9486da72538f22e08a158" have entirely different histories.

2 changed files with 2 additions and 7 deletions

View File

@ -28,11 +28,6 @@ export function handlePrismaError(errorObj: any, res: Response, source: string)
res.status(404).json({ status: 'ERROR', errorcode: 'DB_ERROR', message: 'Relation object does not exist', meta: errorObj.meta }); res.status(404).json({ status: 'ERROR', errorcode: 'DB_ERROR', message: 'Relation object does not exist', meta: errorObj.meta });
break; break;
// P2025 -> "An operation failed because it depends on one or more records that were required but not found. {cause}"
case 'P2025':
res.status(404).json({ status: 'ERROR', errorcode: 'DB_ERROR', message: 'Object does not exist', meta: errorObj.meta });
break;
default: default:
res.status(500).json({ status: 'ERROR', errorcode: 'DB_ERROR', message: 'An error occurred during the database operation' }); res.status(500).json({ status: 'ERROR', errorcode: 'DB_ERROR', message: 'An error occurred during the database operation' });
break; break;

View File

@ -13,8 +13,8 @@ async function get(req: Request, res: Response) {
} else { } else {
log.api?.debug('GET products Success:', req.query, value); log.api?.debug('GET products Success:', req.query, value);
if (value.search !== undefined || value.id !== undefined || value.gtin !== undefined) { if (value.search !== undefined || value.id !== undefined) {
// if search or get by id/gtin // if search or get by id
await db await db
.$transaction([ .$transaction([
// Same query for count and findMany // Same query for count and findMany