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
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
|
||||
@@ -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
|
||||
@@ -8,9 +7,9 @@ from app.db_sql import redis_lookup_id_random
|
||||
from app.lib_general import log, logging
|
||||
|
||||
from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
# from app.models.account_models import Account_Base
|
||||
|
||||
|
||||
# ### BEGIN ### API Address Models ### Address_Base() ###
|
||||
class Address_Base(BaseModel):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -18,7 +17,7 @@ class Address_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['address_id_random'],
|
||||
alias = 'address_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
# default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'address_id'
|
||||
@@ -122,5 +121,4 @@ class Address_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
#Address_Base.update_forward_refs()
|
||||
# ### END ### API Address Models ### Address_Base() ###
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
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 +11,7 @@ from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
from app.models.address_models import Address_Base
|
||||
|
||||
|
||||
# ### BEGIN ### API Contact Models ### Contact_Base() ###
|
||||
class Contact_Base(BaseModel):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -18,7 +19,7 @@ class Contact_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['contact_id_random'],
|
||||
alias = 'contact_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
# default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'contact_id'
|
||||
@@ -179,5 +180,4 @@ class Contact_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
#Contact_Base.update_forward_refs()
|
||||
# ### END ### API Contact Models ### Contact_Base() ###
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
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
|
||||
@@ -18,7 +18,6 @@ class Event_Badge_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['event_badge_id_random'],
|
||||
alias = 'event_badge_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_badge_id'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
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
|
||||
@@ -16,7 +16,6 @@ class Event_Badge_Template_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['event_badge_template_id_random'],
|
||||
alias = 'event_badge_template_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_badge_template_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
|
||||
@@ -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 Cfg Models ### Event_Cfg_Base() ###
|
||||
class Event_Cfg_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -18,7 +18,6 @@ class Event_Cfg_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
# **base_fields['event_cfg_id_random'],
|
||||
alias = 'event_cfg_id_random',
|
||||
# default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_cfg_id'
|
||||
@@ -103,3 +102,4 @@ class Event_Cfg_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
# fields = base_fields
|
||||
# ### END ### API Event Cfg Models ### Event_Cfg_Base() ###
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
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 +10,7 @@ from app.models.common_field_schema import base_fields, default_num_bytes
|
||||
from app.models.event_cfg_models import Event_Cfg_Base
|
||||
from app.models.event_location_models import Event_Location_Base
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Device Models ### Event_Device_Base() ###
|
||||
class Event_Device_Base(BaseModel):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
@@ -18,7 +19,6 @@ class Event_Device_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['event_device_id_random'],
|
||||
alias = 'event_device_id_random',
|
||||
# default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_device_id'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
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
|
||||
@@ -8,9 +8,8 @@ from app.lib_general import log, logging
|
||||
|
||||
from .common_field_schema import base_fields, default_num_bytes
|
||||
|
||||
#from .event_models import Event_Base
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Location Models ### Event_Location_Base() ###
|
||||
class Event_Location_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -18,7 +17,6 @@ class Event_Location_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['event_location_id_random'],
|
||||
alias = 'event_location_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_location_id'
|
||||
@@ -121,5 +119,4 @@ class Event_Location_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
#Event_Location_Base.update_forward_refs()
|
||||
# ### END ### API Event Location Models ### Event_Location_Base() ###
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
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
|
||||
@@ -22,7 +22,6 @@ class Event_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['event_id_random'],
|
||||
alias = 'event_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_id'
|
||||
@@ -273,7 +272,7 @@ class Event_Meeting_Flat_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['event_id_random'],
|
||||
alias = 'event_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
# default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_id'
|
||||
|
||||
Reference in New Issue
Block a user