def get_table( self, filtration: schemas.FilterData[models.Server] = Depends( deps.get_filtration_data(models.Server)), ) -> schemas.Table[schemas.ServerReturn]: amount, items = crud.server.get_multi(self.db, filtration=filtration) return schemas.Table[schemas.ServerReturn](amount=amount, items=items)
def get_directories_table( self, filtration: schemas.FilterData[models.Directory] = Depends( deps.get_filtration_data(models.Directory) ), ) -> schemas.Table[schemas.DirectoryReturn]: amount, items = crud.directory.get_multi(self.db, filtration=filtration) return schemas.Table[schemas.DirectoryReturn](amount=amount, items=items)
def get_plots_table( self, filtration: schemas.FilterData[models.Plot] = Depends( deps.get_filtration_data(models.Plot)), ) -> schemas.Table[schemas.PlotReturn]: amount, items = crud.plot.get_multi(self.db, filtration=filtration) return schemas.Table[schemas.PlotReturn].from_orm(amount=amount, items=items)
def get_queue_table( self, filtration: schemas.FilterData[models.PlotQueue] = Depends( deps.get_filtration_data(models.PlotQueue)), ) -> schemas.Table[schemas.PlotQueueReturn]: amount, items = crud.plot_queue.get_multi(self.db, filtration=filtration) return schemas.Table[schemas.PlotQueueReturn](amount=amount, items=items)
def get_queues_linked_to_directory( self, filtration: schemas.FilterData[models.PlotQueue] = Depends( deps.get_filtration_data(models.PlotQueue) ), ) -> schemas.Table[schemas.PlotQueueReturn]: amount, items = crud.plot_queue.get_multi_linked_to_directory( self.db, directory=self.directory, filtration=filtration ) return schemas.Table[schemas.PlotQueueReturn](amount=amount, items=items)
def get_plots_in_directory( self, filtration: schemas.FilterData[models.Plot] = Depends( deps.get_filtration_data(models.Plot) ), ) -> schemas.Table[schemas.PlotReturn]: amount, items = crud.plot.get_multi_by_directory( self.db, directory=self.directory, filtration=filtration ) return schemas.Table[schemas.PlotReturn](amount=amount, items=items)
def get_queue_plots_data( self, plot_queue: models.PlotQueue = Depends(deps.get_plot_queue_by_id), filtration: schemas.FilterData[models.PlotQueue] = Depends( deps.get_filtration_data(models.PlotQueue)), ) -> schemas.Table[schemas.PlotReturn]: amount, items = crud.plot.get_multi_by_queue(self.db, queue=plot_queue, filtration=filtration) return schemas.Table[schemas.PlotReturn](amount=amount, items=items)
def get_queues_table( self, server: models.Server = Depends(deps.get_server_by_id), filtration: schemas.FilterData[models.Plot] = Depends( deps.get_filtration_data(models.Plot)), ) -> schemas.Table[schemas.PlotQueueReturn]: amount, items = crud.plot_queue.get_multi_by_server( self.db, server=server, filtration=filtration) return schemas.Table[schemas.PlotQueueReturn](amount=amount, items=items)
class PlotCBV(BaseAuthCBV): server: models.Server = Depends(deps.get_server_by_id) filtration: schemas.FilterData[models.Plot] = Depends( deps.get_filtration_data(models.Plot)) @router.get("/created/") def get_created_table(self) -> schemas.Table[schemas.PlotReturn]: amount, items = crud.plot.get_multi_by_created_server( self.db, server=self.server, filtration=self.filtration) return schemas.Table[schemas.PlotReturn](amount=amount, items=items) @router.get("/located/") def get_located_table(self, ) -> schemas.Table[schemas.PlotReturn]: amount, items = crud.plot.get_multi_by_located_server( self.db, server=self.server, filtration=self.filtration) return schemas.Table[schemas.PlotReturn](amount=amount, items=items)