feat: billing guest access
This commit is contained in:
		@@ -10,5 +10,6 @@ from .barcode import *
 | 
			
		||||
from .shipping_warehouse import *
 | 
			
		||||
from .marketplace import *
 | 
			
		||||
from .payroll import *
 | 
			
		||||
from .billing import *
 | 
			
		||||
 | 
			
		||||
configure_mappers()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								models/billing.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								models/billing.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
import datetime
 | 
			
		||||
from typing import TYPE_CHECKING
 | 
			
		||||
 | 
			
		||||
from sqlalchemy import ForeignKey
 | 
			
		||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
 | 
			
		||||
 | 
			
		||||
from models import BaseModel
 | 
			
		||||
if TYPE_CHECKING:
 | 
			
		||||
    from models import Deal
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DealBillRequest(BaseModel):
 | 
			
		||||
    __tablename__ = 'deal_bill_requests'
 | 
			
		||||
 | 
			
		||||
    deal_id: Mapped[int] = mapped_column(ForeignKey('deals.id'),
 | 
			
		||||
                                         nullable=False,
 | 
			
		||||
                                         primary_key=True,
 | 
			
		||||
                                         unique=True)
 | 
			
		||||
    deal: Mapped['Deal'] = relationship(back_populates='bill_request')
 | 
			
		||||
 | 
			
		||||
    created_at: Mapped[datetime.datetime] = mapped_column(nullable=False)
 | 
			
		||||
    paid: Mapped[bool] = mapped_column(nullable=False, default=False)
 | 
			
		||||
 | 
			
		||||
    pdf_url: Mapped[str] = mapped_column(nullable=True)
 | 
			
		||||
    invoice_number: Mapped[str] = mapped_column(nullable=True)
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
from enum import IntEnum, unique
 | 
			
		||||
from typing import Optional, TYPE_CHECKING
 | 
			
		||||
 | 
			
		||||
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Boolean
 | 
			
		||||
from sqlalchemy.orm import relationship, backref, Mapped, mapped_column
 | 
			
		||||
@@ -7,6 +8,9 @@ from models.base import BaseModel
 | 
			
		||||
from .marketplace import BaseMarketplace
 | 
			
		||||
from .shipping_warehouse import ShippingWarehouse
 | 
			
		||||
 | 
			
		||||
if TYPE_CHECKING:
 | 
			
		||||
    from . import DealBillRequest
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@unique
 | 
			
		||||
class DealStatus(IntEnum):
 | 
			
		||||
@@ -33,6 +37,7 @@ class Deal(BaseModel):
 | 
			
		||||
 | 
			
		||||
    is_deleted = Column(Boolean, nullable=False, server_default='0', default=False, comment='Удалена')
 | 
			
		||||
    is_completed = Column(Boolean, nullable=False, server_default='0', default=False, comment='Завершена')
 | 
			
		||||
    is_locked: Mapped[bool] = mapped_column(default=False, server_default='0')
 | 
			
		||||
 | 
			
		||||
    shipping_warehouse_id: Mapped[int] = mapped_column(ForeignKey('shipping_warehouses.id'), nullable=True)
 | 
			
		||||
    shipping_warehouse: Mapped["ShippingWarehouse"] = relationship()
 | 
			
		||||
@@ -58,6 +63,7 @@ class Deal(BaseModel):
 | 
			
		||||
    lexorank = Column(String, nullable=False, comment='Lexorank', index=True)
 | 
			
		||||
 | 
			
		||||
    comment = Column(String, nullable=False, server_default='', comment='Коментарий к заданию')
 | 
			
		||||
    bill_request: Mapped[Optional['DealBillRequest']] = relationship(back_populates='deal', lazy='joined')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DealStatusHistory(BaseModel):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user