update events via wrapper routers
This commit is contained in:
@@ -138,6 +138,10 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
def is_occupant(self):
|
||||
return not str(self.email).split("@")[1] == Auth.ACCESS_EMAIL_EXT
|
||||
|
||||
@property
|
||||
def is_employee(self):
|
||||
return str(self.email).split("@")[1] == Auth.ACCESS_EMAIL_EXT
|
||||
|
||||
@property
|
||||
def password_expiry_ends(self):
|
||||
"""Calculates the expiry end date based on expiry begins and expires day"""
|
||||
@@ -165,8 +169,10 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
|
||||
@classmethod
|
||||
def create_action(cls, create_user: InsertUsers, token_dict):
|
||||
db_session = cls.new_session()
|
||||
found_person = People.filter_one(
|
||||
People.uu_id == create_user.people_uu_id,
|
||||
db=db_session,
|
||||
).data
|
||||
|
||||
if not found_person:
|
||||
@@ -192,7 +198,10 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
|
||||
@classmethod
|
||||
def credentials(cls):
|
||||
person_object = People.filter_by_one(system=True, id=cls.person_id).data
|
||||
db_session = cls.new_session()
|
||||
person_object = People.filter_by_one(
|
||||
db=db_session, system=True, id=cls.person_id
|
||||
).data
|
||||
if person_object:
|
||||
return {
|
||||
"person_id": person_object.id,
|
||||
@@ -206,17 +215,20 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
def get_employee_and_duty_details(self):
|
||||
from Schemas import Employees, Duties
|
||||
|
||||
db_session = self.new_session()
|
||||
found_person = People.filter_one(
|
||||
People.id == self.person_id,
|
||||
db=db_session,
|
||||
)
|
||||
found_employees = Employees.filter_by_active(
|
||||
people_id=found_person.id, is_confirmed=True
|
||||
people_id=found_person.id, is_confirmed=True, db=db_session
|
||||
)
|
||||
found_duties = Duties.filter_all(
|
||||
Duties.is_confirmed == True,
|
||||
Duties.id.in_(
|
||||
list(found_employee.duty_id for found_employee in found_employees.data)
|
||||
),
|
||||
db=db_session,
|
||||
)
|
||||
if not found_employees.count:
|
||||
raise HTTPException(
|
||||
|
||||
Reference in New Issue
Block a user