Fix: Issues flagged by mypy
This commit is contained in:
parent
85a939b761
commit
43a884144b
@ -104,13 +104,12 @@ def update_route(
|
||||
def delete_route(
|
||||
id_: uuid.UUID,
|
||||
user: UserToken = Security(get_user, scopes=["customers"]),
|
||||
) -> schemas.GuestBookIn:
|
||||
) -> None:
|
||||
try:
|
||||
with SessionFuture() as db:
|
||||
item: GuestBook = db.execute(select(GuestBook).where(GuestBook.id == id_)).scalar_one()
|
||||
db.delete(item)
|
||||
db.commit()
|
||||
return blank_guest_book_info()
|
||||
except SQLAlchemyError as e:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
|
@ -233,7 +233,6 @@ def modifier_category_info(item: ModifierCategory, date_: date, db: Session) ->
|
||||
schemas.MenuCategoryLink(
|
||||
id_=mc.id,
|
||||
name=mc.name,
|
||||
enabled=False,
|
||||
products=[
|
||||
ProductLinkSchema(
|
||||
id_=p.product_id,
|
||||
@ -284,7 +283,6 @@ def modifier_category_blank(date_: date, db: Session) -> schemas.ModifierCategor
|
||||
schemas.MenuCategoryLink(
|
||||
id_=mc.id,
|
||||
name=mc.name,
|
||||
enabled=False,
|
||||
products=[ProductLinkSchema(id_=p.product_id, name=p.name, enabled=False) for p in mc.products],
|
||||
)
|
||||
for mc in menu_categories
|
||||
|
@ -1,5 +1,7 @@
|
||||
import uuid
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import Daf, to_camel
|
||||
@ -8,8 +10,8 @@ from . import Daf, to_camel
|
||||
class CustomerDiscount(BaseModel):
|
||||
id_: uuid.UUID
|
||||
name: str
|
||||
discount: Daf = Field(ge=0, default=0, le=1)
|
||||
limit: Daf = Field(ge=0, default=0, le=1)
|
||||
discount: Daf = Field(ge=Decimal(0), default=Decimal(0), le=Decimal(1))
|
||||
limit: Daf = Field(ge=Decimal(0), default=Decimal(0), le=Decimal(1))
|
||||
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
||||
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
import uuid
|
||||
|
||||
from decimal import Decimal
|
||||
from typing import Annotated
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import Daf, to_camel
|
||||
@ -8,7 +11,7 @@ from . import Daf, to_camel
|
||||
class DiscountItem(BaseModel):
|
||||
id_: uuid.UUID
|
||||
name: str
|
||||
discount: Daf | None = Field(ge=0, default=0, le=1)
|
||||
discount: Annotated[Daf | None, Field(ge=Decimal(0), default=Decimal(0), le=Decimal(1))]
|
||||
limit: Daf
|
||||
customer: Daf
|
||||
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
||||
|
@ -1,5 +1,7 @@
|
||||
import uuid
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import Daf, to_camel
|
||||
@ -9,7 +11,7 @@ from .modifier_category import ModifierCategoryLink
|
||||
class ModifierIn(BaseModel):
|
||||
name: str = Field(..., min_length=1)
|
||||
show_in_bill: bool
|
||||
price: Daf = Field(ge=0, default=0)
|
||||
price: Daf = Field(ge=Decimal(0), default=Decimal(0))
|
||||
is_active: bool
|
||||
modifier_category: ModifierCategoryLink
|
||||
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
|
||||
|
@ -1,6 +1,7 @@
|
||||
import uuid
|
||||
|
||||
from datetime import date, datetime
|
||||
from decimal import Decimal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_serializer, field_validator
|
||||
|
||||
@ -17,7 +18,7 @@ class ProductIn(BaseModel):
|
||||
price: Daf # = Field(ge=0, default=0)
|
||||
has_happy_hour: bool
|
||||
is_not_available: bool
|
||||
quantity: Daf = Field(ge=0, default=0)
|
||||
quantity: Daf = Field(ge=Decimal(0), default=Decimal(0))
|
||||
is_active: bool
|
||||
sort_order: int
|
||||
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
|
||||
|
@ -1,5 +1,7 @@
|
||||
import uuid
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import Daf, to_camel
|
||||
@ -8,7 +10,7 @@ from .tax import TaxLink
|
||||
|
||||
class SaleCategoryIn(BaseModel):
|
||||
name: str = Field(..., min_length=1)
|
||||
discount_limit: Daf = Field(ge=0, default=0, le=1)
|
||||
discount_limit: Daf = Field(ge=Decimal(0), default=Decimal(0), le=Decimal(1))
|
||||
tax: TaxLink = Field(...)
|
||||
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
import uuid
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import Daf, to_camel
|
||||
@ -8,7 +10,7 @@ from .regime import RegimeLink
|
||||
|
||||
class TaxIn(BaseModel):
|
||||
name: str = Field(..., min_length=1)
|
||||
rate: Daf = Field(ge=0, default=0)
|
||||
rate: Daf = Field(ge=Decimal(0), default=Decimal(0))
|
||||
regime: RegimeLink = Field(...)
|
||||
is_fixture: bool
|
||||
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
|
||||
@ -21,7 +23,7 @@ class Tax(TaxIn):
|
||||
|
||||
class TaxBlank(BaseModel):
|
||||
name: str
|
||||
rate: Daf = Field(ge=0, default=0)
|
||||
rate: Daf = Field(ge=Decimal(0), default=Decimal(0))
|
||||
is_fixture: bool
|
||||
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user