48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
"""Sigl Product 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, TYPE_CHECKING
|
|
|
|
from .mixins import NotesMixin, TimestampMixin
|
|
|
|
if TYPE_CHECKING:
|
|
from .list import ListEntry
|
|
|
|
__all__ = ('Product', 'ProductLocation')
|
|
|
|
|
|
@dataclass
|
|
class Product(NotesMixin, TimestampMixin):
|
|
"""Information about a single Product.
|
|
|
|
This class contains information about a single Product that can be on a
|
|
shopping list, including the Product Name, Category, Notes, and Product
|
|
Location in one or more stores.
|
|
"""
|
|
id: int = None
|
|
name: str = None
|
|
category: str = None
|
|
|
|
# Relationship Fields
|
|
entries: List['ListEntry'] = field(default_factory=list)
|
|
locations: List['ProductLocation'] = field(default_factory=list)
|
|
|
|
|
|
@dataclass
|
|
class ProductLocation(NotesMixin):
|
|
"""Location of a Product in a Store.
|
|
|
|
Stores the location of a Product within a store using an aisle and bin
|
|
location system.
|
|
"""
|
|
store: str = None
|
|
aisle: str = None
|
|
bin: str = None
|
|
|
|
# Relationship Fields
|
|
product: 'Product' = None
|