Updates to start using the new Journals module.
This commit is contained in:
@@ -25,11 +25,28 @@ class Journal_Entry_Base(BaseModel):
|
||||
journal_id_random: Optional[str]
|
||||
journal_id: Optional[int]
|
||||
|
||||
external_id: Optional[str] # ID generated by external system (should be stable and not change)
|
||||
import_id: Optional[str] # Used for import purposes to track the source of the data
|
||||
code: Optional[str]
|
||||
|
||||
for_type: Optional[str] # 'person', 'user', 'account', etc
|
||||
for_id: Optional[int]
|
||||
for_id_random: Optional[str]
|
||||
|
||||
name: Optional[str]
|
||||
summary: Optional[str]
|
||||
outline: Optional[str]
|
||||
|
||||
content: Optional[str]
|
||||
content_html: Optional[str]
|
||||
content_json: Optional[Union[Json, None]]
|
||||
|
||||
start_datetime: Optional[datetime.datetime]
|
||||
end_datetime: Optional[datetime.datetime]
|
||||
timezone: Optional[str] # = 'UTC' # Default to UTC
|
||||
|
||||
alert: Optional[bool] = False
|
||||
alert_msg: Optional[str] = None
|
||||
|
||||
private: Optional[bool] = True
|
||||
public: Optional[bool] = False
|
||||
@@ -41,7 +58,12 @@ class Journal_Entry_Base(BaseModel):
|
||||
archive_on: Optional[datetime.datetime]
|
||||
archive: Optional[bool]
|
||||
|
||||
data_json: Optional[Json]
|
||||
data_json: Optional[Union[Json, None]] # Used to store additional data for the journal
|
||||
|
||||
passcode_read: Optional[str] # Used to read the journal entry
|
||||
passcode_read_expire: Optional[int] # Number of seconds to expire the read passcode
|
||||
passcode_write: Optional[str] # Used to write to the journal entry
|
||||
passcode_write_expire: Optional[int] # Number of seconds to expire the write passcode
|
||||
|
||||
enable: Optional[bool]
|
||||
hide: Optional[bool]
|
||||
@@ -53,25 +75,24 @@ class Journal_Entry_Base(BaseModel):
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
# Including other related objects
|
||||
# This is only for convenience. Probably going to keep unless it causes a problem.
|
||||
file_count: Optional[int]
|
||||
|
||||
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
|
||||
|
||||
@validator('id', always=True)
|
||||
def journal_entry_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['id_random']:
|
||||
log.debug(values['id_random'])
|
||||
return redis_lookup_id_random(record_id_random=values['id_random'], table_name='journal_entry')
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='journal_entry')
|
||||
return None
|
||||
|
||||
@validator('journal_id', always=True)
|
||||
def journal_id_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.WARNING)
|
||||
log.debug(locals())
|
||||
|
||||
if values['journal_id_random']:
|
||||
return redis_lookup_id_random(record_id_random=values['journal_id_random'], table_name='journal')
|
||||
if isinstance(v, int) and v > 0: return v
|
||||
elif id_random := values.get('journal_id_random'):
|
||||
return redis_lookup_id_random(record_id_random=id_random, table_name='journal')
|
||||
return None
|
||||
|
||||
class Config:
|
||||
|
||||
Reference in New Issue
Block a user