Skip to content

Commit

Permalink
SyncDatabase: Add find_by_id method
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Jul 7, 2024
1 parent f2e31c5 commit e13a0e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plextraktsync/db/SyncDatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from typing import TYPE_CHECKING

from sqlmodel import Session, select

from plextraktsync.db.models.SyncRecord import SyncRecord

if TYPE_CHECKING:
Expand All @@ -14,6 +16,11 @@ class SyncDatabase:
def __init__(self, engine: Engine):
self.engine = engine

def find_by_id(self, media_id: int):
with Session(self.engine) as session:
statement = select(SyncRecord).where(SyncRecord.media_id == media_id)
return session.exec(statement).first()

def insert(self, record: SyncRecord):
pass

Expand Down

0 comments on commit e13a0e0

Please sign in to comment.