Chore: Updated dependencies and moved to Python 3.10 method of type hinting
This commit is contained in:
1 parent
2f1f9eee1f
commit
61bb62475b
70 files changed
+259
-344
No files matched your search
@@ -2,25 +2,25 @@
|
|||||||
# See https://pre-commit.com/hooks.html for more hooks
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 20.8b1
|
rev: 22.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
|
|
||||||
- repo: https://gitlab.com/pycqa/flake8
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 3.8.4
|
rev: 4.0.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
args: ['--config=barker/.flake8']
|
args: ['--config=barker/.flake8']
|
||||||
|
|
||||||
- repo: https://github.com/timothycrosley/isort
|
- repo: https://github.com/timothycrosley/isort
|
||||||
rev: 5.6.2
|
rev: 5.10.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
additional_dependencies: [toml]
|
additional_dependencies: [toml]
|
||||||
exclude: ^.*/?setup\.py$
|
exclude: ^.*/?setup\.py$
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v3.2.0
|
rev: v4.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import List, Optional, Tuple
|
|
||||||
|
|
||||||
from fastapi import Depends, HTTPException, Security, status
|
from fastapi import Depends, HTTPException, Security, status
|
||||||
from fastapi.security import OAuth2PasswordBearer, SecurityScopes
|
from fastapi.security import OAuth2PasswordBearer, SecurityScopes
|
||||||
@@ -30,7 +29,7 @@ class Token(BaseModel):
|
|||||||
|
|
||||||
class TokenData(BaseModel):
|
class TokenData(BaseModel):
|
||||||
username: str = ""
|
username: str = ""
|
||||||
scopes: List[str] = []
|
scopes: list[str] = []
|
||||||
|
|
||||||
|
|
||||||
def f7(seq):
|
def f7(seq):
|
||||||
@@ -50,7 +49,7 @@ def create_access_token(*, data: dict, expires_delta: timedelta = None):
|
|||||||
return encoded_jwt
|
return encoded_jwt
|
||||||
|
|
||||||
|
|
||||||
def get_user(username: str, id_: str, locked_out: bool, scopes: List[str]) -> UserToken:
|
def get_user(username: str, id_: str, locked_out: bool, scopes: list[str]) -> UserToken:
|
||||||
return UserToken(
|
return UserToken(
|
||||||
id_=uuid.UUID(id_),
|
id_=uuid.UUID(id_),
|
||||||
name=username,
|
name=username,
|
||||||
@@ -60,12 +59,12 @@ def get_user(username: str, id_: str, locked_out: bool, scopes: List[str]) -> Us
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def authenticate_user(username: str, password: str, db: Session) -> Optional[UserModel]:
|
def authenticate_user(username: str, password: str, db: Session) -> UserModel | None:
|
||||||
user = UserModel.auth(username, password, db)
|
user = UserModel.auth(username, password, db)
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
def device_allowed(user: UserModel, device_id: Optional[uuid.UUID], db: Session) -> Tuple[bool, Device]:
|
def device_allowed(user: UserModel, device_id: uuid.UUID | None, db: Session) -> tuple[bool, Device]:
|
||||||
device: Device = db.execute(select(Device).where(Device.id == device_id)).scalars().one_or_none()
|
device: Device = db.execute(select(Device).where(Device.id == device_id)).scalars().one_or_none()
|
||||||
if device is None:
|
if device is None:
|
||||||
device = Device.create(db)
|
device = Device.create(db)
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import locale
|
import locale
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Union
|
|
||||||
|
|
||||||
|
|
||||||
def currency_format(amount: Union[Decimal, int]) -> str:
|
def currency_format(amount: Decimal | int) -> str:
|
||||||
return locale.currency(amount, symbol=False, grouping=True)
|
return locale.currency(amount, symbol=False, grouping=True)
|
||||||
|
|
||||||
|
|
||||||
def format_no_decimals(amount: Union[Decimal, int]) -> str:
|
def format_no_decimals(amount: Decimal | int) -> str:
|
||||||
return locale.format_string("%d", amount, grouping=True, monetary=True)
|
return locale.format_string("%d", amount, grouping=True, monetary=True)
|
||||||
@@ -5,7 +5,6 @@ import uuid
|
|||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List, Tuple
|
|
||||||
|
|
||||||
from arq import ArqRedis, create_pool
|
from arq import ArqRedis, create_pool
|
||||||
from barker.core.config import settings
|
from barker.core.config import settings
|
||||||
@@ -34,8 +33,8 @@ def print_bill(voucher_id: uuid.UUID, db: Session):
|
|||||||
.where(SectionPrinter.sale_category_id == None) # noqa: E711
|
.where(SectionPrinter.sale_category_id == None) # noqa: E711
|
||||||
).scalar_one()
|
).scalar_one()
|
||||||
|
|
||||||
items_dict = {}
|
items_dict: dict[tuple[uuid.UUID, bool, Decimal, set[uuid.UUID]], Inventory] = {}
|
||||||
tax = {}
|
tax: dict[tuple[uuid.UUID, int], tuple[str, Decimal]] = {}
|
||||||
for i in [i for k in voucher.kots for i in k.inventories]:
|
for i in [i for k in voucher.kots for i in k.inventories]:
|
||||||
key = (
|
key = (
|
||||||
i.product_id,
|
i.product_id,
|
||||||
@@ -62,7 +61,7 @@ def print_bill(voucher_id: uuid.UUID, db: Session):
|
|||||||
|
|
||||||
for i in [it for it in items_dict.values() if it.quantity != 0]:
|
for i in [it for it in items_dict.values() if it.quantity != 0]:
|
||||||
get_tax_item(i.tax.id, i.tax.name, i.tax_amount, tax)
|
get_tax_item(i.tax.id, i.tax.name, i.tax_amount, tax)
|
||||||
data = design_bill(voucher, items_dict.values(), tax.values(), db)
|
data = design_bill(voucher, list(items_dict.values()), list(tax.values()), db)
|
||||||
redis: ArqRedis = asyncio.run(create_pool(redis_settings))
|
redis: ArqRedis = asyncio.run(create_pool(redis_settings))
|
||||||
asyncio.run(
|
asyncio.run(
|
||||||
redis.enqueue_job(
|
redis.enqueue_job(
|
||||||
@@ -71,27 +70,29 @@ def print_bill(voucher_id: uuid.UUID, db: Session):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_tax_item(id_: uuid.UUID, tax_name: str, amount: Decimal, tax_dict: {}) -> None:
|
def get_tax_item(
|
||||||
|
id_: uuid.UUID, tax_name: str, amount: Decimal, tax_dict: dict[tuple[uuid.UUID, int], tuple[str, Decimal]]
|
||||||
|
) -> None:
|
||||||
items = tax_name.split(";")
|
items = tax_name.split(";")
|
||||||
if len(items) == 1:
|
if len(items) == 1:
|
||||||
key = (id_, 0)
|
key = (id_, 0)
|
||||||
old_amount = tax_dict[key][1] if key in tax_dict else 0
|
old_amount = tax_dict[key][1] if key in tax_dict else Decimal(0)
|
||||||
tax_dict[key] = tax_name, round(amount + old_amount, 2)
|
tax_dict[key] = tax_name, round(amount + old_amount, 2)
|
||||||
else:
|
else:
|
||||||
for i, item in enumerate(it.strip() for it in items):
|
for i, item in enumerate(it.strip() for it in items):
|
||||||
key = (id_, i)
|
key = (id_, i)
|
||||||
old_amount = tax_dict[key][1] if key in tax_dict else 0
|
old_amount = tax_dict[key][1] if key in tax_dict else Decimal(0)
|
||||||
match = re.match(r"(^.*)\s+\((.*?)/(.*?)\)[^(]*$", item)
|
match = re.match(r"(^.*)\s+\((.*?)/(.*?)\)[^(]*$", item)
|
||||||
if not match or len(match.groups()) != 3:
|
if not match or len(match.groups()) != 3:
|
||||||
raise Exception("Error in tax as it has multiple items, but the format is wrong.")
|
raise Exception("Error in tax as it has multiple items, but the format is wrong.")
|
||||||
sub_amount = round(amount * Decimal(match.group(2)) / Decimal(match.group(3)), 2)
|
sub_amount: Decimal = round(amount * Decimal(match.group(2)) / Decimal(match.group(3)), 2)
|
||||||
tax_dict[(id_, i)] = match.group(1), round(sub_amount + old_amount, 2)
|
tax_dict[(id_, i)] = match.group(1), round(sub_amount + old_amount, 2)
|
||||||
|
|
||||||
|
|
||||||
def design_bill(
|
def design_bill(
|
||||||
voucher: Voucher,
|
voucher: Voucher,
|
||||||
items: List[Tuple[Inventory, Decimal]],
|
items: list[Inventory],
|
||||||
tax: List[Tuple[str, Decimal]],
|
tax: list[tuple[str, Decimal]],
|
||||||
db: Session,
|
db: Session,
|
||||||
):
|
):
|
||||||
# Header
|
# Header
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import asyncio
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Any, Dict, List, Tuple
|
from typing import Any
|
||||||
|
|
||||||
from arq import ArqRedis, create_pool
|
from arq import ArqRedis, create_pool
|
||||||
from barker.core.config import settings
|
from barker.core.config import settings
|
||||||
@@ -18,7 +18,7 @@ from ..models.section_printer import SectionPrinter
|
|||||||
from ..models.voucher import Voucher
|
from ..models.voucher import Voucher
|
||||||
|
|
||||||
|
|
||||||
def design_kot(voucher: Voucher, kot: Kot, items: List[Inventory], copy_number: int, db: Session) -> str:
|
def design_kot(voucher: Voucher, kot: Kot, items: list[Inventory], copy_number: int, db: Session) -> str:
|
||||||
date_ = kot.date + timedelta(minutes=settings.TIMEZONE_OFFSET_MINUTES)
|
date_ = kot.date + timedelta(minutes=settings.TIMEZONE_OFFSET_MINUTES)
|
||||||
product_date = (
|
product_date = (
|
||||||
voucher.date + timedelta(minutes=settings.TIMEZONE_OFFSET_MINUTES - settings.NEW_DAY_OFFSET_MINUTES)
|
voucher.date + timedelta(minutes=settings.TIMEZONE_OFFSET_MINUTES - settings.NEW_DAY_OFFSET_MINUTES)
|
||||||
@@ -66,7 +66,7 @@ def design_kot(voucher: Voucher, kot: Kot, items: List[Inventory], copy_number:
|
|||||||
|
|
||||||
def print_kot(voucher_id: uuid.UUID, db: Session):
|
def print_kot(voucher_id: uuid.UUID, db: Session):
|
||||||
voucher: Voucher = db.execute(select(Voucher).where(Voucher.id == voucher_id)).scalar_one()
|
voucher: Voucher = db.execute(select(Voucher).where(Voucher.id == voucher_id)).scalar_one()
|
||||||
my_hash: Dict[Tuple[uuid.UUID, int], Tuple[Printer, List[Any]]] = {}
|
my_hash: dict[tuple[uuid.UUID, int], tuple[Printer, list[Any]]] = {}
|
||||||
kot: Kot = voucher.kots[-1]
|
kot: Kot = voucher.kots[-1]
|
||||||
product_date = (
|
product_date = (
|
||||||
voucher.date + timedelta(minutes=settings.TIMEZONE_OFFSET_MINUTES - settings.NEW_DAY_OFFSET_MINUTES)
|
voucher.date + timedelta(minutes=settings.TIMEZONE_OFFSET_MINUTES - settings.NEW_DAY_OFFSET_MINUTES)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from barker.core.config import settings
|
from barker.core.config import settings
|
||||||
|
|
||||||
@@ -8,7 +7,7 @@ def query_date(d: str = None) -> date:
|
|||||||
return date.today() if d is None else datetime.strptime(d, "%d-%b-%Y").date()
|
return date.today() if d is None else datetime.strptime(d, "%d-%b-%Y").date()
|
||||||
|
|
||||||
|
|
||||||
def optional_query_date(d: str = None) -> Optional[date]:
|
def optional_query_date(d: str = None) -> date | None:
|
||||||
return None if d is None else datetime.strptime(d, "%d-%b-%Y").date()
|
return None if d is None else datetime.strptime(d, "%d-%b-%Y").date()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.customer as schemas
|
import barker.schemas.customer as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||||
@@ -31,7 +29,7 @@ def save(
|
|||||||
db.add(item)
|
db.add(item)
|
||||||
add_discounts(item, data.discounts, db)
|
add_discounts(item, data.discounts, db)
|
||||||
db.commit()
|
db.commit()
|
||||||
sc: List[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
sc: list[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
||||||
return customer_info(item, sc)
|
return customer_info(item, sc)
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
@@ -55,7 +53,7 @@ def update_route(
|
|||||||
item.print_in_bill = data.print_in_bill
|
item.print_in_bill = data.print_in_bill
|
||||||
add_discounts(item, data.discounts, db)
|
add_discounts(item, data.discounts, db)
|
||||||
db.commit()
|
db.commit()
|
||||||
sc: List[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
sc: list[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
||||||
return customer_info(item, sc)
|
return customer_info(item, sc)
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
@@ -64,7 +62,7 @@ def update_route(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_discounts(customer: Customer, discounts: List[schemas.DiscountItem], db: Session) -> None:
|
def add_discounts(customer: Customer, discounts: list[schemas.DiscountItem], db: Session) -> None:
|
||||||
for discount in discounts:
|
for discount in discounts:
|
||||||
cd = next((d for d in customer.discounts if d.sale_category_id == discount.id_), None)
|
cd = next((d for d in customer.discounts if d.sale_category_id == discount.id_), None)
|
||||||
if cd is None:
|
if cd is None:
|
||||||
@@ -91,24 +89,24 @@ def show_blank(
|
|||||||
user: UserToken = Security(get_user, scopes=["customers"]),
|
user: UserToken = Security(get_user, scopes=["customers"]),
|
||||||
) -> schemas.CustomerBlank:
|
) -> schemas.CustomerBlank:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
sc: List[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
sc: list[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
||||||
return blank_customer_info(sc)
|
return blank_customer_info(sc)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.Customer])
|
@router.get("/list", response_model=list[schemas.Customer])
|
||||||
def show_list(user: UserToken = Depends(get_user)) -> List[schemas.Customer]:
|
def show_list(user: UserToken = Depends(get_user)) -> list[schemas.Customer]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
sc: List[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
sc: list[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
||||||
return [
|
return [
|
||||||
customer_info(item, sc) for item in db.execute(select(Customer).order_by(Customer.name)).scalars().all()
|
customer_info(item, sc) for item in db.execute(select(Customer).order_by(Customer.name)).scalars().all()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@router.get("/query", response_model=List[schemas.Customer])
|
@router.get("/query", response_model=list[schemas.Customer])
|
||||||
def show_term(
|
def show_term(
|
||||||
q: str,
|
q: str,
|
||||||
current_user: UserToken = Depends(get_user),
|
current_user: UserToken = Depends(get_user),
|
||||||
) -> List[schemas.Customer]:
|
) -> list[schemas.Customer]:
|
||||||
query = select(Customer)
|
query = select(Customer)
|
||||||
if q is not None:
|
if q is not None:
|
||||||
for item in q.split():
|
for item in q.split():
|
||||||
@@ -116,7 +114,7 @@ def show_term(
|
|||||||
|
|
||||||
query = query.order_by(Customer.name)
|
query = query.order_by(Customer.name)
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
sc: List[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
sc: list[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
||||||
return [customer_info(item, sc) for item in db.execute(query).scalars().all()]
|
return [customer_info(item, sc) for item in db.execute(query).scalars().all()]
|
||||||
|
|
||||||
|
|
||||||
@@ -126,12 +124,12 @@ def show_id(
|
|||||||
user: UserToken = Security(get_user, scopes=["customers"]),
|
user: UserToken = Security(get_user, scopes=["customers"]),
|
||||||
) -> schemas.Customer:
|
) -> schemas.Customer:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
sc: List[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
sc: list[SaleCategory] = db.execute(select(SaleCategory).order_by(SaleCategory.name)).scalars().all()
|
||||||
item: Customer = db.execute(select(Customer).where(Customer.id == id_)).scalar_one()
|
item: Customer = db.execute(select(Customer).where(Customer.id == id_)).scalar_one()
|
||||||
return customer_info(item, sc)
|
return customer_info(item, sc)
|
||||||
|
|
||||||
|
|
||||||
def customer_info(item: Customer, sale_categories: List[SaleCategory]) -> schemas.Customer:
|
def customer_info(item: Customer, sale_categories: list[SaleCategory]) -> schemas.Customer:
|
||||||
return schemas.Customer(
|
return schemas.Customer(
|
||||||
id=item.id,
|
id=item.id,
|
||||||
name=item.name,
|
name=item.name,
|
||||||
@@ -149,7 +147,7 @@ def customer_info(item: Customer, sale_categories: List[SaleCategory]) -> schema
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def blank_customer_info(sale_categories: List[SaleCategory]) -> schemas.CustomerBlank:
|
def blank_customer_info(sale_categories: list[SaleCategory]) -> schemas.CustomerBlank:
|
||||||
return schemas.CustomerBlank(
|
return schemas.CustomerBlank(
|
||||||
name="",
|
name="",
|
||||||
address="",
|
address="",
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.customer as schemas
|
import barker.schemas.customer as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, Security
|
from fastapi import APIRouter, Security
|
||||||
@@ -19,25 +17,25 @@ from ..schemas.user_token import UserToken
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.get("", response_model=List[schemas.DiscountItem])
|
@router.get("", response_model=list[schemas.DiscountItem])
|
||||||
def show_blank(
|
def show_blank(
|
||||||
user: UserToken = Security(get_user, scopes=["customers"]),
|
user: UserToken = Security(get_user, scopes=["customers"]),
|
||||||
) -> List[schemas.DiscountItem]:
|
) -> list[schemas.DiscountItem]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return customer_discounts_blank(db)
|
return customer_discounts_blank(db)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/{id_}", response_model=List[schemas.DiscountItem])
|
@router.get("/{id_}", response_model=list[schemas.DiscountItem])
|
||||||
def show_id(
|
def show_id(
|
||||||
id_: uuid.UUID,
|
id_: uuid.UUID,
|
||||||
user: UserToken = Security(get_user, scopes=["customers"]),
|
user: UserToken = Security(get_user, scopes=["customers"]),
|
||||||
) -> List[schemas.DiscountItem]:
|
) -> list[schemas.DiscountItem]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
item: Customer = db.execute(select(Customer).where(Customer.id == id_)).scalar_one()
|
item: Customer = db.execute(select(Customer).where(Customer.id == id_)).scalar_one()
|
||||||
return customer_discounts(item, db)
|
return customer_discounts(item, db)
|
||||||
|
|
||||||
|
|
||||||
def customer_discounts(item: Customer, db: Session) -> List[schemas.DiscountItem]:
|
def customer_discounts(item: Customer, db: Session) -> list[schemas.DiscountItem]:
|
||||||
default_discount = (
|
default_discount = (
|
||||||
db.execute(select(DbSetting).where(DbSetting.name == "Prefill Customer Discount")).scalar_one().data["Value"]
|
db.execute(select(DbSetting).where(DbSetting.name == "Prefill Customer Discount")).scalar_one().data["Value"]
|
||||||
)
|
)
|
||||||
@@ -58,7 +56,7 @@ def customer_discounts(item: Customer, db: Session) -> List[schemas.DiscountItem
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def customer_discounts_blank(db: Session) -> List[schemas.DiscountItem]:
|
def customer_discounts_blank(db: Session) -> list[schemas.DiscountItem]:
|
||||||
return [
|
return [
|
||||||
schemas.DiscountItem(
|
schemas.DiscountItem(
|
||||||
id=sc.id,
|
id=sc.id,
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.device as schemas
|
import barker.schemas.device as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||||
@@ -57,7 +55,7 @@ def delete_route(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.Device])
|
@router.get("/list", response_model=list[schemas.Device])
|
||||||
def show_list(user: UserToken = Depends(get_user)):
|
def show_list(user: UserToken = Depends(get_user)):
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [device_info(item) for item in db.execute(select(Device).order_by(Device.name)).scalars().all()]
|
return [device_info(item) for item in db.execute(select(Device).order_by(Device.name)).scalars().all()]
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
import barker.schemas.guest_book as schemas
|
import barker.schemas.guest_book as schemas
|
||||||
|
|
||||||
@@ -101,7 +100,7 @@ def show_blank(
|
|||||||
|
|
||||||
@router.get("/list", response_model=schemas.GuestBookList)
|
@router.get("/list", response_model=schemas.GuestBookList)
|
||||||
def show_list(
|
def show_list(
|
||||||
q: Optional[str] = None,
|
q: str | None = None,
|
||||||
user: UserToken = Depends(get_user),
|
user: UserToken = Depends(get_user),
|
||||||
) -> schemas.GuestBookList:
|
) -> schemas.GuestBookList:
|
||||||
if q is None or q == "":
|
if q is None or q == "":
|
||||||
@@ -124,7 +123,7 @@ def show_list(
|
|||||||
.order_by(GuestBook.date)
|
.order_by(GuestBook.date)
|
||||||
)
|
)
|
||||||
|
|
||||||
guest_book: List[schemas.GuestBookListItem] = []
|
guest_book: list[schemas.GuestBookListItem] = []
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
for i, item in enumerate(db.execute(list_).scalars().all()):
|
for i, item in enumerate(db.execute(list_).scalars().all()):
|
||||||
guest_book.insert(
|
guest_book.insert(
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from fastapi import (
|
from fastapi import (
|
||||||
APIRouter,
|
APIRouter,
|
||||||
@@ -36,7 +35,7 @@ router = APIRouter()
|
|||||||
def login_for_access_token(
|
def login_for_access_token(
|
||||||
response: Response,
|
response: Response,
|
||||||
form_data: OAuth2PasswordRequestForm = Depends(),
|
form_data: OAuth2PasswordRequestForm = Depends(),
|
||||||
device_id: Optional[uuid.UUID] = Cookie(None),
|
device_id: uuid.UUID | None = Cookie(None),
|
||||||
):
|
):
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
user = authenticate_user(form_data.username.strip(), form_data.password.strip(), db)
|
user = authenticate_user(form_data.username.strip(), form_data.password.strip(), db)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import uuid
|
|||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from operator import and_, or_
|
from operator import and_, or_
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.menu_category as schemas
|
import barker.schemas.menu_category as schemas
|
||||||
|
|
||||||
@@ -21,11 +20,11 @@ from . import effective_date
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.post("/list", response_model=List[schemas.MenuCategory])
|
@router.post("/list", response_model=list[schemas.MenuCategory])
|
||||||
def sort_order(
|
def sort_order(
|
||||||
data: List[schemas.MenuCategory],
|
data: list[schemas.MenuCategory],
|
||||||
user: UserToken = Security(get_user, scopes=["sections"]),
|
user: UserToken = Security(get_user, scopes=["sections"]),
|
||||||
) -> List[schemas.MenuCategory]:
|
) -> list[schemas.MenuCategory]:
|
||||||
try:
|
try:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
for index, item in enumerate(data):
|
for index, item in enumerate(data):
|
||||||
@@ -113,12 +112,12 @@ def show_blank(
|
|||||||
return menu_category_blank()
|
return menu_category_blank()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.MenuCategory])
|
@router.get("/list", response_model=list[schemas.MenuCategory])
|
||||||
def show_list(
|
def show_list(
|
||||||
p: bool = False,
|
p: bool = False,
|
||||||
date_: date = Depends(effective_date),
|
date_: date = Depends(effective_date),
|
||||||
user: UserToken = Depends(get_user),
|
user: UserToken = Depends(get_user),
|
||||||
) -> List[schemas.MenuCategory]:
|
) -> list[schemas.MenuCategory]:
|
||||||
if p:
|
if p:
|
||||||
sq = select(distinct(ProductVersion.menu_category_id)).where(
|
sq = select(distinct(ProductVersion.menu_category_id)).where(
|
||||||
and_(
|
and_(
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.modifier as schemas
|
import barker.schemas.modifier as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||||
@@ -89,8 +87,8 @@ def show_blank(
|
|||||||
return modifier_blank()
|
return modifier_blank()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.Modifier])
|
@router.get("/list", response_model=list[schemas.Modifier])
|
||||||
def show_list(user: UserToken = Depends(get_user)) -> List[schemas.Modifier]:
|
def show_list(user: UserToken = Depends(get_user)) -> list[schemas.Modifier]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [modifier_info(item) for item in db.execute(select(Modifier).order_by(Modifier.name)).scalars().all()]
|
return [modifier_info(item) for item in db.execute(select(Modifier).order_by(Modifier.name)).scalars().all()]
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import uuid
|
|||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.modifier_category as schemas
|
import barker.schemas.modifier_category as schemas
|
||||||
|
|
||||||
@@ -296,7 +295,7 @@ def modifier_category_blank(date_: date, db: Session) -> schemas.ModifierCategor
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_products(modifier_category: ModifierCategory, menu_categories: List[schemas.MenuCategoryLink], db: Session):
|
def add_products(modifier_category: ModifierCategory, menu_categories: list[schemas.MenuCategoryLink], db: Session):
|
||||||
for mc in menu_categories:
|
for mc in menu_categories:
|
||||||
for p in mc.products:
|
for p in mc.products:
|
||||||
old = next([x for x in modifier_category.products if x.id == p.id_], None)
|
old = next([x for x in modifier_category.products if x.id == p.id_], None)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.printer as schemas
|
import barker.schemas.printer as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||||
@@ -85,7 +83,7 @@ def show_blank(
|
|||||||
return printer_blank()
|
return printer_blank()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.Printer])
|
@router.get("/list", response_model=list[schemas.Printer])
|
||||||
def show_list(user: UserToken = Depends(get_user)):
|
def show_list(user: UserToken = Depends(get_user)):
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [printer_info(item) for item in db.execute(select(Printer).order_by(Printer.name)).scalars().all()]
|
return [printer_info(item) for item in db.execute(select(Printer).order_by(Printer.name)).scalars().all()]
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
from typing import Dict, List, Optional
|
|
||||||
|
|
||||||
import barker.schemas.product as schemas
|
import barker.schemas.product as schemas
|
||||||
|
|
||||||
@@ -30,15 +29,15 @@ from . import effective_date
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.post("/list", response_model=List[schemas.Product])
|
@router.post("/list", response_model=list[schemas.Product])
|
||||||
def sort_order(
|
def sort_order(
|
||||||
data: List[schemas.Product],
|
data: list[schemas.Product],
|
||||||
date_: date = Depends(effective_date),
|
date_: date = Depends(effective_date),
|
||||||
user: UserToken = Security(get_user, scopes=["products"]),
|
user: UserToken = Security(get_user, scopes=["products"]),
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
indexes: Dict[uuid.UUID, int] = {}
|
indexes: dict[uuid.UUID, int] = {}
|
||||||
for item in data:
|
for item in data:
|
||||||
if item.menu_category.id_ in indexes:
|
if item.menu_category.id_ in indexes:
|
||||||
indexes[item.menu_category.id_] += 1
|
indexes[item.menu_category.id_] += 1
|
||||||
@@ -275,13 +274,13 @@ def show_blank(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.Product])
|
@router.get("/list", response_model=list[schemas.Product])
|
||||||
def show_list(date_: date = Depends(effective_date), user: UserToken = Depends(get_user)) -> List[schemas.Product]:
|
def show_list(date_: date = Depends(effective_date), user: UserToken = Depends(get_user)) -> list[schemas.Product]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return product_list(date_, db)
|
return product_list(date_, db)
|
||||||
|
|
||||||
|
|
||||||
def product_list(date_: date, db: Session) -> List[schemas.Product]:
|
def product_list(date_: date, db: Session) -> list[schemas.Product]:
|
||||||
return [
|
return [
|
||||||
product_info(item)
|
product_info(item)
|
||||||
for item in db.execute(
|
for item in db.execute(
|
||||||
@@ -318,8 +317,8 @@ def product_list(date_: date, db: Session) -> List[schemas.Product]:
|
|||||||
|
|
||||||
@router.get("/query")
|
@router.get("/query")
|
||||||
def show_term(
|
def show_term(
|
||||||
mc: Optional[uuid.UUID] = None,
|
mc: uuid.UUID | None = None,
|
||||||
sc: Optional[uuid.UUID] = None,
|
sc: uuid.UUID | None = None,
|
||||||
date_: date = Depends(effective_date),
|
date_: date = Depends(effective_date),
|
||||||
current_user: UserToken = Depends(get_user),
|
current_user: UserToken = Depends(get_user),
|
||||||
):
|
):
|
||||||
@@ -385,7 +384,7 @@ def show_term(
|
|||||||
return list_
|
return list_
|
||||||
|
|
||||||
|
|
||||||
def product_list_of_sale_category(date_: date, db: Session) -> List[schemas.Product]:
|
def product_list_of_sale_category(date_: date, db: Session) -> list[schemas.Product]:
|
||||||
return [
|
return [
|
||||||
product_info(item)
|
product_info(item)
|
||||||
for item in db.execute(
|
for item in db.execute(
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from barker.core.config import settings
|
from barker.core.config import settings
|
||||||
from fastapi import HTTPException, status
|
from fastapi import HTTPException, status
|
||||||
@@ -21,7 +20,7 @@ def report_finish_date(f: str = None) -> date:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def check_audit_permission(start_date: date, user_permissions: List[str]):
|
def check_audit_permission(start_date: date, user_permissions: list[str]):
|
||||||
today = (datetime.utcnow() + timedelta(minutes=settings.TIMEZONE_OFFSET_MINUTES)).date()
|
today = (datetime.utcnow() + timedelta(minutes=settings.TIMEZONE_OFFSET_MINUTES)).date()
|
||||||
if (today - start_date).days > 5 and "audit" not in user_permissions:
|
if (today - start_date).days > 5 and "audit" not in user_permissions:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
from operator import or_
|
from operator import or_
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Security
|
from fastapi import APIRouter, Depends, Security
|
||||||
from sqlalchemy.sql.expression import func, select
|
from sqlalchemy.sql.expression import func, select
|
||||||
@@ -24,10 +23,10 @@ router = APIRouter()
|
|||||||
def beer_consumption(
|
def beer_consumption(
|
||||||
start_date: date = Depends(report_start_date),
|
start_date: date = Depends(report_start_date),
|
||||||
finish_date: date = Depends(report_finish_date),
|
finish_date: date = Depends(report_finish_date),
|
||||||
r: Optional[bool] = True,
|
r: bool | None = True,
|
||||||
h: Optional[bool] = True,
|
h: bool | None = True,
|
||||||
st: Optional[bool] = True,
|
st: bool | None = True,
|
||||||
n: Optional[bool] = True,
|
n: bool | None = True,
|
||||||
user: UserToken = Security(get_user, scopes=["beer-sale-report"]),
|
user: UserToken = Security(get_user, scopes=["beer-sale-report"]),
|
||||||
):
|
):
|
||||||
check_audit_permission(start_date, user.permissions)
|
check_audit_permission(start_date, user.permissions)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from datetime import date, datetime, time, timedelta
|
from datetime import date, datetime, time, timedelta
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Security
|
from fastapi import APIRouter, Depends, Security
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
@@ -36,7 +35,7 @@ def bill_details(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def settlements(s: date, f: date, db: Session) -> List[BillSettlementItem]:
|
def settlements(s: date, f: date, db: Session) -> list[BillSettlementItem]:
|
||||||
start_date = datetime.combine(s, time()) + timedelta(
|
start_date = datetime.combine(s, time()) + timedelta(
|
||||||
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
||||||
)
|
)
|
||||||
@@ -77,7 +76,7 @@ def settlements(s: date, f: date, db: Session) -> List[BillSettlementItem]:
|
|||||||
return report
|
return report
|
||||||
|
|
||||||
|
|
||||||
def reprints(s: date, f: date, db: Session) -> List[BillSettlementItem]:
|
def reprints(s: date, f: date, db: Session) -> list[BillSettlementItem]:
|
||||||
start_date = datetime.combine(s, time()) + timedelta(
|
start_date = datetime.combine(s, time()) + timedelta(
|
||||||
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import date, datetime, time, timedelta
|
from datetime import date, datetime, time, timedelta
|
||||||
from typing import Dict, List
|
|
||||||
|
|
||||||
from fastapi import APIRouter, Cookie, Depends, Security
|
from fastapi import APIRouter, Cookie, Depends, Security
|
||||||
from sqlalchemy import distinct, select
|
from sqlalchemy import distinct, select
|
||||||
@@ -29,18 +28,18 @@ from . import check_audit_permission, report_finish_date, report_start_date
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/active", response_model=List[UserLink])
|
@router.get("/active", response_model=list[UserLink])
|
||||||
def active_cashiers(
|
def active_cashiers(
|
||||||
start_date: date = Depends(report_start_date),
|
start_date: date = Depends(report_start_date),
|
||||||
finish_date: date = Depends(report_finish_date),
|
finish_date: date = Depends(report_finish_date),
|
||||||
user: UserToken = Security(get_user, scopes=["cashier-report"]),
|
user: UserToken = Security(get_user, scopes=["cashier-report"]),
|
||||||
) -> List[UserLink]:
|
) -> list[UserLink]:
|
||||||
check_audit_permission(start_date, user.permissions)
|
check_audit_permission(start_date, user.permissions)
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return get_active_cashiers(start_date, finish_date, db)
|
return get_active_cashiers(start_date, finish_date, db)
|
||||||
|
|
||||||
|
|
||||||
def get_active_cashiers(start_date: date, finish_date: date, db: Session) -> List[UserLink]:
|
def get_active_cashiers(start_date: date, finish_date: date, db: Session) -> list[UserLink]:
|
||||||
start_datetime = datetime.combine(start_date, time()) + timedelta(
|
start_datetime = datetime.combine(start_date, time()) + timedelta(
|
||||||
minutes=settings.TIMEZONE_OFFSET_MINUTES - settings.NEW_DAY_OFFSET_MINUTES
|
minutes=settings.TIMEZONE_OFFSET_MINUTES - settings.NEW_DAY_OFFSET_MINUTES
|
||||||
)
|
)
|
||||||
@@ -108,7 +107,7 @@ def get_id(id_: uuid.UUID, start_date: date, finish_date: date, user: UserLink,
|
|||||||
.all()
|
.all()
|
||||||
)
|
)
|
||||||
|
|
||||||
info: Dict[SettleOptionSchema, List[InfoItem]] = {}
|
info: dict[SettleOptionSchema, list[InfoItem]] = {}
|
||||||
amounts = {}
|
amounts = {}
|
||||||
for item in vouchers:
|
for item in vouchers:
|
||||||
for so in (
|
for so in (
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import date, datetime, time, timedelta
|
from datetime import date, datetime, time, timedelta
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from fastapi import APIRouter, Cookie, Depends, Security
|
from fastapi import APIRouter, Cookie, Depends, Security
|
||||||
from sqlalchemy import func, or_, select
|
from sqlalchemy import func, or_, select
|
||||||
@@ -40,7 +39,7 @@ def discount_report(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_discount_report(s: date, f: date, db: Session) -> List[DiscountReportItem]:
|
def get_discount_report(s: date, f: date, db: Session) -> list[DiscountReportItem]:
|
||||||
start_date = datetime.combine(s, time()) + timedelta(
|
start_date = datetime.combine(s, time()) + timedelta(
|
||||||
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Security
|
from fastapi import APIRouter, Depends, Security
|
||||||
from sqlalchemy import and_, or_, select
|
from sqlalchemy import and_, or_, select
|
||||||
@@ -30,8 +29,8 @@ def product_updates_report_view(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def product_updates_report(s: date, f: date, db: Session) -> List[str]:
|
def product_updates_report(s: date, f: date, db: Session) -> list[str]:
|
||||||
list_: List[ProductVersion] = (
|
list_: list[ProductVersion] = (
|
||||||
db.execute(
|
db.execute(
|
||||||
select(ProductVersion)
|
select(ProductVersion)
|
||||||
.join(ProductVersion.menu_category)
|
.join(ProductVersion.menu_category)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import date, datetime, time, timedelta
|
from datetime import date, datetime, time, timedelta
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from fastapi import APIRouter, Cookie, Depends, Security
|
from fastapi import APIRouter, Cookie, Depends, Security
|
||||||
from sqlalchemy import func, or_, select
|
from sqlalchemy import func, or_, select
|
||||||
@@ -51,7 +50,7 @@ def get_sale_report(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_sale(s: date, f: date, db: Session) -> List[SaleReportItem]:
|
def get_sale(s: date, f: date, db: Session) -> list[SaleReportItem]:
|
||||||
start_date = datetime.combine(s, time()) + timedelta(
|
start_date = datetime.combine(s, time()) + timedelta(
|
||||||
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
||||||
)
|
)
|
||||||
@@ -91,7 +90,7 @@ def get_sale(s: date, f: date, db: Session) -> List[SaleReportItem]:
|
|||||||
return info + [SaleReportItem(name="Total Settled", amount=total)]
|
return info + [SaleReportItem(name="Total Settled", amount=total)]
|
||||||
|
|
||||||
|
|
||||||
def get_settlements(s: date, f: date, db: Session) -> List[SaleReportItem]:
|
def get_settlements(s: date, f: date, db: Session) -> list[SaleReportItem]:
|
||||||
start_date = datetime.combine(s, time()) + timedelta(
|
start_date = datetime.combine(s, time()) + timedelta(
|
||||||
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import re
|
|||||||
|
|
||||||
from datetime import date, datetime, time, timedelta
|
from datetime import date, datetime, time, timedelta
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Security
|
from fastapi import APIRouter, Depends, Security
|
||||||
from sqlalchemy import func, select
|
from sqlalchemy import func, select
|
||||||
@@ -39,7 +38,7 @@ def get_tax_report(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_tax(s: date, f: date, db: Session) -> List[TaxReportItem]:
|
def get_tax(s: date, f: date, db: Session) -> list[TaxReportItem]:
|
||||||
start_date = datetime.combine(s, time()) + timedelta(
|
start_date = datetime.combine(s, time()) + timedelta(
|
||||||
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
||||||
)
|
)
|
||||||
@@ -68,7 +67,7 @@ def get_tax(s: date, f: date, db: Session) -> List[TaxReportItem]:
|
|||||||
return sum([get_tax_item(*i) for i in amounts], [])
|
return sum([get_tax_item(*i) for i in amounts], [])
|
||||||
|
|
||||||
|
|
||||||
def get_tax_item(name: str, rate: Decimal, net: Decimal, amount: Decimal) -> List[TaxReportItem]:
|
def get_tax_item(name: str, rate: Decimal, net: Decimal, amount: Decimal) -> list[TaxReportItem]:
|
||||||
items = name.split(";")
|
items = name.split(";")
|
||||||
if len(items) == 1:
|
if len(items) == 1:
|
||||||
return [TaxReportItem(name=name, taxRate=rate, saleAmount=net, amount=amount)]
|
return [TaxReportItem(name=name, taxRate=rate, saleAmount=net, amount=amount)]
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.role as schemas
|
import barker.schemas.role as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Security, status
|
from fastapi import APIRouter, HTTPException, Security, status
|
||||||
@@ -91,10 +89,10 @@ def show_blank(
|
|||||||
return role_blank(db)
|
return role_blank(db)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.RoleList])
|
@router.get("/list", response_model=list[schemas.RoleList])
|
||||||
def show_list(
|
def show_list(
|
||||||
user: UserToken = Security(get_user, scopes=["users"]),
|
user: UserToken = Security(get_user, scopes=["users"]),
|
||||||
) -> List[schemas.RoleList]:
|
) -> list[schemas.RoleList]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [
|
return [
|
||||||
schemas.RoleList(
|
schemas.RoleList(
|
||||||
@@ -141,7 +139,7 @@ def role_blank(db: Session) -> schemas.RoleBlank:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_permissions(role: Role, permissions: List[schemas.PermissionItem], db: Session):
|
def add_permissions(role: Role, permissions: list[schemas.PermissionItem], db: Session):
|
||||||
for permission in permissions:
|
for permission in permissions:
|
||||||
gp = next([p for p in role.permissions if p.id == permission.id_], None)
|
gp = next([p for p in role.permissions if p.id == permission.id_], None)
|
||||||
if permission.enabled and gp is None:
|
if permission.enabled and gp is None:
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.sale_category as schemas
|
import barker.schemas.sale_category as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||||
@@ -82,8 +80,8 @@ def show_blank(
|
|||||||
return sale_category_blank()
|
return sale_category_blank()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.SaleCategory])
|
@router.get("/list", response_model=list[schemas.SaleCategory])
|
||||||
def show_list(user: UserToken = Depends(get_user)) -> List[schemas.SaleCategory]:
|
def show_list(user: UserToken = Depends(get_user)) -> list[schemas.SaleCategory]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [
|
return [
|
||||||
sale_category_info(item)
|
sale_category_info(item)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.section as schemas
|
import barker.schemas.section as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||||
@@ -95,7 +93,7 @@ def show_blank(
|
|||||||
return section_blank()
|
return section_blank()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.Section])
|
@router.get("/list", response_model=list[schemas.Section])
|
||||||
def show_list(user: UserToken = Depends(get_user)):
|
def show_list(user: UserToken = Depends(get_user)):
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [section_info(item) for item in db.execute(select(Section).order_by(Section.name)).scalars().all()]
|
return [section_info(item) for item in db.execute(select(Section).order_by(Section.name)).scalars().all()]
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
import barker.schemas.section_printer as schemas
|
import barker.schemas.section_printer as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Security, status
|
from fastapi import APIRouter, HTTPException, Security, status
|
||||||
@@ -20,12 +18,12 @@ from ..schemas.user_token import UserToken
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.post("/{id_}", response_model=List[schemas.SectionPrinter])
|
@router.post("/{id_}", response_model=list[schemas.SectionPrinter])
|
||||||
def save(
|
def save(
|
||||||
id_: uuid.UUID,
|
id_: uuid.UUID,
|
||||||
data: List[schemas.SectionPrinter],
|
data: list[schemas.SectionPrinter],
|
||||||
user: UserToken = Security(get_user, scopes=["section-printers"]),
|
user: UserToken = Security(get_user, scopes=["section-printers"]),
|
||||||
) -> List[schemas.SectionPrinter]:
|
) -> list[schemas.SectionPrinter]:
|
||||||
try:
|
try:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
current = []
|
current = []
|
||||||
@@ -77,11 +75,11 @@ def save(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/{id_}", response_model=List[schemas.SectionPrinter])
|
@router.delete("/{id_}", response_model=list[schemas.SectionPrinter])
|
||||||
def delete_route(
|
def delete_route(
|
||||||
id_: uuid.UUID,
|
id_: uuid.UUID,
|
||||||
user: UserToken = Security(get_user, scopes=["section-printers"]),
|
user: UserToken = Security(get_user, scopes=["section-printers"]),
|
||||||
) -> List[schemas.SectionPrinter]:
|
) -> list[schemas.SectionPrinter]:
|
||||||
try:
|
try:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
db.execute(delete(SectionPrinter).where(SectionPrinter.section_id == id_))
|
db.execute(delete(SectionPrinter).where(SectionPrinter.section_id == id_))
|
||||||
@@ -94,24 +92,24 @@ def delete_route(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get("", response_model=List[schemas.SectionPrinter])
|
@router.get("", response_model=list[schemas.SectionPrinter])
|
||||||
def show_blank(
|
def show_blank(
|
||||||
user: UserToken = Security(get_user, scopes=["section-printers"]),
|
user: UserToken = Security(get_user, scopes=["section-printers"]),
|
||||||
) -> List[schemas.SectionPrinter]:
|
) -> list[schemas.SectionPrinter]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return report(None, db)
|
return report(None, db)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/{id_}", response_model=List[schemas.SectionPrinter])
|
@router.get("/{id_}", response_model=list[schemas.SectionPrinter])
|
||||||
def show_id(
|
def show_id(
|
||||||
id_: uuid.UUID,
|
id_: uuid.UUID,
|
||||||
user: UserToken = Security(get_user, scopes=["section-printers"]),
|
user: UserToken = Security(get_user, scopes=["section-printers"]),
|
||||||
) -> List[schemas.SectionPrinter]:
|
) -> list[schemas.SectionPrinter]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return report(id_, db)
|
return report(id_, db)
|
||||||
|
|
||||||
|
|
||||||
def report(section_id: Optional[uuid.UUID], db: Session) -> List[schemas.SectionPrinter]:
|
def report(section_id: uuid.UUID | None, db: Session) -> list[schemas.SectionPrinter]:
|
||||||
sale_categories = db.execute(select(SaleCategory.id, SaleCategory.name).order_by(SaleCategory.name)).all()
|
sale_categories = db.execute(select(SaleCategory.id, SaleCategory.name).order_by(SaleCategory.name)).all()
|
||||||
list_ = []
|
list_ = []
|
||||||
for sc_id, sc_name in [(None, None)] + sale_categories:
|
for sc_id, sc_name in [(None, None)] + sale_categories:
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.settle_option as schemas
|
import barker.schemas.settle_option as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||||
@@ -106,7 +104,7 @@ def show_blank(
|
|||||||
return settle_option_blank()
|
return settle_option_blank()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.SettleOption])
|
@router.get("/list", response_model=list[schemas.SettleOption])
|
||||||
def show_list(user: UserToken = Depends(get_user)):
|
def show_list(user: UserToken = Depends(get_user)):
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [
|
return [
|
||||||
@@ -115,7 +113,7 @@ def show_list(user: UserToken = Depends(get_user)):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@router.get("/for-type/{vt}", response_model=List[schemas.SettleOption])
|
@router.get("/for-type/{vt}", response_model=list[schemas.SettleOption])
|
||||||
def show_list_for_type(vt: VoucherType, user: UserToken = Depends(get_user)):
|
def show_list_for_type(vt: VoucherType, user: UserToken = Depends(get_user)):
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import List, Union
|
|
||||||
|
|
||||||
import barker.schemas.table as schemas
|
import barker.schemas.table as schemas
|
||||||
|
|
||||||
@@ -20,11 +19,11 @@ from ..schemas.user_token import UserToken
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.post("/list", response_model=List[schemas.Table])
|
@router.post("/list", response_model=list[schemas.Table])
|
||||||
def sort_order(
|
def sort_order(
|
||||||
data: List[schemas.Table],
|
data: list[schemas.Table],
|
||||||
user: UserToken = Security(get_user, scopes=["sections"]),
|
user: UserToken = Security(get_user, scopes=["sections"]),
|
||||||
) -> List[schemas.Table]:
|
) -> list[schemas.Table]:
|
||||||
try:
|
try:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
for index, item in enumerate(data):
|
for index, item in enumerate(data):
|
||||||
@@ -118,7 +117,7 @@ def show_blank(
|
|||||||
return food_table_blank()
|
return food_table_blank()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.Table])
|
@router.get("/list", response_model=list[schemas.Table])
|
||||||
def show_list(user: UserToken = Depends(get_user)):
|
def show_list(user: UserToken = Depends(get_user)):
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [
|
return [
|
||||||
@@ -163,11 +162,11 @@ def show_running(user: UserToken = Depends(get_user)):
|
|||||||
return food_tables
|
return food_tables
|
||||||
|
|
||||||
|
|
||||||
@router.get("/from-voucher/{id_}", response_model=Union[schemas.Table, schemas.TableBlank])
|
@router.get("/from-voucher/{id_}", response_model=schemas.Table | schemas.TableBlank)
|
||||||
def show_voucher(
|
def show_voucher(
|
||||||
id_: uuid.UUID,
|
id_: uuid.UUID,
|
||||||
user: UserToken = Security(get_user),
|
user: UserToken = Security(get_user),
|
||||||
) -> Union[schemas.Table, schemas.TableBlank]:
|
) -> schemas.Table | schemas.TableBlank:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
overview: Overview = db.execute(select(Overview).where(Overview.voucher_id == id_)).scalars().one_or_none()
|
overview: Overview = db.execute(select(Overview).where(Overview.voucher_id == id_)).scalars().one_or_none()
|
||||||
if overview is not None:
|
if overview is not None:
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import re
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.tax as schemas
|
import barker.schemas.tax as schemas
|
||||||
|
|
||||||
@@ -109,8 +108,8 @@ def show_blank(
|
|||||||
return tax_blank()
|
return tax_blank()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.Tax])
|
@router.get("/list", response_model=list[schemas.Tax])
|
||||||
def show_list(user: UserToken = Depends(get_user)) -> List[schemas.Tax]:
|
def show_list(user: UserToken = Depends(get_user)) -> list[schemas.Tax]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [tax_info(item) for item in db.execute(select(Tax).order_by(Tax.name)).scalars().all()]
|
return [tax_info(item) for item in db.execute(select(Tax).order_by(Tax.name)).scalars().all()]
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
from typing import Dict, List
|
|
||||||
|
|
||||||
import barker.schemas.product as schemas
|
import barker.schemas.product as schemas
|
||||||
|
|
||||||
@@ -176,14 +175,14 @@ def delete_route(
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[List[schemas.Product]])
|
@router.get("/list", response_model=list[list[schemas.Product]])
|
||||||
def show_list(user: UserToken = Security(get_user, scopes=["temporal-products"])) -> List[List[schemas.Product]]:
|
def show_list(user: UserToken = Security(get_user, scopes=["temporal-products"])) -> list[list[schemas.Product]]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return product_list(db)
|
return product_list(db)
|
||||||
|
|
||||||
|
|
||||||
def product_list(db: Session) -> List[List[schemas.Product]]:
|
def product_list(db: Session) -> list[list[schemas.Product]]:
|
||||||
dict_: Dict[uuid.UUID, List[schemas.Product]] = {}
|
dict_: dict[uuid.UUID, list[schemas.Product]] = {}
|
||||||
list_ = (
|
list_ = (
|
||||||
db.execute(
|
db.execute(
|
||||||
select(ProductVersion)
|
select(ProductVersion)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import uuid
|
|||||||
|
|
||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||||
from sqlalchemy import and_, or_, select
|
from sqlalchemy import and_, or_, select
|
||||||
@@ -22,7 +21,7 @@ router = APIRouter()
|
|||||||
|
|
||||||
@router.get("", response_model=UpdateProductPrices)
|
@router.get("", response_model=UpdateProductPrices)
|
||||||
def get_update_product_prices(
|
def get_update_product_prices(
|
||||||
date_: Optional[date] = Depends(optional_query_date),
|
date_: date | None = Depends(optional_query_date),
|
||||||
user: UserToken = Security(get_user, scopes=["products"]),
|
user: UserToken = Security(get_user, scopes=["products"]),
|
||||||
) -> UpdateProductPrices:
|
) -> UpdateProductPrices:
|
||||||
if date_ is None:
|
if date_ is None:
|
||||||
@@ -40,7 +39,7 @@ def get_update_product_prices(
|
|||||||
@router.get("/{id_}", response_model=UpdateProductPrices)
|
@router.get("/{id_}", response_model=UpdateProductPrices)
|
||||||
def get_update_product_prices_id(
|
def get_update_product_prices_id(
|
||||||
id_: uuid.UUID,
|
id_: uuid.UUID,
|
||||||
date_: Optional[date] = Depends(optional_query_date),
|
date_: date | None = Depends(optional_query_date),
|
||||||
user: UserToken = Security(get_user, scopes=["products"]),
|
user: UserToken = Security(get_user, scopes=["products"]),
|
||||||
) -> UpdateProductPrices:
|
) -> UpdateProductPrices:
|
||||||
if date_ is None:
|
if date_ is None:
|
||||||
@@ -58,8 +57,8 @@ def get_update_product_prices_id(
|
|||||||
|
|
||||||
|
|
||||||
def update_product_prices_list(
|
def update_product_prices_list(
|
||||||
menu_category_id: Optional[uuid.UUID], date_: date, db: Session
|
menu_category_id: uuid.UUID | None, date_: date, db: Session
|
||||||
) -> List[UpdateProductPricesItem]:
|
) -> list[UpdateProductPricesItem]:
|
||||||
list_ = (
|
list_ = (
|
||||||
select(ProductVersion)
|
select(ProductVersion)
|
||||||
.join(ProductVersion.menu_category)
|
.join(ProductVersion.menu_category)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.user as schemas
|
import barker.schemas.user as schemas
|
||||||
|
|
||||||
from barker.core.security import get_current_active_user as get_user
|
from barker.core.security import get_current_active_user as get_user
|
||||||
@@ -93,7 +91,7 @@ def update_route(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_roles(user: User, roles: List[schemas.RoleItem], db: Session):
|
def add_roles(user: User, roles: list[schemas.RoleItem], db: Session):
|
||||||
for role in roles:
|
for role in roles:
|
||||||
ug = next([g for g in user.roles if g.id == role.id_], None)
|
ug = next([g for g in user.roles if g.id == role.id_], None)
|
||||||
if role.enabled and ug is None:
|
if role.enabled and ug is None:
|
||||||
@@ -132,10 +130,10 @@ def show_blank(
|
|||||||
return blank_user_info(db)
|
return blank_user_info(db)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list", response_model=List[schemas.UserList])
|
@router.get("/list", response_model=list[schemas.UserList])
|
||||||
def show_list(
|
def show_list(
|
||||||
user: UserToken = Security(get_user, scopes=["users"]),
|
user: UserToken = Security(get_user, scopes=["users"]),
|
||||||
) -> List[schemas.UserList]:
|
) -> list[schemas.UserList]:
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
return [
|
return [
|
||||||
schemas.UserList(
|
schemas.UserList(
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
import barker.schemas.voucher as schemas
|
import barker.schemas.voucher as schemas
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ def get_tax(tax, voucher_type):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_bill_id(voucher_type: VoucherType, db: Session) -> Optional[int]:
|
def get_bill_id(voucher_type: VoucherType, db: Session) -> int | None:
|
||||||
if voucher_type == VoucherType.KOT:
|
if voucher_type == VoucherType.KOT:
|
||||||
return None
|
return None
|
||||||
bill_id = db.execute(
|
bill_id = db.execute(
|
||||||
@@ -41,7 +40,7 @@ def get_bill_id(voucher_type: VoucherType, db: Session) -> Optional[int]:
|
|||||||
return bill_id
|
return bill_id
|
||||||
|
|
||||||
|
|
||||||
def do_update_table(item: Voucher, guest_book: Optional[GuestBook], db: Session):
|
def do_update_table(item: Voucher, guest_book: GuestBook | None, db: Session):
|
||||||
status_ = "running" if item.voucher_type == VoucherType.KOT else "printed"
|
status_ = "running" if item.voucher_type == VoucherType.KOT else "printed"
|
||||||
if item.status is None:
|
if item.status is None:
|
||||||
item.status = Overview(
|
item.status = Overview(
|
||||||
@@ -55,7 +54,7 @@ def do_update_table(item: Voucher, guest_book: Optional[GuestBook], db: Session)
|
|||||||
item.status.status = status_
|
item.status.status = status_
|
||||||
|
|
||||||
|
|
||||||
def check_permissions(item: Optional[Voucher], voucher_type: VoucherType, permissions: List[str]):
|
def check_permissions(item: Voucher | None, voucher_type: VoucherType, permissions: list[str]):
|
||||||
if voucher_type == VoucherType.KOT and "print-kot" not in permissions:
|
if voucher_type == VoucherType.KOT and "print-kot" not in permissions:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN,
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
@@ -88,15 +87,15 @@ def check_permissions(item: Optional[Voucher], voucher_type: VoucherType, permis
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_guest_book(id_: Optional[uuid.UUID], db: Session) -> Optional[GuestBook]:
|
def get_guest_book(id_: uuid.UUID | None, db: Session) -> GuestBook | None:
|
||||||
if id_ is None:
|
if id_ is None:
|
||||||
return id_
|
return id_
|
||||||
return db.execute(select(GuestBook).where(GuestBook.id == id_)).scalar_one()
|
return db.execute(select(GuestBook).where(GuestBook.id == id_)).scalar_one()
|
||||||
|
|
||||||
|
|
||||||
def do_update_settlements(voucher: Voucher, others: List[SettleSchema], db: Session) -> bool:
|
def do_update_settlements(voucher: Voucher, others: list[SettleSchema], db: Session) -> bool:
|
||||||
fully_settled = True
|
fully_settled = True
|
||||||
settlements: List[SettleSchema] = []
|
settlements: list[SettleSchema] = []
|
||||||
settlements += others
|
settlements += others
|
||||||
total_amount = voucher.amount
|
total_amount = voucher.amount
|
||||||
settlements.append(SettleSchema(id=SettleOption.AMOUNT(), amount=-total_amount))
|
settlements.append(SettleSchema(id=SettleOption.AMOUNT(), amount=-total_amount))
|
||||||
@@ -128,14 +127,14 @@ def do_update_settlements(voucher: Voucher, others: List[SettleSchema], db: Sess
|
|||||||
return fully_settled
|
return fully_settled
|
||||||
|
|
||||||
|
|
||||||
def happy_hour_items_balanced(inventories: List[schemas.Inventory]) -> bool:
|
def happy_hour_items_balanced(inventories: list[schemas.Inventory]) -> bool:
|
||||||
happy = set((i.product.id_, i.quantity) for i in inventories if i.is_happy_hour)
|
happy = set((i.product.id_, i.quantity) for i in inventories if i.is_happy_hour)
|
||||||
products = set(i.product.id_ for i in inventories if i.is_happy_hour)
|
products = set(i.product.id_ for i in inventories if i.is_happy_hour)
|
||||||
other = set((i.product.id_, i.quantity) for i in inventories if not i.is_happy_hour and i.product.id_ in products)
|
other = set((i.product.id_, i.quantity) for i in inventories if not i.is_happy_hour and i.product.id_ in products)
|
||||||
return happy == other
|
return happy == other
|
||||||
|
|
||||||
|
|
||||||
def happy_hour_has_discount(inventories: List[schemas.Inventory]) -> bool:
|
def happy_hour_has_discount(inventories: list[schemas.Inventory]) -> bool:
|
||||||
happy = set(i.product.id_ for i in inventories if i.is_happy_hour)
|
happy = set(i.product.id_ for i in inventories if i.is_happy_hour)
|
||||||
offenders = [i for i in inventories if i.product.id_ in happy and i.discount != 0]
|
offenders = [i for i in inventories if i.product.id_ in happy and i.discount != 0]
|
||||||
return len(offenders) > 0
|
return len(offenders) > 0
|
||||||
@@ -143,7 +142,7 @@ def happy_hour_has_discount(inventories: List[schemas.Inventory]) -> bool:
|
|||||||
|
|
||||||
# This is for the whole bill. eg. Kot 1 => Reg 2 + HH 2; Kot 2 => Reg 4; Kot 3 => Reg - 4
|
# This is for the whole bill. eg. Kot 1 => Reg 2 + HH 2; Kot 2 => Reg 4; Kot 3 => Reg - 4
|
||||||
# This is pass okay in happy hours items balanced, but overall this is wrong. Hence this check
|
# This is pass okay in happy hours items balanced, but overall this is wrong. Hence this check
|
||||||
def happy_hour_items_more_than_regular(kots: List[schemas.Kot]) -> bool:
|
def happy_hour_items_more_than_regular(kots: list[schemas.Kot]) -> bool:
|
||||||
inventories = {}
|
inventories = {}
|
||||||
for kot in kots:
|
for kot in kots:
|
||||||
for inventory in kot.inventories:
|
for inventory in kot.inventories:
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import barker.schemas.voucher as schemas
|
import barker.schemas.voucher as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Security, status
|
from fastapi import APIRouter, HTTPException, Security, status
|
||||||
@@ -32,7 +30,7 @@ def change(
|
|||||||
id_: uuid.UUID,
|
id_: uuid.UUID,
|
||||||
data: schemas.VoucherIn,
|
data: schemas.VoucherIn,
|
||||||
u: bool, # Update table?
|
u: bool, # Update table?
|
||||||
g: Optional[uuid.UUID] = None, # Guest book id
|
g: uuid.UUID | None = None, # Guest book id
|
||||||
user: UserToken = Security(get_user, scopes=["edit-printed-bill"]),
|
user: UserToken = Security(get_user, scopes=["edit-printed-bill"]),
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
@@ -75,7 +73,7 @@ def reprint_bill(voucher_id: uuid.UUID, user_id: uuid.UUID, db: Session):
|
|||||||
def void_and_issue_new_bill(
|
def void_and_issue_new_bill(
|
||||||
data: schemas.VoucherIn,
|
data: schemas.VoucherIn,
|
||||||
u: bool,
|
u: bool,
|
||||||
g: Optional[uuid.UUID],
|
g: uuid.UUID | None,
|
||||||
old: Voucher,
|
old: Voucher,
|
||||||
db: Session,
|
db: Session,
|
||||||
user: UserToken,
|
user: UserToken,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import barker.schemas.merge_move as schemas
|
import barker.schemas.merge_move as schemas
|
||||||
|
|
||||||
@@ -137,7 +136,7 @@ def merge_table(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def update_settlements(vouchers: List[uuid.UUID], db: Session):
|
def update_settlements(vouchers: list[uuid.UUID], db: Session):
|
||||||
for v in vouchers:
|
for v in vouchers:
|
||||||
voucher: Voucher = db.execute(select(Voucher).where(Voucher.id == v)).scalar_one()
|
voucher: Voucher = db.execute(select(Voucher).where(Voucher.id == v)).scalar_one()
|
||||||
do_update_settlements(voucher, [], db)
|
do_update_settlements(voucher, [], db)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import barker.schemas.voucher as schemas
|
import barker.schemas.voucher as schemas
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ def save(
|
|||||||
data: schemas.VoucherIn,
|
data: schemas.VoucherIn,
|
||||||
u: bool, # Update table?
|
u: bool, # Update table?
|
||||||
p: int, # Print type
|
p: int, # Print type
|
||||||
g: Optional[uuid.UUID] = None, # Guest book id
|
g: uuid.UUID | None = None, # Guest book id
|
||||||
user: UserToken = Security(get_user),
|
user: UserToken = Security(get_user),
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
@@ -70,7 +69,7 @@ def save(
|
|||||||
def do_save(
|
def do_save(
|
||||||
data: schemas.VoucherIn,
|
data: schemas.VoucherIn,
|
||||||
voucher_type: VoucherType,
|
voucher_type: VoucherType,
|
||||||
guest_book: Optional[GuestBook],
|
guest_book: GuestBook | None,
|
||||||
db: Session,
|
db: Session,
|
||||||
user: UserToken,
|
user: UserToken,
|
||||||
):
|
):
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import re
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Security, status
|
from fastapi import APIRouter, HTTPException, Security, status
|
||||||
from sqlalchemy import and_, or_, select
|
from sqlalchemy import and_, or_, select
|
||||||
@@ -81,8 +80,8 @@ def from_bill(
|
|||||||
@router.get("/from-table/{id_}")
|
@router.get("/from-table/{id_}")
|
||||||
def from_table(
|
def from_table(
|
||||||
id_: str, # table id
|
id_: str, # table id
|
||||||
v: Optional[uuid.UUID] = None, # voucher id
|
v: uuid.UUID | None = None, # voucher id
|
||||||
g: Optional[uuid.UUID] = None, # guest id
|
g: uuid.UUID | None = None, # guest id
|
||||||
user: UserToken = Security(get_user),
|
user: UserToken = Security(get_user),
|
||||||
):
|
):
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
@@ -204,7 +203,7 @@ def voucher_info(item: Voucher, db: Session):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def voucher_blank(table: FoodTable, guest: Optional[GuestBook]):
|
def voucher_blank(table: FoodTable, guest: GuestBook | None):
|
||||||
return {
|
return {
|
||||||
"pax": table.seats if guest is None else guest.pax,
|
"pax": table.seats if guest is None else guest.pax,
|
||||||
"table": {"id": table.id, "name": table.name},
|
"table": {"id": table.id, "name": table.name},
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import uuid
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Dict, List, Optional, Tuple
|
|
||||||
|
|
||||||
import barker.schemas.split as schemas
|
import barker.schemas.split as schemas
|
||||||
|
|
||||||
@@ -91,12 +90,12 @@ def split(
|
|||||||
|
|
||||||
|
|
||||||
def save(
|
def save(
|
||||||
inventories: List[Inventory],
|
inventories: list[Inventory],
|
||||||
now: datetime,
|
now: datetime,
|
||||||
voucher_type: VoucherType,
|
voucher_type: VoucherType,
|
||||||
pax: int,
|
pax: int,
|
||||||
table_id: uuid.UUID,
|
table_id: uuid.UUID,
|
||||||
customer_id: Optional[uuid.UUID],
|
customer_id: uuid.UUID | None,
|
||||||
user_id: uuid.UUID,
|
user_id: uuid.UUID,
|
||||||
db: Session,
|
db: Session,
|
||||||
):
|
):
|
||||||
@@ -156,22 +155,22 @@ def save(
|
|||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
def split_into_kots(inventories: List[Inventory]) -> list:
|
def split_into_kots(inventories: list[Inventory]) -> list:
|
||||||
kots = defaultdict(list)
|
kots = defaultdict(list)
|
||||||
for item in inventories:
|
for item in inventories:
|
||||||
kots[item.kot_id].append(item)
|
kots[item.kot_id].append(item)
|
||||||
return [k for k in kots.values() if len(k) > 0]
|
return [k for k in kots.values() if len(k) > 0]
|
||||||
|
|
||||||
|
|
||||||
def happy_hour_items_balanced(inventories: List[Inventory]) -> bool:
|
def happy_hour_items_balanced(inventories: list[Inventory]) -> bool:
|
||||||
happy = set((i.product_id, i.quantity) for i in inventories if i.is_happy_hour)
|
happy = set((i.product_id, i.quantity) for i in inventories if i.is_happy_hour)
|
||||||
products = set(i.product_id for i in inventories if i.is_happy_hour)
|
products = set(i.product_id for i in inventories if i.is_happy_hour)
|
||||||
other = set((i.product_id, i.quantity) for i in inventories if not i.is_happy_hour and i.product_id in products)
|
other = set((i.product_id, i.quantity) for i in inventories if not i.is_happy_hour and i.product_id in products)
|
||||||
return happy == other
|
return happy == other
|
||||||
|
|
||||||
|
|
||||||
def are_product_quantities_positive(inventories: List[Inventory]) -> bool:
|
def are_product_quantities_positive(inventories: list[Inventory]) -> bool:
|
||||||
quantities: Dict[Tuple[uuid.UUID, bool], Decimal] = defaultdict(Decimal)
|
quantities: dict[tuple[uuid.UUID, bool], Decimal] = defaultdict(Decimal)
|
||||||
for i in inventories:
|
for i in inventories:
|
||||||
key = (i.product_id, i.is_happy_hour)
|
key = (i.product_id, i.is_happy_hour)
|
||||||
quantities[key] += i.quantity
|
quantities[key] += i.quantity
|
||||||
@@ -181,7 +180,7 @@ def are_product_quantities_positive(inventories: List[Inventory]) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def happy_hour_items_more_than_regular(invs: List[Inventory]) -> bool:
|
def happy_hour_items_more_than_regular(invs: list[Inventory]) -> bool:
|
||||||
inventories = {}
|
inventories = {}
|
||||||
for inventory in invs:
|
for inventory in invs:
|
||||||
if inventory.product_id not in inventories:
|
if inventory.product_id not in inventories:
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import barker.schemas.voucher as schemas
|
import barker.schemas.voucher as schemas
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ def update_route(
|
|||||||
data: schemas.VoucherIn,
|
data: schemas.VoucherIn,
|
||||||
u: bool, # Update table?
|
u: bool, # Update table?
|
||||||
p: int, # Print type
|
p: int, # Print type
|
||||||
g: Optional[uuid.UUID] = None, # Guest book id
|
g: uuid.UUID | None = None, # Guest book id
|
||||||
user: UserToken = Security(get_user),
|
user: UserToken = Security(get_user),
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from pydantic import BaseModel, validator
|
from pydantic import BaseModel, validator
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ class BillSettlementItem(BaseModel):
|
|||||||
class BillSettlement(BaseModel):
|
class BillSettlement(BaseModel):
|
||||||
start_date: date
|
start_date: date
|
||||||
finish_date: date
|
finish_date: date
|
||||||
amounts: List[BillSettlementItem]
|
amounts: list[BillSettlementItem]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Dict, List
|
|
||||||
|
|
||||||
from pydantic import BaseModel, validator
|
from pydantic import BaseModel, validator
|
||||||
|
|
||||||
@@ -54,8 +53,8 @@ class CashierReport(BaseModel):
|
|||||||
cashier: UserLink
|
cashier: UserLink
|
||||||
cashiers: str
|
cashiers: str
|
||||||
user: UserLink
|
user: UserLink
|
||||||
amounts: List[NameAmount]
|
amounts: list[NameAmount]
|
||||||
info: Dict[str, List[InfoItem]]
|
info: dict[str, list[InfoItem]]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
@@ -12,8 +11,8 @@ class DiscountItem(BaseModel):
|
|||||||
id_: uuid.UUID
|
id_: uuid.UUID
|
||||||
name: str
|
name: str
|
||||||
discount: Decimal = Field(ge=0, multiple_of=0.0001, default=0, le=1)
|
discount: Decimal = Field(ge=0, multiple_of=0.0001, default=0, le=1)
|
||||||
discount_limit: Optional[Decimal]
|
discount_limit: Decimal | None
|
||||||
customer_discount: Optional[Decimal]
|
customer_discount: Decimal | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
alias_generator = to_camel
|
alias_generator = to_camel
|
||||||
@@ -23,10 +22,10 @@ class CustomerIn(BaseModel):
|
|||||||
name: str = Field(..., min_length=1)
|
name: str = Field(..., min_length=1)
|
||||||
# phone: str = Field(..., min_length=1)
|
# phone: str = Field(..., min_length=1)
|
||||||
phone: str
|
phone: str
|
||||||
address: Optional[str]
|
address: str | None
|
||||||
print_in_bill: bool
|
print_in_bill: bool
|
||||||
|
|
||||||
discounts: List[DiscountItem]
|
discounts: list[DiscountItem]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
@@ -44,7 +43,7 @@ class Customer(CustomerIn):
|
|||||||
|
|
||||||
class CustomerLink(BaseModel):
|
class CustomerLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
@@ -23,7 +22,7 @@ class Device(DeviceIn):
|
|||||||
id_: uuid.UUID
|
id_: uuid.UUID
|
||||||
creation_date: datetime
|
creation_date: datetime
|
||||||
last_user: str
|
last_user: str
|
||||||
last_date: Optional[datetime]
|
last_date: datetime | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
@@ -34,7 +33,7 @@ class Device(DeviceIn):
|
|||||||
|
|
||||||
class DeviceLink(BaseModel):
|
class DeviceLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from pydantic import BaseModel, validator
|
from pydantic import BaseModel, validator
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ class DiscountReportItem(BaseModel):
|
|||||||
class DiscountReport(BaseModel):
|
class DiscountReport(BaseModel):
|
||||||
start_date: date
|
start_date: date
|
||||||
finish_date: date
|
finish_date: date
|
||||||
amounts: List[DiscountReportItem]
|
amounts: list[DiscountReportItem]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, validator
|
from pydantic import BaseModel, Field, validator
|
||||||
|
|
||||||
@@ -11,7 +10,7 @@ from . import to_camel
|
|||||||
class GuestBookIn(BaseModel):
|
class GuestBookIn(BaseModel):
|
||||||
name: str
|
name: str
|
||||||
phone: str
|
phone: str
|
||||||
address: Optional[str]
|
address: str | None
|
||||||
pax: int = Field(ge=0)
|
pax: int = Field(ge=0)
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
@@ -44,10 +43,10 @@ class GuestBookListItem(BaseModel):
|
|||||||
phone: str
|
phone: str
|
||||||
pax: int
|
pax: int
|
||||||
date_: datetime
|
date_: datetime
|
||||||
status: Optional[str]
|
status: str | None
|
||||||
table_id: Optional[uuid.UUID]
|
table_id: uuid.UUID | None
|
||||||
voucher_id: Optional[uuid.UUID]
|
voucher_id: uuid.UUID | None
|
||||||
table_name: Optional[str]
|
table_name: str | None
|
||||||
|
|
||||||
@validator("date_", pre=True)
|
@validator("date_", pre=True)
|
||||||
def parse_date(cls, value):
|
def parse_date(cls, value):
|
||||||
@@ -64,7 +63,7 @@ class GuestBookListItem(BaseModel):
|
|||||||
|
|
||||||
class GuestBookList(BaseModel):
|
class GuestBookList(BaseModel):
|
||||||
date_: date
|
date_: date
|
||||||
list: List[GuestBookListItem]
|
list: list[GuestBookListItem]
|
||||||
|
|
||||||
@validator("date_", pre=True)
|
@validator("date_", pre=True)
|
||||||
def parse_date(cls, value):
|
def parse_date(cls, value):
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import uuid
|
|||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, validator
|
from pydantic import BaseModel, Field, validator
|
||||||
|
|
||||||
@@ -36,7 +35,7 @@ class EmployeeIn(AccountBase):
|
|||||||
salary: int = Field(ge=0)
|
salary: int = Field(ge=0)
|
||||||
points: Decimal = Field(ge=0, lt=1000, multiple_of=0.01)
|
points: Decimal = Field(ge=0, lt=1000, multiple_of=0.01)
|
||||||
joining_date: date
|
joining_date: date
|
||||||
leaving_date: Optional[date]
|
leaving_date: date | None
|
||||||
|
|
||||||
@validator("joining_date", pre=True)
|
@validator("joining_date", pre=True)
|
||||||
def parse_joining_date(cls, value):
|
def parse_joining_date(cls, value):
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from . import to_camel
|
from . import to_camel
|
||||||
@@ -37,8 +35,8 @@ class MenuCategoryBlank(MenuCategoryIn):
|
|||||||
|
|
||||||
class MenuCategoryLink(BaseModel):
|
class MenuCategoryLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
products: List[ProductLink]
|
products: list[ProductLink]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
@@ -28,7 +27,7 @@ class Modifier(ModifierIn):
|
|||||||
|
|
||||||
class ModifierLink(BaseModel):
|
class ModifierLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
@@ -36,7 +35,7 @@ class ModifierLink(BaseModel):
|
|||||||
|
|
||||||
class ModifierBlank(ModifierIn):
|
class ModifierBlank(ModifierIn):
|
||||||
name: str
|
name: str
|
||||||
modifier_category: Optional[ModifierCategoryLink]
|
modifier_category: ModifierCategoryLink | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from . import to_camel
|
from . import to_camel
|
||||||
@@ -11,9 +9,9 @@ from .menu_category import MenuCategoryLink
|
|||||||
class ModifierCategoryIn(BaseModel):
|
class ModifierCategoryIn(BaseModel):
|
||||||
name: str = Field(..., min_length=1)
|
name: str = Field(..., min_length=1)
|
||||||
minimum: int = Field(ge=0)
|
minimum: int = Field(ge=0)
|
||||||
maximum: Optional[int] = Field(ge=0)
|
maximum: int | None = Field(ge=0)
|
||||||
is_active: bool
|
is_active: bool
|
||||||
menu_categories: List[MenuCategoryLink]
|
menu_categories: list[MenuCategoryLink]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
@@ -40,7 +38,7 @@ class ModifierCategoryBlank(ModifierCategoryIn):
|
|||||||
|
|
||||||
class ModifierCategoryLink(BaseModel):
|
class ModifierCategoryLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
@@ -2,7 +2,6 @@ import uuid
|
|||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, validator
|
from pydantic import BaseModel, Field, validator
|
||||||
|
|
||||||
@@ -31,8 +30,8 @@ class ProductIn(BaseModel):
|
|||||||
class Product(ProductIn):
|
class Product(ProductIn):
|
||||||
id_: uuid.UUID
|
id_: uuid.UUID
|
||||||
version_id: uuid.UUID
|
version_id: uuid.UUID
|
||||||
valid_from: Optional[date]
|
valid_from: date | None
|
||||||
valid_till: Optional[date]
|
valid_till: date | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
@@ -58,8 +57,8 @@ class Product(ProductIn):
|
|||||||
|
|
||||||
class ProductBlank(ProductIn):
|
class ProductBlank(ProductIn):
|
||||||
name: str
|
name: str
|
||||||
menu_category: Optional[MenuCategoryLink]
|
menu_category: MenuCategoryLink | None
|
||||||
sale_category: Optional[SaleCategoryLink]
|
sale_category: SaleCategoryLink | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
class ProductLink(BaseModel):
|
class ProductLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
enabled: Optional[bool]
|
enabled: bool | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ class ReceivePaymentItem(BaseModel):
|
|||||||
|
|
||||||
class ReceivePayment(BaseModel):
|
class ReceivePayment(BaseModel):
|
||||||
reason: str
|
reason: str
|
||||||
amounts: List[ReceivePaymentItem]
|
amounts: list[ReceivePaymentItem]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
alias_generator = to_camel
|
alias_generator = to_camel
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from barker.schemas.permission import PermissionItem
|
from barker.schemas.permission import PermissionItem
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
class RoleIn(BaseModel):
|
class RoleIn(BaseModel):
|
||||||
name: str = Field(..., min_length=1)
|
name: str = Field(..., min_length=1)
|
||||||
permissions: List[PermissionItem]
|
permissions: list[PermissionItem]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
@@ -32,7 +30,7 @@ class RoleBlank(RoleIn):
|
|||||||
class RoleList(BaseModel):
|
class RoleList(BaseModel):
|
||||||
id_: uuid.UUID
|
id_: uuid.UUID
|
||||||
name: str
|
name: str
|
||||||
permissions: List[str]
|
permissions: list[str]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
@@ -29,7 +28,7 @@ class SaleCategory(SaleCategoryIn):
|
|||||||
|
|
||||||
class SaleCategoryBlank(SaleCategoryIn):
|
class SaleCategoryBlank(SaleCategoryIn):
|
||||||
name: str
|
name: str
|
||||||
tax: Optional[TaxLink]
|
tax: TaxLink | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
@@ -38,7 +37,7 @@ class SaleCategoryBlank(SaleCategoryIn):
|
|||||||
|
|
||||||
class SaleCategoryForDiscount(SaleCategory):
|
class SaleCategoryForDiscount(SaleCategory):
|
||||||
discount: Decimal
|
discount: Decimal
|
||||||
tax: Optional[TaxLink]
|
tax: TaxLink | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
@@ -47,7 +46,7 @@ class SaleCategoryForDiscount(SaleCategory):
|
|||||||
|
|
||||||
class SaleCategoryLink(BaseModel):
|
class SaleCategoryLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from pydantic import BaseModel, validator
|
from pydantic import BaseModel, validator
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ class SaleReportItem(BaseModel):
|
|||||||
class SaleReport(BaseModel):
|
class SaleReport(BaseModel):
|
||||||
start_date: date
|
start_date: date
|
||||||
finish_date: date
|
finish_date: date
|
||||||
amounts: List[SaleReportItem]
|
amounts: list[SaleReportItem]
|
||||||
user: UserLink
|
user: UserLink
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
@@ -29,7 +27,7 @@ class SectionBlank(BaseModel):
|
|||||||
|
|
||||||
class SectionLink(BaseModel):
|
class SectionLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from . import to_camel
|
from . import to_camel
|
||||||
@@ -8,8 +6,8 @@ from .sale_category import SaleCategoryLink
|
|||||||
|
|
||||||
|
|
||||||
class SectionPrinter(BaseModel):
|
class SectionPrinter(BaseModel):
|
||||||
sale_category: Optional[SaleCategoryLink]
|
sale_category: SaleCategoryLink | None
|
||||||
printer: Optional[PrinterLink]
|
printer: PrinterLink | None
|
||||||
copies: int = Field(ge=0)
|
copies: int = Field(ge=0)
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from . import to_camel
|
from . import to_camel
|
||||||
|
|
||||||
|
|
||||||
class Split(BaseModel):
|
class Split(BaseModel):
|
||||||
inventories: List[uuid.UUID]
|
inventories: list[uuid.UUID]
|
||||||
table_id: uuid.UUID
|
table_id: uuid.UUID
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from . import to_camel
|
from . import to_camel
|
||||||
@@ -29,7 +27,7 @@ class Table(TableIn):
|
|||||||
|
|
||||||
class TableBlank(TableIn):
|
class TableBlank(TableIn):
|
||||||
name: str
|
name: str
|
||||||
section: Optional[SectionLink]
|
section: SectionLink | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
alias_generator = to_camel
|
alias_generator = to_camel
|
||||||
@@ -37,7 +35,7 @@ class TableBlank(TableIn):
|
|||||||
|
|
||||||
class TableLink(BaseModel):
|
class TableLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
@@ -36,8 +35,8 @@ class TaxBlank(TaxIn):
|
|||||||
|
|
||||||
class TaxLink(BaseModel):
|
class TaxLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
rate: Optional[Decimal]
|
rate: Decimal | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from pydantic import BaseModel, validator
|
from pydantic import BaseModel, validator
|
||||||
|
|
||||||
@@ -21,7 +20,7 @@ class TaxReportItem(BaseModel):
|
|||||||
class TaxReport(BaseModel):
|
class TaxReport(BaseModel):
|
||||||
start_date: date
|
start_date: date
|
||||||
finish_date: date
|
finish_date: date
|
||||||
amounts: List[TaxReportItem]
|
amounts: list[TaxReportItem]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import uuid
|
|||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, validator
|
from pydantic import BaseModel, validator
|
||||||
|
|
||||||
@@ -21,8 +20,8 @@ class UpdateProductPricesItem(BaseModel):
|
|||||||
|
|
||||||
class UpdateProductPrices(BaseModel):
|
class UpdateProductPrices(BaseModel):
|
||||||
date_: date
|
date_: date
|
||||||
menu_category_id: Optional[uuid.UUID]
|
menu_category_id: uuid.UUID | None
|
||||||
items: List[UpdateProductPricesItem]
|
items: list[UpdateProductPricesItem]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
alias_generator = to_camel
|
alias_generator = to_camel
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from barker.schemas import to_camel
|
from barker.schemas import to_camel
|
||||||
from barker.schemas.role import RoleItem
|
from barker.schemas.role import RoleItem
|
||||||
@@ -12,7 +11,7 @@ class UserIn(BaseModel):
|
|||||||
name: str
|
name: str
|
||||||
password: str
|
password: str
|
||||||
locked_out: bool
|
locked_out: bool
|
||||||
roles: List[RoleItem]
|
roles: list[RoleItem]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
@@ -36,8 +35,8 @@ class UserMe(UserIn):
|
|||||||
|
|
||||||
|
|
||||||
class UserLink(BaseModel):
|
class UserLink(BaseModel):
|
||||||
id_: Optional[uuid.UUID]
|
id_: uuid.UUID | None
|
||||||
name: Optional[str]
|
name: str | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
@@ -46,9 +45,9 @@ class UserLink(BaseModel):
|
|||||||
class UserList(BaseModel):
|
class UserList(BaseModel):
|
||||||
id_: uuid.UUID
|
id_: uuid.UUID
|
||||||
name: str
|
name: str
|
||||||
roles: List[str]
|
roles: list[str]
|
||||||
last_device: str
|
last_device: str
|
||||||
last_date: Optional[datetime]
|
last_date: datetime | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
@@ -10,4 +8,4 @@ class UserToken(BaseModel):
|
|||||||
name: str
|
name: str
|
||||||
locked_out: bool = False
|
locked_out: bool = False
|
||||||
password: str
|
password: str
|
||||||
permissions: List[str]
|
permissions: list[str]
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, validator
|
from pydantic import BaseModel, Field, validator
|
||||||
|
|
||||||
@@ -14,16 +13,16 @@ from .tax import TaxLink
|
|||||||
|
|
||||||
|
|
||||||
class Inventory(BaseModel):
|
class Inventory(BaseModel):
|
||||||
id_: Optional[uuid.UUID]
|
id_: uuid.UUID | None
|
||||||
product: ProductLink
|
product: ProductLink
|
||||||
quantity: Decimal = Field(multiple_of=0.01)
|
quantity: Decimal = Field(multiple_of=0.01)
|
||||||
price: Optional[Decimal]
|
price: Decimal | None
|
||||||
tax: Optional[TaxLink]
|
tax: TaxLink | None
|
||||||
tax_rate: Optional[Decimal]
|
tax_rate: Decimal | None
|
||||||
discount: Decimal = Field(ge=0, multiple_of=0.00001, le=1)
|
discount: Decimal = Field(ge=0, multiple_of=0.00001, le=1)
|
||||||
is_happy_hour: bool
|
is_happy_hour: bool
|
||||||
modifiers: Optional[List[ModifierLink]]
|
modifiers: list[ModifierLink] | None
|
||||||
amount: Optional[Decimal]
|
amount: Decimal | None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
alias_generator = to_camel
|
alias_generator = to_camel
|
||||||
@@ -39,8 +38,8 @@ class Inventory(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class Kot(BaseModel):
|
class Kot(BaseModel):
|
||||||
id_: Optional[uuid.UUID]
|
id_: uuid.UUID | None
|
||||||
inventories: List[Inventory]
|
inventories: list[Inventory]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
anystr_strip_whitespace = True
|
anystr_strip_whitespace = True
|
||||||
@@ -50,8 +49,8 @@ class Kot(BaseModel):
|
|||||||
class VoucherIn(BaseModel):
|
class VoucherIn(BaseModel):
|
||||||
pax: int
|
pax: int
|
||||||
table: TableLink
|
table: TableLink
|
||||||
customer: Optional[CustomerLink]
|
customer: CustomerLink | None
|
||||||
kots: List[Kot]
|
kots: list[Kot]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
|
|||||||
+11
-11
@@ -5,31 +5,31 @@ description = "Point of Sale for a restaurant"
|
|||||||
authors = ["tanshu <git@tanshu.com>"]
|
authors = ["tanshu <git@tanshu.com>"]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.8"
|
python = "^3.10"
|
||||||
uvicorn = {extras = ["standard"], version = "^0.17.6"}
|
uvicorn = {extras = ["standard"], version = "^0.17.6"}
|
||||||
fastapi = "^0.75.1"
|
fastapi = "^0.78.0"
|
||||||
python-jose = {extras = ["cryptography"], version = "^3.3.0"}
|
python-jose = {extras = ["cryptography"], version = "^3.3.0"}
|
||||||
passlib = {extras = ["bcrypt"], version = "^1.7.4"}
|
passlib = {extras = ["bcrypt"], version = "^1.7.4"}
|
||||||
psycopg2-binary = "^2.9.3"
|
psycopg2-binary = "^2.9.3"
|
||||||
SQLAlchemy = "^1.4.34"
|
SQLAlchemy = "^1.4.36"
|
||||||
python-multipart = "^0.0.5"
|
python-multipart = "^0.0.5"
|
||||||
PyJWT = "^2.3.0"
|
PyJWT = "^2.4.0"
|
||||||
alembic = "^1.7.7"
|
alembic = "^1.7.7"
|
||||||
itsdangerous = "^2.1.2"
|
itsdangerous = "^2.1.2"
|
||||||
python-dotenv = "^0.19.2"
|
python-dotenv = "^0.20.0"
|
||||||
pydantic = {extras = ["dotenv"], version = "^1.9.0"}
|
pydantic = {extras = ["dotenv"], version = "^1.9.1"}
|
||||||
starlette = "^0.17.1"
|
starlette = "^0.19.1"
|
||||||
arq = "^0.22"
|
arq = "^0.23a1"
|
||||||
aiohttp = "^3.8.1"
|
aiohttp = "^3.8.1"
|
||||||
cryptography = "^36.0.2"
|
cryptography = "^37.0.2"
|
||||||
gunicorn = "^20.1.0"
|
gunicorn = "^20.1.0"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
flake8 = "^4.0.1"
|
flake8 = "^4.0.1"
|
||||||
black = "^22.3.0"
|
black = "^22.3.0"
|
||||||
isort = {extras = ["toml"], version = "^5.10.1"}
|
isort = {extras = ["toml"], version = "^5.10.1"}
|
||||||
pre-commit = "^2.17.0"
|
pre-commit = "^2.19.0"
|
||||||
mypy = "^0.942"
|
mypy = "^0.950"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
|||||||
+34
-34
@@ -14,51 +14,51 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^13.3.1",
|
"@angular/animations": "^13.3.9",
|
||||||
"@angular/cdk": "^13.3.2",
|
"@angular/cdk": "^13.3.7",
|
||||||
"@angular/common": "^13.3.1",
|
"@angular/common": "^13.3.9",
|
||||||
"@angular/compiler": "^13.3.1",
|
"@angular/compiler": "^13.3.9",
|
||||||
"@angular/core": "^13.3.1",
|
"@angular/core": "^13.3.9",
|
||||||
"@angular/flex-layout": "^13.0.0-beta.38",
|
"@angular/flex-layout": "^13.0.0-beta.38",
|
||||||
"@angular/forms": "^13.3.1",
|
"@angular/forms": "^13.3.9",
|
||||||
"@angular/material": "^13.3.2",
|
"@angular/material": "^13.3.7",
|
||||||
"@angular/material-moment-adapter": "^13.3.2",
|
"@angular/material-moment-adapter": "^13.3.7",
|
||||||
"@angular/platform-browser": "^13.3.1",
|
"@angular/platform-browser": "^13.3.9",
|
||||||
"@angular/platform-browser-dynamic": "^13.3.1",
|
"@angular/platform-browser-dynamic": "^13.3.9",
|
||||||
"@angular/router": "^13.3.1",
|
"@angular/router": "^13.3.9",
|
||||||
"mathjs": "^10.4.2",
|
"mathjs": "^10.5.3",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.3",
|
||||||
"rxjs": "^6.6.7",
|
"rxjs": "^6.6.7",
|
||||||
"tslib": "^2.2.0",
|
"tslib": "^2.2.0",
|
||||||
"zone.js": "~0.11.4"
|
"zone.js": "~0.11.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "~13.3.1",
|
"@angular-devkit/build-angular": "~13.3.6",
|
||||||
"@angular-eslint/builder": "^13.1.0",
|
"@angular-eslint/builder": "^13.2.1",
|
||||||
"@angular-eslint/eslint-plugin": "^13.1.0",
|
"@angular-eslint/eslint-plugin": "^13.2.1",
|
||||||
"@angular-eslint/eslint-plugin-template": "^13.1.0",
|
"@angular-eslint/eslint-plugin-template": "^13.2.1",
|
||||||
"@angular-eslint/schematics": "^13.1.0",
|
"@angular-eslint/schematics": "^13.2.1",
|
||||||
"@angular-eslint/template-parser": "^13.1.0",
|
"@angular-eslint/template-parser": "^13.2.1",
|
||||||
"@angular/cli": "^13.3.1",
|
"@angular/cli": "^13.3.6",
|
||||||
"@angular/compiler-cli": "^13.3.1",
|
"@angular/compiler-cli": "^13.3.9",
|
||||||
"@angular/language-service": "^13.3.1",
|
"@angular/language-service": "^13.3.9",
|
||||||
"@types/jasmine": "~3.7.4",
|
"@types/jasmine": "~3.7.4",
|
||||||
"@types/node": "^17.0.23",
|
"@types/node": "^17.0.35",
|
||||||
"@typescript-eslint/eslint-plugin": "5.17.0",
|
"@typescript-eslint/eslint-plugin": "5.25.0",
|
||||||
"@typescript-eslint/parser": "5.17.0",
|
"@typescript-eslint/parser": "5.25.0",
|
||||||
"eslint": "^8.12.0",
|
"eslint": "^8.16.0",
|
||||||
"eslint-plugin-import": "2.25.4",
|
"eslint-plugin-import": "2.26.0",
|
||||||
"husky": "^7.0.4",
|
"husky": "^8.0.1",
|
||||||
"jasmine-core": "^3.7.1",
|
"jasmine-core": "^3.7.1",
|
||||||
"jasmine-spec-reporter": "^7.0.0",
|
"jasmine-spec-reporter": "^7.0.0",
|
||||||
"karma": "^6.3.2",
|
"karma": "^6.3.2",
|
||||||
"karma-chrome-launcher": "~3.1.0",
|
"karma-chrome-launcher": "~3.1.1",
|
||||||
"karma-coverage-istanbul-reporter": "~3.0.2",
|
"karma-coverage-istanbul-reporter": "~3.0.2",
|
||||||
"karma-jasmine": "^4.0.0",
|
"karma-jasmine": "^4.0.2",
|
||||||
"karma-jasmine-html-reporter": "^1.6.0",
|
"karma-jasmine-html-reporter": "^1.7.0",
|
||||||
"lint-staged": "^12.3.7",
|
"lint-staged": "^12.4.1",
|
||||||
"prettier": "^2.6.1",
|
"prettier": "^2.6.2",
|
||||||
"standard-version": "^9.3.2",
|
"standard-version": "^9.5.0",
|
||||||
"ts-node": "^9.1.1",
|
"ts-node": "^9.1.1",
|
||||||
"typescript": "~4.5.4"
|
"typescript": "~4.5.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,11 +5,10 @@ description = "Point of Sale for a restaurant"
|
|||||||
authors = ["tanshu <git@tanshu.com>"]
|
authors = ["tanshu <git@tanshu.com>"]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.9"
|
python = "^3.10"
|
||||||
pydantic = {extras = ["dotenv"], version = "^1.9.0"}
|
pydantic = {extras = ["dotenv"], version = "^1.9.1"}
|
||||||
arq = "^0.22"
|
arq = "^0.23a1"
|
||||||
aiohttp = "^3.8.1"
|
aiohttp = "^3.8.1"
|
||||||
aioredis = "^1.3.1"
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
|||||||
Reference in new issue
Block a user