Files
OSIT-AE-API-FastAPI/app/models/event_badge_template_models.py
Scott Idem 802c75bad9 V3: Standardize Primary AE Objects and Synchronize Search Whitelists.
- Synchronized searchable_fields (V3 whitelists) across all Primary and Active AE objects (Identity, People, Events, Journals, Posts, Archives, Business).
- Standardized Pydantic models for core objects to include the 10 common fields (id, id_random, enable, hide, priority, sort, group, notes, created_on, updated_on).
- Fixed field aliases and uncommented valid database columns in User_Base and Organization_Base.
- Pruned non-existent fields from searchable lists in legacy or config-specific definitions (account_cfg, user_role, log_client_viewing).
- Added system discovery and validation tools:
    - ae_object_info.py: AE object status and metadata browser.
    - export_all_interfaces.py: E2E TypeScript interface generator.
    - Verification scripts for searchable field consistency.
- Updated Jan 8 milestone progress and platform roadmap in GEMINI.md.
2026-01-08 12:24:34 -05:00

135 lines
3.7 KiB
Python

import datetime, pytz
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 log, logging
from app.models.common_field_schema import base_fields, default_num_bytes
class Event_Badge_Template_Base(BaseModel):
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
# log.info('Using base template')
id_random: Optional[str] = Field(
**base_fields['event_badge_template_id_random'],
alias = 'event_badge_template_id_random',
)
id: Optional[int] = Field(
alias = 'event_badge_template_id'
)
# account_id_random: Optional[str]
# account_id: Optional[int]
event_id_random: Optional[str]
event_id: Optional[int]
name: Optional[str]
description: Optional[str]
logo_filename: Optional[str]
logo_path: Optional[str]
header_path: Optional[str] # Path to image file
header_row_1: Optional[str]
header_row_2: Optional[str]
header_background: Optional[str]
secondary_header_path: Optional[str] # Path to image file for back of badge and other sections
footer_path: Optional[str] # Path to image file
footer_title: Optional[str]
footer_left: Optional[str]
footer_right: Optional[str]
footer_background: Optional[str]
badge_type_list: Optional[Json]
ticket_list: Optional[Json]
ticket_1_text: Optional[str]
ticket_2_text: Optional[str]
ticket_3_text: Optional[str]
ticket_4_text: Optional[str]
ticket_5_text: Optional[str]
ticket_6_text: Optional[str]
ticket_7_text: Optional[str]
ticket_8_text: Optional[str]
wireless_ssid: Optional[str]
wireless_password: Optional[str]
show_qr_front: Optional[bool]
show_qr_back: Optional[bool]
# Layouts:
# 4x3_pcnametag_N2TIC_tickets, 4.25x6_pcnametag_NS2VWB_badge_only
# 4x3_custom_receipt_tickets, 4.25x6_custom_receipt_tickets
layout: Optional[str]
style_filename: Optional[str]
style_href: Optional[str]
script_src: Optional[str]
passcode: Optional[str]
other_json: Optional[str]
enable: Optional[bool]
notes: Optional[str]
created_on: Optional[datetime.datetime] = None
updated_on: Optional[datetime.datetime] = None
_processed_at: datetime.datetime = PrivateAttr(default_factory=datetime.datetime.now)
@validator('id', always=True)
def event_badge_template_id_lookup(cls, v, values, **kwargs):
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='event_badge_template')
return None
@validator('event_id', always=True)
def event_id_lookup(cls, v, values, **kwargs):
if isinstance(v, int) and v > 0: return v
elif id_random := values.get('event_id_random'):
return redis_lookup_id_random(record_id_random=id_random, table_name='event')
return None
class Config:
underscore_attrs_are_private = True
allow_population_by_field_name = True
fields = base_fields
class Event_Badge_Template_Base_In(Event_Badge_Template_Base):
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
# log.info('Using In template')
badge_type_list: Optional[str]
class Event_Badge_Template_Base_Out(Event_Badge_Template_Base):
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
# log.info('Using Out template')
# badge_type_list: Optional[Json]