More again again again. Moving ID random generation to the SQL db instead. General clean up.
This commit is contained in:
@@ -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,9 +6,11 @@ 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 app.models.event_exhibit_tracking_models import Event_Exhibit_Tracking_Base
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Exhibit Models ### Event_Exhibit_Base() ###
|
||||
class Event_Exhibit_Base(BaseModel):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -17,7 +18,6 @@ class Event_Exhibit_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['event_exhibit_id_random'],
|
||||
alias = 'event_exhibit_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
alias = 'event_exhibit_id'
|
||||
@@ -153,5 +153,4 @@ class Event_Exhibit_Base(BaseModel):
|
||||
underscore_attrs_are_private = True
|
||||
allow_population_by_field_name = True
|
||||
fields = base_fields
|
||||
|
||||
Event_Exhibit_Base.update_forward_refs()
|
||||
# ### END ### API Event Exhibit Models ### Event_Exhibit_Base() ###
|
||||
|
||||
Reference in New Issue
Block a user