o
    Ah@                     @   s&  d dl 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 e Zejdedeejfded	ejfd
dZedeejfded	ejfddZejdedeejfded	ejfddZejdedeejfdeded	ejfddZedeejfded	ejfddZdS )    )	APIRouterHTTPExceptionDepends)database)CustomerAccount)customer_accounts)Dict/)response_modeldatadbc              
   C   s8   zt | |W S  ty } ztdt|dd }~ww )Ni  status_codedetail)customer_servicecreate_customer_account_service
ValueErrorr   str)r   r   e r   E/var/www/html/moveengine/app/v1/routers/platform/customer_accounts.pycreate_customer_account	   s   r   z/{account_id}
account_idc                 C      t | |S N)r   get_customer_accounts_service)r   r   r   r   r   list_customer_accounts      r   z/detail/{customer_account_id}customer_account_idc                 C   s    t | |}|stddd|S )Ni  zCustomer account not foundr   )r   get_customer_account_servicer   )r   r   accountr   r   r   get_customer_account   s   r!   z/{customer_account_id}c                 C   s   t | |jdd|S )NT)exclude_unset)r   update_customer_account_servicedict)r   r   r   r   r   r   update_customer_account$   s   r%   c                 C   r   r   )r   delete_customer_account_service)r   r   r   r   r   delete_customer_account,   r   r'   N)fastapir   r   r   app.dbr   (app.v1.models.platform.customer_accountsr   app.v1.services.platformr   r   typingr   routerpostget_mongo_dbMongoDBr   getr   r   r!   putr%   deleter'   r   r   r   r   <module>   sV    		