More again 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
|
||||
@@ -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