from sqlalchemy.orm import Session from app.crud.base import CRUDBase from app.models.devices.status_timestamp import BlowyFeedbackTime, HighSpeedTime from app.schemas.device.status_timestamp import ( BlowyFeedbackTimeCreate, BlowyFeedbackTimeUpdate, HighSpeedTimeCreate, HighSpeedTimeUpdate, ) class CRUDBlowyFeedbackTime( CRUDBase[ BlowyFeedbackTime, BlowyFeedbackTimeCreate, BlowyFeedbackTimeUpdate, ] ): def get_time_by_device( self, db: Session, device_id: str ) -> BlowyFeedbackTime | None: return ( db.query(self.model) .filter(BlowyFeedbackTime.device_id == device_id) .first() ) class CRUDHighSpeedTime( CRUDBase[HighSpeedTime, HighSpeedTimeCreate, HighSpeedTimeUpdate] ): def get_time_by_device( self, db: Session, device_id: str ) -> HighSpeedTime | None: return db.query(self.model).filter(HighSpeedTime.device_id == device_id).first() blowy_feedback_time = CRUDBlowyFeedbackTime(BlowyFeedbackTime) high_speed_time = CRUDHighSpeedTime(HighSpeedTime)