🐛 fix(crud.py): change HTTP status code from 304 to status.HTTP_304_NOT_MODIFIED for better readability and consistency
✨ feat(crud.py): add support for updating user profile image in the update_user function ✨ feat(test_user.py): add test case for updating user profile image in the test_patch_user function
This commit is contained in:
parent
75f03b17f4
commit
f95a38a4b5
2 changed files with 12 additions and 3 deletions
|
|
@ -1,13 +1,12 @@
|
|||
from datetime import datetime, timezone
|
||||
from typing import Union
|
||||
from uuid import UUID
|
||||
from fastapi import Depends, HTTPException
|
||||
from fastapi import Depends, HTTPException, status
|
||||
from langflow.services.database.models.user.user import User, UserUpdate
|
||||
from langflow.services.utils import get_session
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlmodel import Session
|
||||
|
||||
|
||||
from sqlalchemy.orm.attributes import flag_modified
|
||||
|
||||
|
||||
|
|
@ -37,7 +36,9 @@ def update_user(
|
|||
changed = True
|
||||
|
||||
if not changed:
|
||||
raise HTTPException(status_code=304, detail="Nothing to update")
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_304_NOT_MODIFIED, detail="Nothing to update"
|
||||
)
|
||||
|
||||
user_db.updated_at = datetime.now(timezone.utc)
|
||||
flag_modified(user_db, "updated_at")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue