add contract pdf generation
This commit is contained in:
@@ -20,15 +20,30 @@ class UserUpdate(SQLModel):
|
||||
class UserCreate(UserBase):
|
||||
pass
|
||||
|
||||
class PaymentMethodBase(SQLModel):
|
||||
name: str
|
||||
details: str
|
||||
|
||||
class PaymentMethod(PaymentMethodBase, table=True):
|
||||
id: int | None = Field(default=None, primary_key=True)
|
||||
productor_id: int = Field(foreign_key="productor.id", ondelete="CASCADE")
|
||||
productor: Optional["Productor"] = Relationship(
|
||||
back_populates="payment_methods",
|
||||
)
|
||||
|
||||
class PaymentMethodPublic(PaymentMethodBase):
|
||||
id: int
|
||||
productor: Optional["Productor"]
|
||||
|
||||
class ProductorBase(SQLModel):
|
||||
name: str
|
||||
address: str
|
||||
payment: str
|
||||
type: str
|
||||
|
||||
class ProductorPublic(ProductorBase):
|
||||
id: int
|
||||
products: list["Product"] = []
|
||||
payment_methods: list["PaymentMethod"] = []
|
||||
|
||||
class Productor(ProductorBase, table=True):
|
||||
id: int | None = Field(default=None, primary_key=True)
|
||||
@@ -39,15 +54,19 @@ class Productor(ProductorBase, table=True):
|
||||
"order_by": "Product.name"
|
||||
},
|
||||
)
|
||||
payment_methods: list["PaymentMethod"] = Relationship(
|
||||
back_populates="productor",
|
||||
cascade_delete=True
|
||||
)
|
||||
|
||||
class ProductorUpdate(SQLModel):
|
||||
name: str | None
|
||||
address: str | None
|
||||
payment: str | None
|
||||
payment_methods: list["PaymentMethod"] = []
|
||||
type: str | None
|
||||
|
||||
class ProductorCreate(ProductorBase):
|
||||
pass
|
||||
payment_methods: list["PaymentMethod"] = []
|
||||
|
||||
class Unit(StrEnum):
|
||||
GRAMS = "1"
|
||||
@@ -102,6 +121,7 @@ class FormBase(SQLModel):
|
||||
season: str
|
||||
start: datetime.date
|
||||
end: datetime.date
|
||||
minimum_shipment_value: float | None
|
||||
|
||||
class FormPublic(FormBase):
|
||||
id: int
|
||||
@@ -128,6 +148,7 @@ class FormUpdate(SQLModel):
|
||||
season: str | None
|
||||
start: datetime.date | None
|
||||
end: datetime.date | None
|
||||
minimum_shipment_value: float | None
|
||||
|
||||
class FormCreate(FormBase):
|
||||
pass
|
||||
@@ -148,13 +169,14 @@ class TemplateCreate(TemplateBase):
|
||||
pass
|
||||
|
||||
class ContractBase(SQLModel):
|
||||
pass
|
||||
form_id: int
|
||||
contract: dict
|
||||
|
||||
class ContractPublic(ContractBase):
|
||||
id: int
|
||||
|
||||
class Contract(ContractBase, table=True):
|
||||
id: int | None = Field(default=None, primary_key=True)
|
||||
# class Contract(ContractBase, table=True):
|
||||
# id: int | None = Field(default=None, primary_key=True)
|
||||
|
||||
class ContractUpdate(SQLModel):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user