Skip to content

Commit

Permalink
menu item data layer
Browse files Browse the repository at this point in the history
  • Loading branch information
bozzelliandrea committed Jan 29, 2024
1 parent 17aa912 commit e5ae926
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 3 deletions.
4 changes: 4 additions & 0 deletions abstract_data_layer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
from enum import Enum
from typing import TypeVar, Generic, Protocol, List

class EntityNotFoundError(Exception):
def __init__(self):
pass

ID = TypeVar('ID')

class Entity(Generic[ID]):
Expand Down
23 changes: 23 additions & 0 deletions abstract_data_layer/kitchen_menu_item.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from abc import ABC
from typing import Generic, List

from abstract_data_layer.base import ID, CRUD


class KMI(Generic[ID]):
def __init__(self, name: str, category_id: str, description: str = None):
self.name = name
self.category_id = category_id
self.description = description

class KitchenMenuItemRepository(CRUD[KMI[ID], ID], ABC):
def __init__(self):
pass

def find_by_category_id(self, category_id: str) -> List[KMI]:
"""
Find all the saved KMI by categoryId
Returns: list of all KMI
"""
pass
45 changes: 45 additions & 0 deletions abstract_data_layer/plate_kitchen_menu_item.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from abc import ABC
from typing import Generic, List

from abstract_data_layer.base import ID, CRUD
from abstract_data_layer.stats import ItemStatus


class PlateKitchenMenuItem(Generic[ID]):
def __init__(self, plate_id: str,
menu_item_id: str,
order_number: str,
status: ItemStatus = ItemStatus.TODO,
table_num: str = None,
client_name: str = None,
notes: str = None,
take_away: bool = False):
self.plate_id = plate_id
self.menu_item_id = menu_item_id
self.order_number = order_number
self.status = status
self.table_num = table_num
self.client_name = client_name
self.notes = notes
self.take_away = take_away


class PlateKitchenMenuItemRepository(CRUD[PlateKitchenMenuItem[ID], ID], ABC):
def __init__(self):
pass

def find_by_plate_id(self, plate_id: str) -> List[PlateKitchenMenuItem]:
"""
Find all the saved Item by plate id
Returns: list of all PlateKitchenMenuItem
"""
pass

def find_not_in_plate(self) -> List[PlateKitchenMenuItem]:
"""
Find all the saved Item with plate id None (not positioned yet)
Returns: list of all PlateKitchenMenuItem
"""
pass
23 changes: 20 additions & 3 deletions abstract_data_layer/stats.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
from abc import ABC
from enum import Enum
from typing import Generic
from typing import Generic, List
from datetime import datetime

from abstract_data_layer.base import ID
from abstract_data_layer.base import ID, CRUD


class ItemStatus(Enum):
TODO, PROGRESS, DONE, CANCELLED = range(4)

class Stats(Generic[ID]):
def __init__(self, count: int = 0):
self.count = count
self.count = count

class StatsRepository(CRUD[Stats[ID], ID], ABC):
def __init__(self):
pass

def find_by_date_range(self, f: datetime, t: datetime) -> List[Stats]:
"""
Find all the saved stats in the input date range
Args:
f: from date
t: to date
Returns: list of all stats in range
"""
pass

0 comments on commit e5ae926

Please sign in to comment.