More again again again again. Moving ID random generation to the SQL db instead. General clean up.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
@@ -19,7 +18,6 @@ class Account_Cfg_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['account_cfg_id_random'],
|
||||
alias = 'account_cfg_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'account_cfg_id'
|
||||
@@ -146,5 +144,3 @@ class Account_Cfg_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
#Account_Cfg_Base.update_forward_refs()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
import datetime, pytz
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
@@ -10,6 +9,7 @@ from app.lib_general import log, logging
|
||||
from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
|
||||
|
||||
# ### BEGIN ### API Activity Log Models ### Activity_Log_Base() ###
|
||||
class Activity_Log_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -17,7 +17,6 @@ class Activity_Log_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['activity_log_id_random'],
|
||||
alias = 'activity_log_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'activity_log_id'
|
||||
@@ -124,5 +123,4 @@ class Activity_Log_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
#Activity_Log_Base.update_forward_refs()
|
||||
# ### END ### API Activity Log Models ### Activity_Log_Base() ###
|
||||
|
||||
@@ -18,7 +18,6 @@ class Cont_Edu_Cert_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['cont_edu_cert_id_random'],
|
||||
alias = 'cont_edu_cert_id_random',
|
||||
# default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'cont_edu_cert_id'
|
||||
|
||||
@@ -20,7 +20,6 @@ class Cont_Edu_Cert_Person_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['cont_edu_cert_person_id_random'],
|
||||
alias = 'cont_edu_cert_person_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'cont_edu_cert_person_id'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
import datetime, pytz
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
@@ -7,17 +6,18 @@ from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationEr
|
||||
from app.db_sql import redis_lookup_id_random
|
||||
from app.lib_general import log, logging
|
||||
|
||||
from .common_field_schema import base_fields, default_num_bytes
|
||||
from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
|
||||
#from .event_models import Event_Base
|
||||
from .event_person_models import Event_Person_Base
|
||||
from .event_presentation_models import Event_Presentation_Base
|
||||
#from .event_presenter_models import Event_Presenter_Base # This creates an import loop
|
||||
from .event_session_models import Event_Session_Base
|
||||
from .event_track_models import Event_Track_Base
|
||||
from .person_models import Person_Base
|
||||
#from app.models.event_models import Event_Base
|
||||
from app.models.event_person_models import Event_Person_Base
|
||||
from app.models.event_presentation_models import Event_Presentation_Base
|
||||
#from app.models.event_presenter_models import Event_Presenter_Base # This creates an import loop
|
||||
from app.models.event_session_models import Event_Session_Base
|
||||
from app.models.event_track_models import Event_Track_Base
|
||||
from app.models.person_models import Person_Base
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Abstract Models ### Event_Abstract_Base() ###
|
||||
class Event_Abstract_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -25,7 +25,6 @@ class Event_Abstract_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['event_abstract_id_random'],
|
||||
alias = 'event_abstract_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_abstract_id'
|
||||
@@ -174,5 +173,4 @@ class Event_Abstract_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
#Event_Abstract_Base.update_forward_refs()
|
||||
# ### END ### API Event Abstract Models ### Event_Abstract_Base() ###
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
import datetime, pytz
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
@@ -11,6 +10,7 @@ from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
from app.models.event_registration_cfg_models import Event_Registration_Cfg_Base
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Registration Models ### Event_Registration_Base() ###
|
||||
class Event_Registration_Base(BaseModel):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -18,7 +18,6 @@ class Event_Registration_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['event_registration_id_random'],
|
||||
alias = 'event_registration_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_registration_id'
|
||||
@@ -117,5 +116,4 @@ class Event_Registration_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
Event_Registration_Base.update_forward_refs()
|
||||
# ### END ### API Event Registration Models ### Event_Registration_Base() ###
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
import datetime, pytz
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
@@ -17,7 +16,6 @@ class Fundraising_Cfg_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['fundraising_cfg_id_random'],
|
||||
alias = 'fundraising_cfg_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
#alias = 'fundraising_cfg_id'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
import datetime, pytz
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
@@ -10,6 +9,7 @@ from app.lib_general import log, logging
|
||||
from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
|
||||
|
||||
# ### BEGIN ### API Log Client Viewing Models ### Log_Client_Viewing_Base() ###
|
||||
class Log_Client_Viewing_Base(BaseModel):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -17,7 +17,6 @@ class Log_Client_Viewing_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['log_client_viewing_id_random'],
|
||||
alias = 'log_client_viewing_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'log_client_viewing_id'
|
||||
@@ -146,3 +145,4 @@ class Log_Client_Viewing_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
# ### END ### API Log Client Viewing Models ### Log_Client_Viewing_Base() ###
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
@@ -7,7 +6,7 @@ from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationEr
|
||||
from app.db_sql import redis_lookup_id_random
|
||||
from app.lib_general import *
|
||||
|
||||
from .common_field_schema import base_fields, default_num_bytes
|
||||
from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
|
||||
|
||||
class Order_Cart_Line_Base(BaseModel):
|
||||
@@ -17,7 +16,6 @@ class Order_Cart_Line_Base(BaseModel):
|
||||
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'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
@@ -19,7 +18,6 @@ class Order_Cart_DB_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['order_cart_id_random'],
|
||||
alias = 'order_cart_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'order_cart_id'
|
||||
@@ -111,7 +109,6 @@ class Order_Cart_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['order_cart_id_random'],
|
||||
alias = 'order_cart_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'order_cart_id'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
import datetime, pytz
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
@@ -14,6 +13,7 @@ from app.models.contact_models import Contact_Base
|
||||
# from app.models.user_models import User_Base
|
||||
|
||||
|
||||
# ### BEGIN ### API Organization Models ### Organization_Base() ###
|
||||
class Organization_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -21,7 +21,6 @@ class Organization_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['organization_id_random'],
|
||||
alias = 'organization_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
#alias = 'organization_id'
|
||||
@@ -125,8 +124,4 @@ class Organization_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
#if TYPE_CHECKING:
|
||||
#from .supporting_core_models import Address_Base, Contact_Base, Person_Base, User_Base
|
||||
|
||||
Organization_Base.update_forward_refs()
|
||||
# ### END ### API Organization Models ### Organization_Base() ###
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from __future__ import annotations
|
||||
import datetime, hashlib, logging, os, pytz, redis, secrets
|
||||
import datetime, pytz
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
@@ -10,6 +9,7 @@ from app.lib_general import *
|
||||
from .common_field_schema import base_fields, default_num_bytes
|
||||
|
||||
|
||||
# ### BEGIN ### API Product Models ### Product_Base() ###
|
||||
class Product_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -17,7 +17,6 @@ class Product_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['product_id_random'],
|
||||
alias = 'product_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'product_id'
|
||||
@@ -104,5 +103,4 @@ class Product_Base(BaseModel):
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
fields = base_fields
|
||||
|
||||
Product_Base.update_forward_refs()
|
||||
# ### END ### API Product Models ### Product_Base() ###
|
||||
|
||||
Reference in New Issue
Block a user