Skip to content

Commit 2eaf68f

Browse files
committed
feat(api): added a searchFilter param to the vaeCollective_commanditaireVaeCollectives query
1 parent fa98823 commit 2eaf68f

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

packages/reva-api/modules/vae-collective/features/getCommanditaireVaeCollectives.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import { prismaClient } from "@/prisma/client";
44
export const getCommanditaireVaeCollectives = async ({
55
offset = 0,
66
limit = 10,
7+
searchFilter,
78
}: {
89
offset?: number;
910
limit?: number;
11+
searchFilter?: string;
1012
}) => {
1113
const commanditaireVaeCollectives =
1214
await prismaClient.commanditaireVaeCollective.findMany({
@@ -15,6 +17,12 @@ export const getCommanditaireVaeCollectives = async ({
1517
orderBy: {
1618
raisonSociale: "asc",
1719
},
20+
where: {
21+
raisonSociale: {
22+
contains: searchFilter,
23+
mode: "insensitive",
24+
},
25+
},
1826
});
1927

2028
const commanditaireVaeCollectivesCount =

packages/reva-api/modules/vae-collective/vae-collective.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type Query {
5252
vaeCollective_commanditaireVaeCollectives(
5353
offset: Int
5454
limit: Int
55+
searchFilter: String
5556
): CommanditaireVaeCollectivePage!
5657
cohorteVaeCollective(codeInscription: String!): CohorteVaeCollective
5758
cohortesVaeCollectivesForConnectedAap: [CohorteVaeCollective!]!

packages/reva-api/modules/vae-collective/vae-collective.resolvers.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,12 @@ const unsafeResolvers = {
122122
) => getCohorteVAECollectiveById({ cohorteVaeCollectiveId }),
123123
vaeCollective_commanditaireVaeCollectives: async (
124124
_parent: unknown,
125-
{ offset, limit }: { offset: number; limit: number; searchText: string },
126-
) => getCommanditaireVaeCollectives({ offset, limit }),
125+
{
126+
offset,
127+
limit,
128+
searchFilter,
129+
}: { offset: number; limit: number; searchFilter: string },
130+
) => getCommanditaireVaeCollectives({ offset, limit, searchFilter }),
127131
},
128132
Mutation: {
129133
vaeCollective_createCohorteVaeCollective: async (

0 commit comments

Comments
 (0)