From 41d3233604aeb5b811dced745b891c0184000a3f Mon Sep 17 00:00:00 2001 From: mathe42 <2pi_r2@gmx.de> Date: Mon, 27 Jun 2022 15:25:59 +0200 Subject: [PATCH] add fzPersonen --- src/graphql.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/graphql.ts b/src/graphql.ts index 66d8ddb4..e756d249 100644 --- a/src/graphql.ts +++ b/src/graphql.ts @@ -281,6 +281,14 @@ const ecKreis = new GraphQLObjectType({ }, website: { type: new GraphQLNonNull(GraphQLString) + }, + fzPersonen: { + type: new GraphQLList(person), + resolve(val: { ecKreisID: number }) { + return query( + `SELECT * FROM personen WHERE personen.ecKreis = ${val.ecKreisID} AND (EXISTS (SELECT * FROM fzAntrag WHERE fzAntrag.personID = personen.personID) OR EXISTS (SELECT * FROM fz WHERE fz.personID = personen.personID AND fz.fzVon > (DATE_SUB(NOW(), INTERVAL 7 YEAR))))` + ) + } } }) }) @@ -1009,6 +1017,15 @@ export const schema = new GraphQLSchema({ name: 'rootQuery', fields: { + fzPersonen: { + args: addAuth({}), + type: new GraphQLList(person), + resolve: handleAuth(() => + query( + `SELECT * FROM personen WHERE EXISTS (SELECT * FROM fzAntrag WHERE fzAntrag.personID = personen.personID) OR EXISTS (SELECT * FROM fz WHERE fz.personID = personen.personID AND fz.fzVon > (DATE_SUB(NOW(), INTERVAL 7 YEAR)))` + ) + ) + }, ecKreise: { args: addAuth({}), type: new GraphQLList(ecKreis),