Skip to content

Commit a2ee9ec

Browse files
committed
Added unchecked get/get all queries
1 parent 7240065 commit a2ee9ec

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/schema.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,15 @@ class Query(graphene.ObjectType):
324324
user_id=graphene.Int(required=True),
325325
description="Get all friends for a user."
326326
)
327+
get_capacity_reminder_by_id = graphene.Field(
328+
CapacityReminder,
329+
id=graphene.Int(required=True),
330+
description="Get a specific capacity reminder by its ID."
331+
)
332+
get_all_capacity_reminders = graphene.List(
333+
CapacityReminder,
334+
description="Get all capacity reminders."
335+
)
327336

328337
def resolve_get_all_gyms(self, info):
329338
query = Gym.get_query(info)
@@ -466,6 +475,20 @@ def resolve_get_user_friends(self, info, user_id):
466475

467476
# Query for all friends at once
468477
return User.get_query(info).filter(UserModel.id.in_(friend_ids)).all()
478+
479+
@jwt_required()
480+
def resolve_get_capacity_reminder_by_id(self, info, id):
481+
reminder = CapacityReminder.get_query(info).filter(CapacityReminderModel.id == id).first()
482+
483+
if not reminder:
484+
raise GraphQLError("Capacity reminder with the given ID does not exist.")
485+
486+
return reminder
487+
488+
@jwt_required()
489+
def resolve_get_all_capacity_reminders(self, info):
490+
query = CapacityReminder.get_query(info)
491+
return query.all()
469492

470493

471494
# MARK: - Mutation

0 commit comments

Comments
 (0)