items-models-import-error

This commit is contained in:
bdrtr 2025-05-08 19:58:41 +03:00
parent 938f950646
commit 7c35097c88
5 changed files with 94 additions and 32 deletions

View file

@ -1,4 +1,4 @@
from .models import UserProfileBase, UserProfileID, UserProfilePrivate, UserProfilePublic, all_users, is_user_exsist
from .models import ItemCreate, UserProfileBase, UserProfileID, UserProfilePrivate, UserProfilePublic, add_Item_user, all_users, is_user_exsist
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from ..config import get_session_db
@ -42,7 +42,14 @@ async def get_user_profile_me(
async def create_user_profile(
user : Annotated[UserProfileID, Depends(get_current_active_user)],
session: Annotated[Session, Depends(get_session_db)],
) -> UserProfileBase:
item : Annotated[ItemCreate , None] = None
) -> dict:
return user
if add_Item_user(user, session, item) :
return {"message": "User item created successfully"}
return {"error": "User item creation failed"}