refac: files rbac

This commit is contained in:
Timothy J. Baek
2024-08-23 16:19:04 +02:00
parent 8b3d5e8b80
commit 4519ddd0e9
2 changed files with 15 additions and 6 deletions

View File

@@ -98,6 +98,13 @@ class FilesTable:
return [FileModel.model_validate(file) for file in db.query(File).all()]
def get_files_by_user_id(self, user_id: str) -> list[FileModel]:
with get_db() as db:
return [
FileModel.model_validate(file)
for file in db.query(File).filter_by(user_id=user_id).all()
]
def delete_file_by_id(self, id: str) -> bool:
with get_db() as db: