o
    gW                     @   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 d dlmZ d dlmZ e ZG dd	 d	e	Zed
eejfdededefddZed
eejfdedefddZdS )    )	APIRouterHTTPExceptionDepends)Session)List)	BaseModel)deps)ProductService)Productc                   @   s   e Zd ZU ee ed< dS )UpdateProductImagesRequestimagesN)__name__
__module____qualname__r   str__annotations__ r   r   +/app/app/api/v1/endpoints/product_images.pyr      s   
 r   z/products/{product_id}/images
product_idpayloaddbc                 C   s   t || |jS )N)r	   update_product_imagesr   )r   r   r   r   r   r   update_product_images_endpoint   s   r   c                 C   sD   | ttj| k }|stddd|j  |  ddiS )Ni  zProduct not found)status_codedetailmessagez$Product images deleted successfully.)	queryr
   filteridfirstr   r   clearcommit)r   r   productr   r   r   delete_product_images_endpoint   s   
r#   N)fastapir   r   r   sqlalchemy.ormr   typingr   pydanticr   Zapp.apir   app.services.product_servicer	   app.models.productr
   routerr   putget_dbintr   deleter#   r   r   r   r   <module>   s2    