Added new system prompt

This commit is contained in:
Saurab-Shrestha9639*969**9858//852 2024-05-29 10:55:42 +05:45
parent 474698834f
commit 759767dc1b
4 changed files with 31 additions and 18 deletions

View file

@ -28,11 +28,21 @@ class CRUDDocuments(CRUDBase[Document, DocumentCreate, DocumentUpdate]):
def get_documents_by_departments(
self, db: Session, *, department_id: int
) -> List[Document]:
all_department_id = 1 # department ID for "ALL" is 1
return (
db.query(self.model)
.join(document_department_association)
.join(Department)
.filter(document_department_association.c.department_id == department_id)
.filter(
or_(
and_(
document_department_association.c.department_id == department_id,
),
and_(
document_department_association.c.department_id == all_department_id,
),
)
)
.order_by(desc(getattr(Document, 'uploaded_at')))
.all()
)