Moving ID random generation to the SQL db instead. General clean up.
This commit is contained in:
@@ -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() ###
|
||||
|
||||
Reference in New Issue
Block a user