mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-06-27 22:03:58 +00:00
Fixed person api checking with database user for verification
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m15s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m15s
This commit is contained in:
22
api/tasks.py
22
api/tasks.py
@ -20,13 +20,29 @@ def verify_user_with_person_api_task(user_id: int):
|
||||
response = requests.get(f"{PERSON_API_URL}/api/person/{user.id_card}")
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
print(f"Data from Person API: {data}")
|
||||
print("Data from of user: ", user.__dict__)
|
||||
api_nic = data.get("nic")
|
||||
api_name = data.get("name_en")
|
||||
api_house_name = data.get("house_name_en")
|
||||
api_dob = data.get("dob")
|
||||
print(f"API nic: {api_nic}")
|
||||
print(f"API name: {api_name}")
|
||||
print(f"API house name: {api_house_name}")
|
||||
print(f"API dob: {api_dob}")
|
||||
|
||||
user_nic = user.id_card
|
||||
user_name = f"{user.first_name} {user.last_name}"
|
||||
user_house_name = user.address
|
||||
user_dob = user.dob.isoformat()
|
||||
|
||||
print(f"User nic: {user_nic}")
|
||||
print(f"User name: {user_name}")
|
||||
print(f"User house name: {user_house_name}")
|
||||
print(f"User dob: {user_dob}")
|
||||
if (
|
||||
data.get("nic") == user.id_card
|
||||
and data.get("name_en") == f"{user.first_name} {user.last_name}"
|
||||
and data.get("house_name_en") == user.address
|
||||
and data.get("dob") == user.dob.isoformat()
|
||||
and data.get("dob").split("T")[0] == user.dob.isoformat()
|
||||
):
|
||||
user.verified = True
|
||||
user.save()
|
||||
|
Reference in New Issue
Block a user