Skip to content

Commit

Permalink
Refactor API route and remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Devasy23 committed Mar 9, 2024
1 parent e479a14 commit dcff0d0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 105 deletions.
6 changes: 3 additions & 3 deletions API/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,12 @@ async def read_employee(EmployeeCode: int):
print(e)



@router.put("/update/{EmployeeCode}", response_model=str)
async def update_employees(EmployeeCode: int, Employee: UpdateEmployee):
"""
Update employee information based on the provided EmployeeCode.
Whenever user clicks on update employee button, in the frontend part, all the images will be visible - they can be deleted or new images can be added.
Whenever user clicks on update employee button, in the frontend part, all the images will be visible - they can be deleted or new images can be added.
Accordingly, the embeddings will be recalculated and updated in the database.
Args:
Expand Down Expand Up @@ -240,6 +239,7 @@ async def update_employees(EmployeeCode: int, Employee: UpdateEmployee):
except Exception as e:
raise HTTPException(status_code=500, detail="Internal server error")


# To delete employee record
@router.delete("/delete/{EmployeeCode}")
async def delete_employees(EmployeeCode: int):
Expand Down
Empty file removed route/__init__.py
Empty file.
100 changes: 0 additions & 100 deletions route/route.py

This file was deleted.

3 changes: 1 addition & 2 deletions testing/test_face_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
@patch("API.database.Database.find_one")
@patch("API.database.Database.find")
@patch("API.database.Database.insert_one")

def test_face_lifecycle(
mock_insert_one: MagicMock,
mock_find: MagicMock,
Expand Down Expand Up @@ -75,7 +74,7 @@ def test_face_lifecycle(

with open("./test-faces/devansh.jpg", "rb") as image_file:
encoded_string2 = base64.b64encode(image_file.read()).decode("utf-8")

# Update a face
response = client.put(
"/update/1",
Expand Down

0 comments on commit dcff0d0

Please sign in to comment.