diff --git a/backend/core/api/public/endpoints/Invoices/edit.py b/backend/core/api/public/endpoints/Invoices/edit.py index c888550c..ada5aef1 100644 --- a/backend/core/api/public/endpoints/Invoices/edit.py +++ b/backend/core/api/public/endpoints/Invoices/edit.py @@ -1,4 +1,6 @@ from datetime import datetime +from typing import Literal + from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response @@ -72,7 +74,7 @@ def edit_invoice_endpoint(request: APIRequest): @api_view(["POST"]) def change_status_endpoint(request, invoice_id: int, invoice_status: str): - invoice_status = invoice_status.lower() if invoice_status else "" + invoice_status: Literal["paid", "draft", "pending"] = invoice_status.lower() if invoice_status else "" try: invoice = Invoice.objects.get(id=invoice_id) diff --git a/backend/finance/api/invoices/edit.py b/backend/finance/api/invoices/edit.py index d28d32b3..1c9be2ec 100644 --- a/backend/finance/api/invoices/edit.py +++ b/backend/finance/api/invoices/edit.py @@ -1,4 +1,5 @@ from datetime import datetime +from typing import Literal from django.contrib import messages from django.http import HttpRequest, JsonResponse, HttpResponse @@ -76,7 +77,7 @@ def edit_invoice(request: HtmxHttpRequest): @require_POST @web_require_scopes("invoices:write", True, True) def change_status(request: HtmxHttpRequest, invoice_id: int, status: str) -> HttpResponse: - status = status.lower() if status else "" + status: Literal["paid", "draft", "pending"] = status.lower() if status else "" if not request.htmx: return redirect("finance:invoices:single:dashboard")