Files
sigl/sigl/domain/models/list.py
2022-07-12 12:15:12 -07:00

47 lines
1.1 KiB
Python

"""Sigl Shopping List Domain Model.
Simple Grocery List (Sigl) | sigl.app
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
"""
from dataclasses import dataclass, field
from typing import List
from .mixins import NotesMixin, TimestampMixin
from .product import Product
__all__ = ('ShoppingList', 'ListEntry')
@dataclass
class ListEntry(NotesMixin, TimestampMixin):
"""Information about a Product on a Shopping List.
This class contains information about a Product that is on a shopping
list, including the quantity to be purchased, notes about the entry, and
whether the Product has been crossed off the list or deleted.
"""
id: int = None
quantity: str = None
crossedOff: bool = False
deleted: bool = False
# Relationship Fields
product: Product = None
shoppingList: 'ShoppingList' = None
@dataclass
class ShoppingList(NotesMixin, TimestampMixin):
"""Top-Level Shopping List.
Contains a collection of `ListEntry` items which are intended to be
purchased.
"""
id: int = None
name: str = None
# Relationship Fields
entries: List[ListEntry] = field(default_factory=list)