- Added billing models and repository for handling bills. - Introduced BillingService to manage payment initiation and bill creation. - Updated user service to remove ticket-related functionality. - Refactored settings to include new billing-related fields. - Removed ticket-related handlers and schemas. - Added new billing handlers for processing payments. - Updated database schema with new bills table and status enum. - Enhanced utility functions to calculate prices considering discounts. - Introduced prehandling for non-private messages. - Updated main application to initialize new billing services and repositories.
29 lines
816 B
Python
29 lines
816 B
Python
from typing import TYPE_CHECKING
|
|
|
|
from sqlalchemy import BIGINT, INTEGER, Enum, ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from db.base import Base
|
|
from misc.pally import BillStatus
|
|
|
|
if TYPE_CHECKING:
|
|
from db.models.users import User
|
|
|
|
|
|
class Bill(Base):
|
|
__tablename__ = "bills"
|
|
|
|
id: Mapped[int] = mapped_column(
|
|
BIGINT, autoincrement=True, unique=True, nullable=False, primary_key=True
|
|
)
|
|
creator_id: Mapped[int] = mapped_column(BIGINT, ForeignKey("users.id"), nullable=False)
|
|
amount: Mapped[int] = mapped_column(INTEGER, nullable=False)
|
|
status: Mapped[BillStatus] = mapped_column(
|
|
Enum(BillStatus), nullable=False, default=BillStatus.NEW
|
|
)
|
|
|
|
user: Mapped["User"] = relationship(
|
|
"User",
|
|
back_populates="bills",
|
|
)
|