app/modules/products/services.py
def delete(self, db: Session, id: int) -> ProductResponse:
        """
        Deletes a product by id.

        Args:
            id (int): The product ID.

        Returns:
            ProductResponse: The Product Response model.
        """        
        deleted_product = db.query(Product).filter(and_(
            Product.id == id,
            Product.is_deleted == False
        )).first()
        if not deleted_product:
            return None

        deleted_product.is_deleted = True
        deleted_product.update(db)
        return deleted_product

        Deletes a product by id.

        Args:
            id (int): The product ID.

        Returns:
            ProductResponse: The Product Response model.
        
Deletes a product by id.
Deletes a product by id .
def delete(self, db: Session, id: int) -> ProductResponse:
        deleted_product = db.query(Product).filter(and_(
            Product.id == id,
            Product.is_deleted == False
        )).first()
        if not deleted_product:
            return None
        deleted_product.is_deleted = True
        deleted_product.update(db)
        return deleted_product
def delete ( self , db : Session , id : int ) -> ProductResponse : deleted_product = db . query ( Product ) . filter ( and_ ( Product . id == id , Product . is_deleted == False ) ) . first ( ) if not deleted_product : return None deleted_product . is_deleted = True deleted_product . update ( db ) return deleted_product
Deletes a product by id.
Deletes a product by id .
"""
        Deletes a product by id.

        Args:
            id (int): The product ID.

        Returns:
            ProductResponse: The Product Response model.
        """
The Product Response model.
The Product Response model .
ProductResponse
self
db
Session
id
int
The product ID.
The product ID .