simplify some type checks by fixing graphql schema

This commit is contained in:
2024-05-14 21:36:05 +02:00
parent ba93e7e783
commit fa3ebdb91c
7 changed files with 69 additions and 222 deletions

View File

@ -49,9 +49,9 @@ class EventCategory(models.Model):
panels = [FieldPanel("name"), FieldPanel("slug"), FieldPanel("show_in_filters")]
graphql_fields = [
GraphQLString("name"),
GraphQLString("slug"),
GraphQLBoolean("show_in_filters"),
GraphQLString("name", required=True),
GraphQLString("slug", required=True),
GraphQLBoolean("show_in_filters", required=True),
]
class Meta:
@ -171,8 +171,20 @@ class EventPage(Page):
GraphQLInt("price_regular"),
GraphQLInt("price_student"),
GraphQLInt("price_member"),
GraphQLCollection(GraphQLForeignKey, "categories", "events.EventCategory"),
GraphQLCollection(GraphQLForeignKey, "occurrences", "events.EventOccurrence"),
GraphQLCollection(
GraphQLForeignKey,
"categories",
"events.EventCategory",
required=True,
item_required=True,
),
GraphQLCollection(
GraphQLForeignKey,
"occurrences",
"events.EventOccurrence",
required=True,
item_required=True,
),
]
@ -195,7 +207,7 @@ class EventOccurrence(Orderable):
]
graphql_fields = [
GraphQLString("start"),
GraphQLString("start", required=True),
GraphQLString("end"),
GraphQLForeignKey("venue", "venues.VenuePage"),
]