feat: add 404 response for missing company or person in Didox API
This commit is contained in:
@@ -31,7 +31,6 @@ class DidoxCompanyInfoAPIView(GenericAPIView):
|
||||
def get(self, request, *args, **kwargs):
|
||||
tin = kwargs.get("tin")
|
||||
|
||||
# 🔥 TYPE CHECK
|
||||
try:
|
||||
tin = int(tin)
|
||||
except (TypeError, ValueError):
|
||||
@@ -48,4 +47,14 @@ class DidoxCompanyInfoAPIView(GenericAPIView):
|
||||
status=status.HTTP_502_BAD_GATEWAY
|
||||
)
|
||||
|
||||
# if both name and personalNum are null/empty -> 404
|
||||
name = data.get("name")
|
||||
personal_num = data.get("personalNum")
|
||||
|
||||
if not name and not personal_num:
|
||||
return Response(
|
||||
{"detail": "Company or person not found"},
|
||||
status=status.HTTP_404_NOT_FOUND
|
||||
)
|
||||
|
||||
return Response(data, status=status.HTTP_200_OK)
|
||||
Reference in New Issue
Block a user