mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 23:22:57 +01:00
Updated with new models and auth
This commit is contained in:
parent
afa1b249ae
commit
1f5c0d5d7b
16 changed files with 155 additions and 109 deletions
|
|
@ -1,16 +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.models.document import Document
|
||||
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()
|
||||
class CRUDDocuments(CRUDBase[Document, DocumentCreate, DocumentUpdate]):
|
||||
def get_by_id(self, db: Session, *, id: str) -> Optional[Document]:
|
||||
return db.query(self.model).filter(Document.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()
|
||||
def get_by_filename(self, db: Session, *, file_name: str) -> Optional[Document]:
|
||||
return db.query(self.model).filter(Document.filename == file_name).first()
|
||||
|
||||
|
||||
documents = CRUDDocuments(Documents)
|
||||
documents = CRUDDocuments(Document)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue