test application updated@build living space
This commit is contained in:
@@ -117,45 +117,37 @@ class AuthenticationSelectEventMethods(MethodToEvent):
|
||||
)
|
||||
if selected_company := Companies.filter_one(
|
||||
Companies.uu_id == data.company_uu_id,
|
||||
*Companies.valid_record_args(Companies),
|
||||
).data:
|
||||
department_ids = [
|
||||
department.id
|
||||
for department in Departments.filter_all(
|
||||
Departments.company_id == selected_company.id,
|
||||
*Departments.valid_record_args(Departments),
|
||||
).data
|
||||
]
|
||||
duties_ids = [
|
||||
duties.id
|
||||
for duties in Duties.filter_all(
|
||||
Duties.company_id == selected_company.id,
|
||||
Duties.department_id.in_(department_ids),
|
||||
*Duties.valid_record_args(Duties),
|
||||
).data
|
||||
]
|
||||
staff_ids = [
|
||||
staff.id
|
||||
for staff in Staff.filter_all(
|
||||
Staff.duties_id.in_(duties_ids),
|
||||
*Staff.valid_record_args(Staff),
|
||||
).data
|
||||
]
|
||||
employee = Employees.filter_one(
|
||||
Employees.people_id == token_dict.person_id,
|
||||
Employees.staff_id.in_(staff_ids),
|
||||
*Employees.valid_record_args(Employees),
|
||||
).data
|
||||
reachable_event_list_id, reachable_event_list_uu_id = (
|
||||
Event2Employee.get_event_id_by_employee_id(employee_id=employee.id)
|
||||
)
|
||||
staff = Staff.filter_one(
|
||||
Staff.id == employee.staff_id,
|
||||
*Staff.valid_record_args(Staff),
|
||||
).data
|
||||
duties = Duties.filter_one(
|
||||
Duties.id == staff.duties_id,
|
||||
*Duties.valid_record_args(Duties),
|
||||
).data
|
||||
department = Departments.filter_one(
|
||||
Departments.id == duties.department_id,
|
||||
@@ -212,27 +204,20 @@ class AuthenticationSelectEventMethods(MethodToEvent):
|
||||
)
|
||||
build = Build.filter_one(
|
||||
Build.id == build_part.build_id,
|
||||
*Build.valid_record_args(Build),
|
||||
).data
|
||||
related_company = RelationshipEmployee2Build.filter_one(
|
||||
RelationshipEmployee2Build.member_id == build.id,
|
||||
*RelationshipEmployee2Build.valid_record_args(
|
||||
RelationshipEmployee2Build
|
||||
),
|
||||
).data
|
||||
company_related = Companies.filter_one(
|
||||
Companies.id == related_company.company_id,
|
||||
*Companies.valid_record_args(Companies),
|
||||
).data
|
||||
responsible_employee = Employees.filter_one(
|
||||
Employees.id == related_company.employee_id,
|
||||
*Employees.valid_record_args(Employees),
|
||||
).data
|
||||
if selected_occupant_type := BuildLivingSpace.filter_one(
|
||||
BuildLivingSpace.occupant_type == occupant_type.id,
|
||||
BuildLivingSpace.person_id == token_dict.person_id,
|
||||
BuildLivingSpace.build_parts_id == build_part.id,
|
||||
*BuildLivingSpace.valid_record_args(BuildLivingSpace),
|
||||
).data:
|
||||
reachable_event_list_id, reachable_event_list_uu_id = (
|
||||
Event2Occupant.get_event_id_by_build_living_space_id(
|
||||
@@ -311,13 +296,11 @@ class AuthenticationRefreshEventMethods(MethodToEvent):
|
||||
if token_user := get_object_via_access_key(request=request):
|
||||
if found_user := Users.filter_one(
|
||||
Users.uu_id == token_user.get("uu_id"),
|
||||
*Users.valid_record_args(Users),
|
||||
).data:
|
||||
user_token = UsersTokens.filter_one(
|
||||
UsersTokens.domain == found_user.domain_name,
|
||||
UsersTokens.user_id == found_user.id,
|
||||
UsersTokens.token_type == "RememberMe",
|
||||
*UsersTokens.valid_record_args(UsersTokens),
|
||||
).data
|
||||
access_dict = {
|
||||
"access_token": access_token,
|
||||
@@ -353,7 +336,6 @@ class AuthenticationChangePasswordEventMethods(MethodToEvent):
|
||||
if token_dict.user_type == 1:
|
||||
if found_user := Users.filter_one(
|
||||
Users.uu_id == token_dict.person_uu_id,
|
||||
*Users.valid_record_args(Users),
|
||||
).data:
|
||||
if found_user.check_password(data.old_password):
|
||||
found_user.set_password(data.new_password)
|
||||
@@ -395,7 +377,6 @@ class AuthenticationCreatePasswordEventMethods(MethodToEvent):
|
||||
)
|
||||
found_user = Users.filter_one(
|
||||
Users.password_token == data.password_token,
|
||||
*Users.valid_record_args(Users),
|
||||
).data
|
||||
if not found_user:
|
||||
return JSONResponse(
|
||||
@@ -442,7 +423,6 @@ class AuthenticationDisconnectUserEventMethods(MethodToEvent):
|
||||
):
|
||||
found_user = Users.filter_one(
|
||||
Users.uu_id == token_dict.person_uu_id,
|
||||
*Users.valid_record_args(Users),
|
||||
).data
|
||||
if not found_user:
|
||||
return JSONResponse(
|
||||
|
||||
Reference in New Issue
Block a user