64 lines
1.6 KiB
Python
64 lines
1.6 KiB
Python
from enum import Enum
|
|
from typing import Annotated, Optional
|
|
|
|
import sqlalchemy
|
|
from litestar.contrib.sqlalchemy.base import BigIntBase
|
|
from litestar.contrib.sqlalchemy.dto import SQLAlchemyDTO
|
|
from litestar.dto import DTOConfig
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.lib import service
|
|
from app.lib.filter_repository import FilterRepository
|
|
|
|
|
|
class FiscalModuleEnum(str, Enum):
|
|
CROATIA = "CROATIA"
|
|
HUNGARY = "HUNGARY"
|
|
ITALY = "ITALY"
|
|
MONTENEGRO = "MONTENEGRO"
|
|
ROMANIA = "ROMANIA"
|
|
RUSSIA = "RUSSIA"
|
|
SERBIA = "SERBIA"
|
|
|
|
|
|
class PaymentTypeEnum(str, Enum):
|
|
CA = "CA"
|
|
DA = "DA"
|
|
DB = "DB"
|
|
DC = "DC"
|
|
DD = "DD"
|
|
PA4 = "PA4"
|
|
NEG = "NEG"
|
|
PA3 = "PA3"
|
|
TA = "TA"
|
|
WLT = "WLT"
|
|
|
|
|
|
class FiscalPaymentMapping(BigIntBase):
|
|
__tablename__ = "fiscal_payment_mapping" # type: ignore[assignment]
|
|
|
|
fiscal_module: Mapped[FiscalModuleEnum] = mapped_column(
|
|
sqlalchemy.Enum(FiscalModuleEnum, name="fiscal_module_enum")
|
|
)
|
|
code: Mapped[str]
|
|
payment_type: Mapped[PaymentTypeEnum] = mapped_column(
|
|
sqlalchemy.Enum(PaymentTypeEnum, name="televend_payment_type")
|
|
)
|
|
operation_mode_code: Mapped[int]
|
|
payment_device_code: Mapped[Optional[int]]
|
|
|
|
|
|
class Repository(FilterRepository[FiscalPaymentMapping]):
|
|
model_type = FiscalPaymentMapping
|
|
|
|
|
|
class Service(service.Service[FiscalPaymentMapping]):
|
|
repository_type = Repository
|
|
|
|
|
|
write_config = DTOConfig(exclude={"id"})
|
|
FiscalPaymentMappingWriteDTO = SQLAlchemyDTO[
|
|
Annotated[FiscalPaymentMapping, write_config]
|
|
]
|
|
FiscalPaymentMappingReadDTO = SQLAlchemyDTO[FiscalPaymentMapping]
|