Skip to content

Commit

Permalink
Revert "Try eager loading calendars for appointment.get_by_subscriber"
Browse files Browse the repository at this point in the history
This reverts commit 62ddd46.
  • Loading branch information
MelissaAutumn committed Sep 11, 2024
1 parent d0f1e33 commit ebb6d58
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/src/appointment/database/repo/appointment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Repository providing CRUD functions for appointment database models.
"""

from sqlalchemy.orm import Session, joinedload
from sqlalchemy.orm import Session
from .. import models, schemas, repo


Expand Down Expand Up @@ -34,7 +34,7 @@ def get_public(db: Session, slug: str):

def get_by_subscriber(db: Session, subscriber_id: int):
"""retrieve list of appointments by owner id"""
return db.query(models.Appointment).options(joinedload(models.Appointment.calendar)).all()
return db.query(models.Appointment).join(models.Calendar).filter(models.Calendar.owner_id == subscriber_id).all()


def is_owned(db: Session, appointment_id: int, subscriber_id: int):
Expand Down

0 comments on commit ebb6d58

Please sign in to comment.