add accepted cover requests

This commit is contained in:
Dobromir Popov
2024-04-28 14:02:57 +03:00
parent 2809bca0e2
commit fa0b9049ef
2 changed files with 12 additions and 22 deletions

View File

@ -35,6 +35,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
throw new Error('Model is required as a part of the URL path.');
}
const modelName = modelArray[0]; // Get the first part of the model array
if (!prisma[modelName]) {
throw new Error(`Model ${modelName} not found in Prisma client.`);
}
const result = await prisma[modelName].findMany(queryOptions);
res.status(200).json(result);
} catch (error) {