server/models/product_catalog/data_classes.py
def deserialize(document):
        """
        Helper function for parsing a Firestore document to a Product object.

        Parameters:
            document (DocumentSnapshot): A snapshot of Firestore document.

        Output:
            A Product object.
        """
        data = document.to_dict()
        if data:
            return Product(
                id=document.id,
                asin=data.get('asin'),
                title=data.get('title'),
                category=data.get('category'),
                brand=data.get('brand'),
                imUrl=data.get('imUrl'),
                price=data.get('price'),
                rating=data.get('rating'),
                created_at=data.get('created_at')
            )

        return None

        Helper function for parsing a Firestore document to a Product object.

        Parameters:
            document (DocumentSnapshot): A snapshot of Firestore document.

        Output:
            A Product object.
        
Helper function for parsing a Firestore document to a Product object.
Helper function for parsing a Firestore document to a Product object .
def deserialize(document):
        data = document.to_dict()
        if data:
            return Product(
                id=document.id,
                asin=data.get('asin'),
                title=data.get('title'),
                category=data.get('category'),
                brand=data.get('brand'),
                imUrl=data.get('imUrl'),
                price=data.get('price'),
                rating=data.get('rating'),
                created_at=data.get('created_at')
            )
        return None
def deserialize ( document ) : data = document . to_dict ( ) if data : return Product ( id = document . id , asin = data . get ( 'asin' ) , title = data . get ( 'title' ) , category = data . get ( 'category' ) , brand = data . get ( 'brand' ) , imUrl = data . get ( 'imUrl' ) , price = data . get ( 'price' ) , rating = data . get ( 'rating' ) , created_at = data . get ( 'created_at' ) ) return None
Helper function for parsing a Firestore document to a Product object.
Helper function for parsing a Firestore document to a Product object .
"""
        Helper function for parsing a Firestore document to a Product object.

        Parameters:
            document (DocumentSnapshot): A snapshot of Firestore document.

        Output:
            A Product object.
        """
document
A snapshot of Firestore document.
A snapshot of Firestore document .