Skip to content

Commit

Permalink
Refactor Recurring reservations & more
Browse files Browse the repository at this point in the history
Also refactor ability & age group, reservation purposes, and cancel & deny
reasons. Change a few fields on recurring reservation and create
migrations.
  • Loading branch information
matti-lamppu committed Nov 27, 2023
1 parent ab6a30e commit 76e7eb9
Show file tree
Hide file tree
Showing 79 changed files with 2,845 additions and 2,517 deletions.
40 changes: 18 additions & 22 deletions api/graphql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from rest_framework.generics import get_object_or_404

from api.graphql.extensions.permission_helpers import check_resolver_permission
from api.graphql.types.ability_group.types import AbilityGroupNode
from api.graphql.types.age_group.types import AgeGroupNode
from api.graphql.types.application.mutations import (
ApplicationCancelMutation,
ApplicationCreateMutation,
Expand Down Expand Up @@ -37,13 +39,16 @@
from api.graphql.types.merchants.mutations import RefreshOrderMutation
from api.graphql.types.merchants.permissions import PaymentOrderPermission
from api.graphql.types.merchants.types import PaymentOrderType
from api.graphql.types.recurring_reservation.fields import RecurringReservationsFilter
from api.graphql.types.recurring_reservation.filtersets import RecurringReservationFilterSet
from api.graphql.types.recurring_reservation.mutations import (
RecurringReservationCreateMutation,
RecurringReservationUpdateMutation,
)
from api.graphql.types.recurring_reservation.types import RecurringReservationType
from api.graphql.types.recurring_reservation.types import RecurringReservationNode
from api.graphql.types.reservation_cancel_reason.types import ReservationCancelReasonNode
from api.graphql.types.reservation_deny_reason.types import ReservationDenyReasonNode
from api.graphql.types.reservation_metadataset.fields import ReservationMetadataSetFilter
from api.graphql.types.reservation_metadataset.types import ReservationMetadataSetType
from api.graphql.types.reservation_purpose.types import ReservationPurposeNode
from api.graphql.types.reservation_units.fields import (
EquipmentCategoryFilter,
EquipmentFilter,
Expand Down Expand Up @@ -97,11 +102,6 @@
TaxPercentageType,
)
from api.graphql.types.reservations.fields import (
AgeGroupFilter,
ReservationCancelReasonFilter,
ReservationDenyReasonFilter,
ReservationMetadataSetFilter,
ReservationPurposeFilter,
ReservationsFilter,
)
from api.graphql.types.reservations.filtersets import ReservationFilterSet
Expand All @@ -123,11 +123,6 @@
)
from api.graphql.types.reservations.permissions import ReservationPermission
from api.graphql.types.reservations.types import (
AgeGroupType,
ReservationCancelReasonType,
ReservationDenyReasonType,
ReservationMetadataSetType,
ReservationPurposeType,
ReservationType,
)
from api.graphql.types.resources.fields import ResourcesFilter
Expand Down Expand Up @@ -166,16 +161,17 @@ class Query(graphene.ObjectType):
application_events = ApplicationEventNode.Connection()
application_rounds = ApplicationRoundNode.Connection()

# TODO: REFACTOR
reservations = ReservationsFilter(ReservationType, filterset_class=ReservationFilterSet)
reservation_by_pk = Field(ReservationType, pk=graphene.Int())
# TODO: REFACTOR

recurring_reservations = RecurringReservationsFilter(
RecurringReservationType, filterset_class=RecurringReservationFilterSet
)

reservation_cancel_reasons = ReservationCancelReasonFilter(ReservationCancelReasonType)

reservation_deny_reasons = ReservationDenyReasonFilter(ReservationDenyReasonType)
age_groups = AgeGroupNode.Connection()
ability_groups = AbilityGroupNode.Connection()
recurring_reservations = RecurringReservationNode.Connection()
reservation_cancel_reasons = ReservationCancelReasonNode.Connection()
reservation_deny_reasons = ReservationDenyReasonNode.Connection()
reservation_purposes = ReservationPurposeNode.Connection()

reservation_units = ReservationUnitsFilter(ReservationUnitType, filterset_class=ReservationUnitsFilterSet)
reservation_unit = relay.Node.Field(ReservationUnitType)
Expand Down Expand Up @@ -221,11 +217,9 @@ class Query(graphene.ObjectType):

purposes = PurposeFilter(PurposeType, filterset_class=PurposeFilterSet)
qualifiers = QualifierFilter(QualifierType)
reservation_purposes = ReservationPurposeFilter(ReservationPurposeType)

terms_of_use = TermsOfUseFilter(TermsOfUseType)
tax_percentages = TaxPercentageFilter(TaxPercentageType)
age_groups = AgeGroupFilter(AgeGroupType)
cities = CityNode.Connection()
metadata_sets = ReservationMetadataSetFilter(ReservationMetadataSetType)

Expand Down Expand Up @@ -330,6 +324,7 @@ class Mutation(graphene.ObjectType):
create_recurring_reservation = RecurringReservationCreateMutation.Field()
update_recurring_reservation = RecurringReservationUpdateMutation.Field()

# TODO: REFACTOR
create_reservation = ReservationCreateMutation.Field()
create_staff_reservation = ReservationStaffCreateMutation.Field()
update_reservation = ReservationUpdateMutation.Field()
Expand All @@ -344,6 +339,7 @@ class Mutation(graphene.ObjectType):
adjust_reservation_time = ReservationAdjustTimeMutation.Field()
staff_adjust_reservation_time = ReservationStaffAdjustTimeMutation.Field()
staff_reservation_modify = ReservationStaffModifyMutation.Field()
# TODO: REFACTOR

create_reservation_unit = ReservationUnitCreateMutation.Field()
update_reservation_unit = ReservationUnitUpdateMutation.Field()
Expand Down
Loading

0 comments on commit 76e7eb9

Please sign in to comment.