
    b6i
                     f   d dl mZmZmZmZmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZmZmZ d dlmZ d dlmZ d dlmZ  ed	d
g      Zej1                  deej2                  d       ee
      fdefd       Zej7                  deej2                  d       ee       ee
      fdededefd       Zej7                  deej2                  d       ed       ee       ee
      fdededefd       Zej7                  deej2                  d       ee       ee
      fdededefd       Zy)     )	APIRouterDepends
UploadFileFilestatusHTTPException)Session)get_current_user)get_session)UserRead
UserUpdateUserPasswordChange)UserService)User)ERR_USER_NOT_FOUNDz
/api/usersUsers)prefixtagsz/mezGet current user)response_modelstatus_codesummarycurrent_userc                     | S )z2
    Return the authenticated user's profile.
     )r   s    F/var/www/html/story-book/Story-Book-python-api/app/api/routes/users.pyget_mer      s
    
     z/updatezUpdate current userdatasessionc                 0    t        j                  || |      S )zj
    Update allowed profile fields (first_name, last_name, phone).
    Partial updates are supported.
    )r   update_user)r   r   r   s      r   update_profiler"      s     ""<w??r   z/upload-profile-imagezUpload profile image.filec                 0    t        j                  || |      S )zC
    Upload and set the user's profile image after validation.
    )r   update_profile_image)r#   r   r   s      r   upload_profile_imager&   "   s     ++L$HHr   z/change-passwordzChange passwordbodyc                 Z    t        j                  || j                  | j                  |      S )zP
    Change the current user's password (requires old password validation).
    )r   change_passwordold_passwordnew_password)r'   r   r   s      r   r)   r)   -   s(     &&|T5F5FHYHY[bccr   N)fastapir   r   r   r   r   r   sqlmodelr	   app.api.depsr
   app.db.sessionr   app.schemas.userr   r   r   app.services.user_servicer   app.models.userr   app.core.constantsr   routergetHTTP_200_OKr   patchr"   r&   r)   r   r   r   <module>r8      s   O O  ) & E E 1   
,gY	7E(8J8JTfg '(8 9   h if>P>PZop {+ !12	@
	@	@ 	@ q	@ %hFL^L^h~Cy{+ !12I
II I @I  vGYGYctu {+ !12d
dd d vdr   