mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 20:12:55 +01:00
Added documents upload table
This commit is contained in:
parent
2ce2b794c0
commit
85eddaf471
24 changed files with 339 additions and 129 deletions
16
private_gpt/users/crud/document_crud.py
Normal file
16
private_gpt/users/crud/document_crud.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from sqlalchemy.orm import Session
|
||||
from private_gpt.users.schemas.documents import DocumentCreate, DocumentUpdate
|
||||
from private_gpt.users.models.documents import Documents
|
||||
from private_gpt.users.crud.base import CRUDBase
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class CRUDDocuments(CRUDBase[Documents, DocumentCreate, DocumentUpdate]):
|
||||
def get_by_id(self, db: Session, *, id: str) -> Optional[Documents]:
|
||||
return db.query(self.model).filter(Documents.id == id).first()
|
||||
|
||||
def get_by_filename(self, db: Session, *, file_name: str) -> Optional[Documents]:
|
||||
return db.query(self.model).filter(Documents.filename == file_name).first()
|
||||
|
||||
|
||||
documents = CRUDDocuments(Documents)
|
||||
Loading…
Add table
Add a link
Reference in a new issue