test application updated@build living space
This commit is contained in:
@@ -139,7 +139,6 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
def create_action(cls, create_user: InsertUsers):
|
||||
found_person = People.filter_one(
|
||||
People.uu_id == create_user.people_uu_id,
|
||||
*People.valid_record_args(People),
|
||||
).data
|
||||
if not found_person:
|
||||
raise HTTPException(status_code=400, detail="Person not found.")
|
||||
@@ -164,14 +163,19 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
@classmethod
|
||||
def credentials(cls):
|
||||
person_object = People.filter_by_one(system=True, id=cls.person_id).data
|
||||
if not person_object:
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="Person not found. Please contact the admin.",
|
||||
)
|
||||
# if not person_object:
|
||||
# raise HTTPException(
|
||||
# status_code=401,
|
||||
# detail="Person not found. Please contact the admin.",
|
||||
# )
|
||||
if person_object:
|
||||
return {
|
||||
"person_id": person_object.id,
|
||||
"person_uu_id": str(person_object.uu_id),
|
||||
}
|
||||
return {
|
||||
"person_id": person_object.id,
|
||||
"person_uu_id": str(person_object.uu_id),
|
||||
"person_id": None,
|
||||
"person_uu_id": None,
|
||||
}
|
||||
|
||||
def get_employee_and_duty_details(self):
|
||||
@@ -179,7 +183,6 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
|
||||
found_person = People.filter_one(
|
||||
People.id==self.person_id,
|
||||
*People.valid_record_args(People),
|
||||
)
|
||||
found_employees = Employees.filter_by_active(
|
||||
people_id=found_person.id, is_confirmed=True
|
||||
@@ -460,9 +463,6 @@ class Addresses(CrudCollection):
|
||||
post_code_list = RelationshipEmployee2PostCode.filter_all(
|
||||
RelationshipEmployee2PostCode.employee_id
|
||||
== token_dict.selected_company.employee_id,
|
||||
*RelationshipEmployee2PostCode.valid_record_args(
|
||||
RelationshipEmployee2PostCode
|
||||
),
|
||||
).data
|
||||
post_code_id_list = [post_code.member_id for post_code in post_code_list]
|
||||
if not post_code_id_list:
|
||||
@@ -471,7 +471,7 @@ class Addresses(CrudCollection):
|
||||
detail="User has no post code registered. User can not list addresses.",
|
||||
)
|
||||
cls.pre_query = cls.filter_all(
|
||||
cls.post_code_id.in_(post_code_id_list), cls.valid_record_args(cls)
|
||||
cls.post_code_id.in_(post_code_id_list)
|
||||
).query
|
||||
filter_cls = cls.filter_all(*filter_expr or [])
|
||||
cls.pre_query = None
|
||||
|
||||
Reference in New Issue
Block a user