feat(sqlalchemy): format backend

This commit is contained in:
Jonathan Rohde
2024-06-27 07:48:08 +02:00
parent 320e658595
commit c134eab27a
21 changed files with 232 additions and 289 deletions
+3 -9
View File
@@ -29,9 +29,7 @@ async def get_prompts(user=Depends(get_current_user)):
@router.post("/create", response_model=Optional[PromptModel])
async def create_new_prompt(
form_data: PromptForm, user=Depends(get_admin_user)
):
async def create_new_prompt(form_data: PromptForm, user=Depends(get_admin_user)):
prompt = Prompts.get_prompt_by_command(form_data.command)
if prompt == None:
prompt = Prompts.insert_new_prompt(user.id, form_data)
@@ -54,9 +52,7 @@ async def create_new_prompt(
@router.get("/command/{command}", response_model=Optional[PromptModel])
async def get_prompt_by_command(
command: str, user=Depends(get_current_user)
):
async def get_prompt_by_command(command: str, user=Depends(get_current_user)):
prompt = Prompts.get_prompt_by_command(f"/{command}")
if prompt:
@@ -95,8 +91,6 @@ async def update_prompt_by_command(
@router.delete("/command/{command}/delete", response_model=bool)
async def delete_prompt_by_command(
command: str, user=Depends(get_admin_user)
):
async def delete_prompt_by_command(command: str, user=Depends(get_admin_user)):
result = Prompts.delete_prompt_by_command(f"/{command}")
return result