Skip to content

Commit

Permalink
fix: fix pagination dossiers demandeur (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoannNumericite authored Sep 7, 2023
1 parent 4218d3d commit cc7e5a6
Showing 1 changed file with 48 additions and 3 deletions.
51 changes: 48 additions & 3 deletions formulaire/pages/api/dossier/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ const get: NextApiHandler = async (req, res) => {
const countCurrent = await prisma.dossier.count({
where: {
AND: [
{ userId: session?.dbUser.id },
{
nom: {
contains: req.query.search as string,
mode: "insensitive",
},
},
{
statut: {
in:
Expand All @@ -95,30 +100,70 @@ const get: NextApiHandler = async (req, res) => {
},
},
],
OR: [
{
collaboratorIds: {
has: session?.dbUser.id,
},
},
{
userId: session?.dbUser.id,
},
],
},
});
const countEnCours = await prisma.dossier.count({
where: {
AND: [
{ userId: session?.dbUser.id },
{
nom: {
contains: req.query.search as string,
mode: "insensitive",
},
},
{
statut: {
in: STATUS_EN_COURS as StatutDossier[],
},
},
],
OR: [
{
collaboratorIds: {
has: session?.dbUser.id,
},
},
{
userId: session?.dbUser.id,
},
],
},
});
const countTermines = await prisma.dossier.count({
where: {
AND: [
{ userId: session?.dbUser.id },
{
nom: {
contains: req.query.search as string,
mode: "insensitive",
},
},
{
statut: {
in: STATUS_TERMINES as StatutDossier[],
},
},
],
OR: [
{
collaboratorIds: {
has: session?.dbUser.id,
},
},
{
userId: session?.dbUser.id,
},
],
},
});
await prisma?.$disconnect()
Expand Down

0 comments on commit cc7e5a6

Please sign in to comment.