Skip to content

Commit

Permalink
Merge pull request #1382 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
[fix] remve exceptions
  • Loading branch information
adnankattekaden authored Oct 19, 2023
2 parents 2c0d9c8 + a3043c8 commit fb7352e
Show file tree
Hide file tree
Showing 10 changed files with 1,111 additions and 638 deletions.
469 changes: 263 additions & 206 deletions api/dashboard/location/location_views.py

Large diffs are not rendered by default.

25 changes: 8 additions & 17 deletions api/dashboard/organisation/organisation_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def post(self, request):
"user_id": user_id
}
)

if serializer.is_valid():
serializer.save()

Expand Down Expand Up @@ -80,6 +81,7 @@ def put(self, request, org_code):
"user_id": user_id
}
)

if serializer.is_valid():
serializer.save()

Expand Down Expand Up @@ -430,15 +432,10 @@ def post(self, request):

@role_required([RoleType.ADMIN.value])
def put(self, request, department_id):
try:
department = Department.objects.get(
id=department_id
)

except Exception as e:
return CustomResponse(
general_message=str(e)
).get_failure_response()
department = Department.objects.get(
id=department_id
)

serializer = DepartmentSerializer(
department,
Expand All @@ -461,15 +458,9 @@ def put(self, request, department_id):
@role_required([RoleType.ADMIN.value])
def delete(self, request, department_id):

try:
department = Department.objects.get(
id=department_id
)

except Exception as e:
return CustomResponse(
general_message=str(e)
).get_failure_response()
department = Department.objects.get(
id=department_id
)

department.delete()
return CustomResponse(
Expand Down
Loading

0 comments on commit fb7352e

Please sign in to comment.