Skip to content

Commit

Permalink
add fzPersonen
Browse files Browse the repository at this point in the history
  • Loading branch information
mathe42 committed Jun 27, 2022
1 parent f6e802b commit 41d3233
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))))`
)
}
}
})
})
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 41d3233

Please sign in to comment.