Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(todo): enhance todo functionality and error handling #198

Merged
merged 15 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions web/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,16 @@ def post(self, request):
title = data.get('title')
description = data.get('description')
project = data.get('project')

if not title:
return Response({"status": False, "error": "Title is required."}, status=400)
if scan_history_id is None:
return Response({"status": False, "error": "Scan history is required."}, status=400)
if subdomain_id is None:
return Response({"status": False, "error": "Subdomain is required."}, status=400)
if not project:
return Response({"status": False, "error": "Project is required."}, status=400)


try:
project = Project.objects.get(slug=project)
Expand All @@ -608,12 +618,10 @@ def post(self, request):

note.project = project
note.save()
response = {'status': True}
return Response({"status": True, "error": False, "id": note.id}, status=200)
except Exception as e:
response = {'status': False, 'message': str(e)}

return Response(response)

logger.error(e)
return Response({"status": False, "error": "An error occurred."}, status=400)

class ToggleSubdomainImportantStatus(APIView):
def post(self, request):
Expand Down
Loading
Loading