A lot of unplanned clean up and created some new/missing methods and routes. Mainly working on order and order_cart related stuff.
This commit is contained in:
136
app/models/order_cart_line_models.py
Normal file
136
app/models/order_cart_line_models.py
Normal file
@@ -0,0 +1,136 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
|
||||
from app.db_sql import redis_lookup_id_random
|
||||
from app.lib_general import *
|
||||
|
||||
from .common_field_schema import base_fields, default_num_bytes
|
||||
|
||||
|
||||
class Order_Cart_Line_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['order_cart_line_id_random'],
|
||||
alias = 'order_cart_line_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'order_cart_line_id'
|
||||
)
|
||||
|
||||
order_cart_id_random: Optional[str]
|
||||
order_cart_id: Optional[int]
|
||||
|
||||
product_id_random: str
|
||||
product_id: Optional[int]
|
||||
product_for_type: Optional[str] # Copied from product record
|
||||
product_for_id_random: Optional[str] # Copied from product record
|
||||
product_for_id: Optional[int] # Copied from product record
|
||||
product_type_id: Optional[int] # Copied from product record
|
||||
product_type: Optional[str] # Copied from product record; dup from look up? probably not use?
|
||||
product_type_name: Optional[str] # Copied from product record; from look up
|
||||
product_name: Optional[str] # Copied from product record
|
||||
product_description: Optional[str] # Copied from product record
|
||||
product_unit_price: Optional[int] # Copied from product record
|
||||
product_recurring: Optional[bool] # Copied from product record
|
||||
|
||||
curr_product_id_random: str # Should be the same as product_id_random above
|
||||
curr_product_id: Optional[int] # Should be the same as product_id above
|
||||
curr_product_for_type: Optional[str] # Dynamic from v_order_current_line
|
||||
curr_product_for_id_random: Optional[str] # Dynamic from v_order_current_line
|
||||
curr_product_for_id: Optional[int] # Dynamic from v_order_current_line
|
||||
curr_product_type_id: Optional[int] # Dynamic from v_order_current_line
|
||||
curr_product_type: Optional[str] # Dynamic from v_order_current_line
|
||||
curr_product_type_name: Optional[str] # Dynamic from v_order_current_line
|
||||
curr_product_name: Optional[str] # Dynamic from v_order_current_line
|
||||
curr_product_description: Optional[str] # Dynamic from v_order_current_line
|
||||
curr_product_unit_price: Optional[int] # Dynamic from v_order_current_line
|
||||
curr_product_max_quantity: Optional[int] # Dynamic from v_order_current_line
|
||||
curr_product_recurring: Optional[bool] # Dynamic from v_order_current_line
|
||||
|
||||
for_person_id: Optional[int]
|
||||
for_person_id_random: Optional[str]
|
||||
for_person_given_name: Optional[str] # Dynamic from v_order_current_line
|
||||
for_person_full_name: Optional[str] # Dynamic from v_order_current_line
|
||||
|
||||
name: Optional[str] # Should be the same as product_name above
|
||||
quantity: int = Field(0, ge=0, lt=150)
|
||||
amount: int = Field(0, ge=0, lt=1500000)
|
||||
recurring: Optional[bool] = False
|
||||
message: Optional[str]
|
||||
|
||||
notes: Optional[str]
|
||||
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
# Including other related objects
|
||||
# product: Optional[Union[Product_Base, None]] # Future use?
|
||||
# for_person: Optional[Union[Person_Base, None]] # Future use?
|
||||
|
||||
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
#@validator('order_cart_line_id_random', always=True)
|
||||
def order_cart_line_id_random_copy(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['id_random']:
|
||||
return values['id_random']
|
||||
return None
|
||||
|
||||
@validator('id', always=True)
|
||||
def order_cart_line_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['id_random']:
|
||||
log.debug(values['id_random'])
|
||||
return redis_lookup_id_random(record_id_random=values['id_random'], table_name='order_cart_line')
|
||||
return None
|
||||
|
||||
@validator('order_cart_id', always=True)
|
||||
def order_cart_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['order_cart_id_random']:
|
||||
return redis_lookup_id_random(record_id_random=values['order_cart_id_random'], table_name='order_cart')
|
||||
return None
|
||||
|
||||
@validator('product_id', always=True)
|
||||
def product_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values.get('product_id_random', None):
|
||||
return redis_lookup_id_random(record_id_random=values['product_id_random'], table_name='product')
|
||||
return None
|
||||
|
||||
@validator('product_for_id', always=True)
|
||||
def product_for_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['product_for_id_random'] and values['product_for_type']:
|
||||
return redis_lookup_id_random(record_id_random=values['product_for_id_random'], table_name=values['product_for_type'])
|
||||
return None
|
||||
|
||||
@validator('curr_product_for_id', always=True)
|
||||
def curr_product_for_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['curr_product_for_id_random'] and values['curr_product_for_type']:
|
||||
return redis_lookup_id_random(record_id_random=values['curr_product_for_id_random'], table_name=values['curr_product_for_type'])
|
||||
return None
|
||||
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
@@ -5,103 +5,11 @@ from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
|
||||
from app.db_sql import redis_lookup_id_random
|
||||
from app.lib_general import *
|
||||
from app.lib_general import log, logging
|
||||
|
||||
from .common_field_schema import base_fields, default_num_bytes
|
||||
from .order_models import Order_Cfg_Base
|
||||
|
||||
|
||||
# class Order_Cfg_Base(BaseModel):
|
||||
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# log.debug(locals())
|
||||
|
||||
# account_name: Optional[str]
|
||||
|
||||
# show_cart: Optional[bool]
|
||||
# cart_label: Optional[str]
|
||||
|
||||
|
||||
class Order_Cart_Line_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['order_cart_line_id_random'],
|
||||
alias = 'order_cart_line_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'order_cart_line_id'
|
||||
)
|
||||
#order_cart_line_id_random: Optional[str]
|
||||
order_cart_id_random: Optional[str]
|
||||
order_cart_id: Optional[int]
|
||||
|
||||
product_id_random: str
|
||||
product_id: Optional[int]
|
||||
|
||||
product_type_id: Optional[int]
|
||||
product_type: Optional[str]
|
||||
|
||||
product_name: Optional[str]
|
||||
product_description: Optional[str]
|
||||
product_unit_price: Optional[int] = Field(0, ge=0, lt=1500000)
|
||||
product_max_quantity: Optional[int] = Field(0, ge=0, lt=150)
|
||||
|
||||
quantity: int = Field(0, ge=0, lt=150)
|
||||
amount: int = Field(0, ge=0, lt=1500000)
|
||||
|
||||
recurring: Optional[bool] = False
|
||||
|
||||
message: Optional[str]
|
||||
|
||||
notes: Optional[str]
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
#@validator('order_cart_line_id_random', always=True)
|
||||
def order_cart_line_id_random_copy(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['id_random']:
|
||||
return values['id_random']
|
||||
return None
|
||||
|
||||
@validator('id', always=True)
|
||||
def order_cart_line_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['id_random']:
|
||||
log.debug(values['id_random'])
|
||||
return redis_lookup_id_random(record_id_random=values['id_random'], table_name='order_cart_line')
|
||||
return None
|
||||
|
||||
@validator('order_cart_id', always=True)
|
||||
def order_cart_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['order_cart_id_random']:
|
||||
return redis_lookup_id_random(record_id_random=values['order_cart_id_random'], table_name='order_cart')
|
||||
return None
|
||||
|
||||
@validator('product_id', always=True)
|
||||
def product_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values.get('product_id_random', None):
|
||||
return redis_lookup_id_random(record_id_random=values['product_id_random'], table_name='product')
|
||||
return None
|
||||
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
from app.models.order_cart_line_models import Order_Cart_Line_Base
|
||||
from app.models.order_cfg_models import Order_Cfg_Base
|
||||
|
||||
|
||||
class Order_Cart_DB_Base(BaseModel):
|
||||
@@ -230,8 +138,8 @@ class Order_Cart_Base(BaseModel):
|
||||
updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
# Including other related objects
|
||||
order_cart_line_list: Optional[list[Order_Cart_Line_Base]] # Order_Line_Base() # List[Order_Cart_Line_Base] = []
|
||||
cfg: Optional[Order_Cfg_Base] = Order_Cfg_Base() # Should this be renamed to order_cfg?
|
||||
order_cart_line_list: Optional[list[Order_Cart_Line_Base]] # Order_Line_Base() # List[Order_Cart_Line_Base] = []
|
||||
|
||||
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
|
||||
@@ -17,6 +17,21 @@ class Order_Cfg_Base(BaseModel):
|
||||
account_id_random: Optional[str]
|
||||
account_id: Optional[int]
|
||||
|
||||
account_name: Optional[str]
|
||||
|
||||
default_no_reply_email: Optional[str]
|
||||
default_no_reply_name: Optional[str]
|
||||
confirm_email: Optional[str]
|
||||
confirm_name: Optional[str]
|
||||
|
||||
order_header: Optional[str]
|
||||
order_thanks: Optional[str]
|
||||
order_message: Optional[str]
|
||||
order_footer: Optional[str]
|
||||
order_fundraising_thanks: Optional[str]
|
||||
order_fundraising_message: Optional[str]
|
||||
|
||||
|
||||
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
@validator('account_id', always=True)
|
||||
@@ -27,5 +42,3 @@ class Order_Cfg_Base(BaseModel):
|
||||
if values['account_id_random']:
|
||||
return redis_lookup_id_random(record_id_random=values['account_id_random'], table_name='account')
|
||||
return None
|
||||
|
||||
Order_Cfg_Base.update_forward_refs()
|
||||
|
||||
@@ -20,35 +20,59 @@ class Order_Line_Base(BaseModel):
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
#alias = 'order_line_id'
|
||||
alias = 'order_line_id'
|
||||
)
|
||||
#order_line_id_random: Optional[str]
|
||||
|
||||
order_id_random: Optional[str]
|
||||
order_id: Optional[int]
|
||||
|
||||
product_id_random: str
|
||||
product_id: Optional[int]
|
||||
product_type_id: Optional[int]
|
||||
product_type: Optional[str]
|
||||
product_for_type: Optional[str] # Copied from product record
|
||||
product_for_id_random: Optional[str] # Copied from product record
|
||||
product_for_id: Optional[int] # Copied from product record
|
||||
product_type_id: Optional[int] # Copied from product record
|
||||
product_type: Optional[str] # WARNING: Copied from product record; dup from look up? probably not use?
|
||||
product_type_name: Optional[str] # Copied from product record; from look up
|
||||
product_name: Optional[str] # Copied from product record
|
||||
product_description: Optional[str] # Copied from product record
|
||||
product_unit_price: Optional[int] # Copied from product record
|
||||
product_recurring: Optional[bool] # Copied from product record
|
||||
|
||||
curr_product_id_random: str # Should be the same as product_id_random above
|
||||
curr_product_id: Optional[int] # Should be the same as product_id above
|
||||
curr_product_for_type: Optional[str] # Dynamic from v_order_line
|
||||
curr_product_for_id_random: Optional[str] # Dynamic from v_order_line
|
||||
curr_product_for_id: Optional[int] # Dynamic from v_order_line
|
||||
curr_product_type_id: Optional[int] # Dynamic from v_order_line
|
||||
curr_product_type: Optional[str] # Dynamic from v_order_line
|
||||
curr_product_type_name: Optional[str] # Dynamic from v_order_line
|
||||
curr_product_name: Optional[str] # Dynamic from v_order_line
|
||||
curr_product_description: Optional[str] # Dynamic from v_order_line
|
||||
curr_product_unit_price: Optional[int] # Dynamic from v_order_line
|
||||
curr_product_max_quantity: Optional[int] # Dynamic from v_order_line
|
||||
curr_product_recurring: Optional[bool] # Dynamic from v_order_line
|
||||
|
||||
# NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
|
||||
# NOTE need to check @validator NOTE NOTE NOTE NOTE
|
||||
for_type: Optional[str] # Copied from the current value in product.for_type
|
||||
for_id_random: Optional[str] # Copied from the current value in product.for_id_random
|
||||
for_id: Optional[int] # Copied from the current value in product.for_id
|
||||
# NOTE!!! Need ot add similar to order_cart_line???
|
||||
# NOTE!!! Need to add to the actual order_line (and order_cart_line???) tables!
|
||||
for_person_id: Optional[int]
|
||||
for_person_id_random: Optional[str]
|
||||
for_person_given_name: Optional[str] # Dynamic from v_order_line
|
||||
for_person_full_name: Optional[str] # Dynamic from v_order_line
|
||||
|
||||
name: Optional[str]
|
||||
description: Optional[str]
|
||||
name: Optional[str] # Should be the same as product_name above
|
||||
quantity: int = Field(0, ge=0, lt=150)
|
||||
amount: int = Field(0, ge=0, lt=1500000)
|
||||
recurring: Optional[bool] = False
|
||||
message: Optional[str]
|
||||
|
||||
notes: Optional[str]
|
||||
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
# Including other related objects
|
||||
# product: Optional[Union[Product_Base, None]] # Future use?
|
||||
# for_person: Optional[Union[Person_Base, None]] # Future use?
|
||||
|
||||
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
#@validator('order_line_id_random', always=True)
|
||||
@@ -84,19 +108,29 @@ class Order_Line_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['product_id_random']:
|
||||
if values.get('product_id_random', None):
|
||||
return redis_lookup_id_random(record_id_random=values['product_id_random'], table_name='product')
|
||||
return None
|
||||
|
||||
@validator('for_id', always=True)
|
||||
def for_id_lookup(cls, v, values, **kwargs):
|
||||
@validator('product_for_id', always=True)
|
||||
def product_for_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['for_id_random'] and values['for_type']:
|
||||
return redis_lookup_id_random(record_id_random=values['for_id_random'], table_name=values['for_type'])
|
||||
if values['product_for_id_random'] and values['product_for_type']:
|
||||
return redis_lookup_id_random(record_id_random=values['product_for_id_random'], table_name=values['product_for_type'])
|
||||
return None
|
||||
|
||||
@validator('curr_product_for_id', always=True)
|
||||
def curr_product_for_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['curr_product_for_id_random'] and values['curr_product_for_type']:
|
||||
return redis_lookup_id_random(record_id_random=values['curr_product_for_id_random'], table_name=values['curr_product_for_type'])
|
||||
return None
|
||||
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
@@ -5,136 +5,45 @@ from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
|
||||
from app.db_sql import redis_lookup_id_random
|
||||
from app.lib_general import *
|
||||
from app.lib_general import log, logging
|
||||
|
||||
from .common_field_schema import base_fields, default_num_bytes
|
||||
from .order_line_models import Order_Line_Base
|
||||
from .person_models import Person_Base
|
||||
from .user_models import User_Base
|
||||
|
||||
|
||||
class Order_Cfg_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
account_name: Optional[str]
|
||||
|
||||
default_no_reply_email: Optional[str]
|
||||
default_no_reply_name: Optional[str]
|
||||
confirm_email: Optional[str]
|
||||
confirm_name: Optional[str]
|
||||
|
||||
order_header: Optional[str]
|
||||
order_thanks: Optional[str]
|
||||
order_message: Optional[str]
|
||||
order_footer: Optional[str]
|
||||
order_fundraising_thanks: Optional[str]
|
||||
order_fundraising_message: Optional[str]
|
||||
|
||||
|
||||
# class Order_Line_Base(BaseModel):
|
||||
# log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# log.debug(locals())
|
||||
|
||||
# id_random: Optional[str] = Field(
|
||||
# **base_fields['order_line_id_random'],
|
||||
# alias = 'order_line_id_random',
|
||||
# default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
# )
|
||||
# id: Optional[int] = Field(
|
||||
# #alias = 'order_line_id'
|
||||
# )
|
||||
# #order_line_id_random: Optional[str]
|
||||
# order_id_random: Optional[str]
|
||||
# order_id: Optional[int]
|
||||
# product_id_random: str
|
||||
# product_id: Optional[int]
|
||||
# product_type_id: Optional[int]
|
||||
# product_type: Optional[str]
|
||||
# name: Optional[str]
|
||||
# description: Optional[str]
|
||||
# quantity: int = Field(0, ge=0, lt=150)
|
||||
# amount: int = Field(0, ge=0, lt=1500000)
|
||||
# recurring: Optional[bool] = False
|
||||
# message: Optional[str]
|
||||
# notes: Optional[str]
|
||||
# created_on: Optional[datetime.datetime] = None
|
||||
# updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
# _processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
# #@validator('order_line_id_random', always=True)
|
||||
# def order_line_id_random_copy(cls, v, values, **kwargs):
|
||||
# log.setLevel(logging.WARNING)
|
||||
# log.debug(locals())
|
||||
|
||||
# if values['id_random']:
|
||||
# return values['id_random']
|
||||
# return None
|
||||
|
||||
# @validator('id', always=True)
|
||||
# def order_line_id_lookup(cls, v, values, **kwargs):
|
||||
# log.setLevel(logging.WARNING)
|
||||
# log.debug(locals())
|
||||
|
||||
# if values['id_random']:
|
||||
# log.debug(values['id_random'])
|
||||
# return redis_lookup_id_random(record_id_random=values['id_random'], table_name='order_line')
|
||||
# return None
|
||||
|
||||
# @validator('order_id', always=True)
|
||||
# def order_id_lookup(cls, v, values, **kwargs):
|
||||
# log.setLevel(logging.WARNING)
|
||||
# log.debug(locals())
|
||||
|
||||
# if values['order_id_random']:
|
||||
# return redis_lookup_id_random(record_id_random=values['order_id_random'], table_name='order')
|
||||
# return None
|
||||
|
||||
# @validator('product_id', always=True)
|
||||
# def product_id_lookup(cls, v, values, **kwargs):
|
||||
# log.setLevel(logging.WARNING)
|
||||
# log.debug(locals())
|
||||
|
||||
# if values['product_id_random']:
|
||||
# return redis_lookup_id_random(record_id_random=values['product_id_random'], table_name='product')
|
||||
# return None
|
||||
|
||||
# class Config:
|
||||
# underscore_attrs_are_private = True
|
||||
# fields = base_fields
|
||||
from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
from app.models.order_cfg_models import Order_Cfg_Base
|
||||
from app.models.order_line_models import Order_Line_Base
|
||||
from app.models.person_models import Person_Base
|
||||
from app.models.user_models import User_Base
|
||||
|
||||
|
||||
class Order_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
# from .person_models import Person_Base
|
||||
# from .user_models import User_Base
|
||||
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['order_id_random'],
|
||||
alias = 'order_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
#alias = 'order_id'
|
||||
alias = 'order_id'
|
||||
)
|
||||
#order_id_random: Optional[str]
|
||||
#order_id: Optional[int]
|
||||
|
||||
account_id_random: Optional[str]
|
||||
account_id: Optional[int] # NOTE: This is not really optional
|
||||
|
||||
person_id_random: Optional[str]
|
||||
person_id: Optional[int]
|
||||
|
||||
user_id_random: Optional[str]
|
||||
user_id: Optional[int]
|
||||
|
||||
total_quantity: Optional[int] = Field(0, ge=0, lt=150)
|
||||
total_bill: Optional[int] = Field(0, ge=0, lt=1500000) # NOTE: This is total_amount in the order_cart
|
||||
total_paid: Optional[int] = Field(0, ge=0, lt=1500000)
|
||||
balance: Optional[int] = Field(0, ge=-1500000, lt=1500000) # Balance needs to be calculated
|
||||
status: Optional[str]
|
||||
|
||||
notes: Optional[str]
|
||||
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ class Product_Base(BaseModel):
|
||||
|
||||
# NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
|
||||
# NOTE need to check @validator NOTE NOTE NOTE NOTE
|
||||
# This is essentially what the product is paying for
|
||||
for_type: Optional[str]
|
||||
for_id_random: Optional[str]
|
||||
for_id: Optional[int]
|
||||
|
||||
Reference in New Issue
Block a user