feat(sqlalchemy): format backend

This commit is contained in:
Jonathan Rohde
2024-06-24 09:57:08 +02:00
parent 320e658595
commit c134eab27a
21 changed files with 232 additions and 289 deletions

View File

@@ -44,9 +44,7 @@ async def get_documents(user=Depends(get_current_user)):
@router.post("/create", response_model=Optional[DocumentResponse])
async def create_new_doc(
form_data: DocumentForm, user=Depends(get_admin_user)
):
async def create_new_doc(form_data: DocumentForm, user=Depends(get_admin_user)):
doc = Documents.get_doc_by_name(form_data.name)
if doc == None:
doc = Documents.insert_new_doc(user.id, form_data)
@@ -76,9 +74,7 @@ async def create_new_doc(
@router.get("/doc", response_model=Optional[DocumentResponse])
async def get_doc_by_name(
name: str, user=Depends(get_current_user)
):
async def get_doc_by_name(name: str, user=Depends(get_current_user)):
doc = Documents.get_doc_by_name(name)
if doc:
@@ -110,12 +106,8 @@ class TagDocumentForm(BaseModel):
@router.post("/doc/tags", response_model=Optional[DocumentResponse])
async def tag_doc_by_name(
form_data: TagDocumentForm, user=Depends(get_current_user)
):
doc = Documents.update_doc_content_by_name(
form_data.name, {"tags": form_data.tags}
)
async def tag_doc_by_name(form_data: TagDocumentForm, user=Depends(get_current_user)):
doc = Documents.update_doc_content_by_name(form_data.name, {"tags": form_data.tags})
if doc:
return DocumentResponse(
@@ -163,8 +155,6 @@ async def update_doc_by_name(
@router.delete("/doc/delete", response_model=bool)
async def delete_doc_by_name(
name: str, user=Depends(get_admin_user)
):
async def delete_doc_by_name(name: str, user=Depends(get_admin_user)):
result = Documents.delete_doc_by_name(name)
return result