More again again again. 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
|
||||
@@ -6,9 +6,10 @@ 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
|
||||
|
||||
|
||||
# ### BEGIN ### API Hosted File Models ### Hosted_File_Base() ###
|
||||
class Hosted_File_Base(BaseModel):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -16,7 +17,7 @@ class Hosted_File_Base(BaseModel):
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['hosted_file_id_random'],
|
||||
alias = 'hosted_file_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 = 'hosted_file_id'
|
||||
@@ -88,5 +89,4 @@ class Hosted_File_Base(BaseModel):
|
||||
class Config:
|
||||
underscore_attrs_are_private = True
|
||||
fields = base_fields
|
||||
|
||||
Hosted_File_Base.update_forward_refs()
|
||||
# ### END ### API Hosted File Models ### Hosted_File_Base() ###
|
||||
|
||||
Reference in New Issue
Block a user