first commit
This commit is contained in:
0
api_objects/auth/__init__.py
Normal file
0
api_objects/auth/__init__.py
Normal file
106
api_objects/auth/token_objects.py
Normal file
106
api_objects/auth/token_objects.py
Normal file
@@ -0,0 +1,106 @@
|
||||
import enum
|
||||
from typing import Optional, List, Any
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
# Company / Priority / Department / Duty / Employee / Occupant / Module / Endpoint are changeable dynamics
|
||||
|
||||
|
||||
class UserType(enum.Enum):
|
||||
|
||||
employee = 1
|
||||
occupant = 2
|
||||
|
||||
|
||||
class Credentials(BaseModel):
|
||||
|
||||
person_id: int
|
||||
person_name: str
|
||||
|
||||
|
||||
class ApplicationToken(BaseModel):
|
||||
# Application Token Object -> is the main object for the user
|
||||
|
||||
domain: Optional[str] = "app.evyos.com.tr"
|
||||
lang: Optional[str] = "TR"
|
||||
timezone: Optional[str] = "Europe/Istanbul"
|
||||
|
||||
user_type: int = UserType.occupant.value
|
||||
credentials: Credentials
|
||||
|
||||
user_uu_id: str
|
||||
user_id: int
|
||||
|
||||
person_id: int
|
||||
person_uu_id: str
|
||||
|
||||
request: Optional[dict] = {} # Request Info of Client
|
||||
|
||||
|
||||
class OccupantToken(BaseModel):
|
||||
# Selection of the occupant type for a build part is made by the user
|
||||
|
||||
living_space_id: int # Internal use
|
||||
living_space_uu_id: str # Outer use
|
||||
|
||||
occupant_type_id: int
|
||||
occupant_type_uu_id: str
|
||||
occupant_type: str
|
||||
|
||||
build_id: int
|
||||
build_uuid: str
|
||||
build_part_id: int
|
||||
build_part_uuid: str
|
||||
|
||||
reachable_event_list_id: Optional[list] = None # ID list of reachable modules
|
||||
reachable_event_list_uu_id: Optional[list] = None # UUID list of reachable modules
|
||||
|
||||
responsible_company_id: Optional[int] = None
|
||||
responsible_company_uuid: Optional[str] = None
|
||||
responsible_employee_id: Optional[int] = None
|
||||
responsible_employee_uuid: Optional[str] = None
|
||||
|
||||
|
||||
class CompanyToken(BaseModel): # Required Company Object for an employee
|
||||
|
||||
company_id: int
|
||||
company_uu_id: str
|
||||
|
||||
department_id: int # ID list of departments
|
||||
department_uu_id: str # ID list of departments
|
||||
|
||||
duty_id: int
|
||||
duty_uu_id: str
|
||||
|
||||
staff_id: int
|
||||
staff_uu_id: str
|
||||
|
||||
employee_id: int
|
||||
employee_uu_id: str
|
||||
|
||||
bulk_duties_id: int
|
||||
|
||||
reachable_event_list_id: Optional[list] = None # ID list of reachable modules
|
||||
reachable_event_list_uu_id: Optional[list] = None # UUID list of reachable modules
|
||||
|
||||
|
||||
class OccupantTokenObject(ApplicationToken):
|
||||
# Occupant Token Object -> Requires selection of the occupant type for a specific build part
|
||||
|
||||
available_occupants: dict = None
|
||||
|
||||
selected_occupant: Optional[OccupantToken] = {} # Selected Occupant Type
|
||||
available_event: Optional[Any] = None
|
||||
|
||||
|
||||
class EmployeeTokenObject(ApplicationToken):
|
||||
# Full hierarchy Employee[staff_id] -> Staff -> Duty -> Department -> Company
|
||||
|
||||
companies_id_list: List[int] # List of company objects
|
||||
companies_uu_id_list: List[str] # List of company objects
|
||||
|
||||
duty_id_list: List[int] # List of duty objects
|
||||
duty_uu_id_list: List[str] # List of duty objects
|
||||
|
||||
selected_company: Optional[CompanyToken] = {} # Selected Company Object
|
||||
available_event: Optional[Any] = None
|
||||
Reference in New Issue
Block a user