Skip to content

Commit

Permalink
fix: mypy issue with previous invoice_statuses
Browse files Browse the repository at this point in the history
Signed-off-by: Trey <[email protected]>
  • Loading branch information
TreyWW committed Nov 8, 2024
1 parent 2c8d0b6 commit 1df1324
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/core/api/public/endpoints/Invoices/edit.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion backend/finance/api/invoices/edit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from datetime import datetime
from typing import Literal

from django.contrib import messages
from django.http import HttpRequest, JsonResponse, HttpResponse
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 1df1324

Please sign in to comment.