Working on all the routes, methods, and models.
This commit is contained in:
@@ -5,9 +5,9 @@ from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
|
||||
from app.db_sql import redis_lookup_id_random
|
||||
from app.lib_general import *
|
||||
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
|
||||
|
||||
|
||||
class Journal_Entry_Base(BaseModel):
|
||||
@@ -16,11 +16,11 @@ class Journal_Entry_Base(BaseModel):
|
||||
|
||||
id_random: Optional[str] = Field(
|
||||
**base_fields['journal_entry_id_random'],
|
||||
alias='journal_entry_id_random',
|
||||
default_factory=lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
alias = 'journal_entry_id_random',
|
||||
default_factory = lambda:secrets.token_urlsafe(default_num_bytes),
|
||||
)
|
||||
id: Optional[int] = Field(
|
||||
#alias='journal_entry_id'
|
||||
alias = 'journal_entry_id'
|
||||
)
|
||||
|
||||
title: Optional[str]
|
||||
@@ -32,8 +32,9 @@ class Journal_Entry_Base(BaseModel):
|
||||
personal: Optional[bool] = True
|
||||
professional: Optional[bool] = False
|
||||
|
||||
hide: Optional[int]
|
||||
priority: Optional[int]
|
||||
enable: Optional[bool]
|
||||
hide: Optional[bool]
|
||||
priority: Optional[bool]
|
||||
sort: Optional[int]
|
||||
group: Optional[str]
|
||||
|
||||
@@ -43,15 +44,6 @@ class Journal_Entry_Base(BaseModel):
|
||||
|
||||
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
#@validator('journal_entry_id_random', always=True)
|
||||
def journal_entry_id_random_copy(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['id_random']:
|
||||
return values['id_random']
|
||||
return None
|
||||
|
||||
@validator('id', always=True)
|
||||
def journal_entry_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
|
||||
Reference in New Issue
Block a user