Skip to content

Commit

Permalink
Fix UUID serialization in AIP endpoints
Browse files Browse the repository at this point in the history
This fixes the `List Unapproved Transfers` and `List SIPS Waiting for
User Input` API endpoints that were left behind after introducing the
Django 3.2 `UUIDField`.
  • Loading branch information
replaceafill committed Nov 16, 2023
1 parent da74000 commit c4d1b79
Show file tree
Hide file tree
Showing 3 changed files with 442 additions and 7 deletions.
24 changes: 19 additions & 5 deletions src/dashboard/src/components/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@

app_name = "api"
urlpatterns = [
re_path(r"transfer/approve", views.approve_transfer),
re_path(r"transfer/unapproved", views.unapproved_transfers),
re_path(r"transfer/approve", views.approve_transfer, name="approve_transfer"),
re_path(
r"transfer/unapproved", views.unapproved_transfers, name="unapproved_transfers"
),
re_path(
r"transfer/completed", views.completed_transfers, name="completed_transfers"
),
Expand All @@ -35,13 +37,20 @@
re_path(
r"transfer/start_transfer/", views.start_transfer_api, name="start_transfer"
),
re_path(r"transfer/reingest", views.reingest, {"target": "transfer"}),
re_path(
r"transfer/reingest",
views.reingest,
{"target": "transfer"},
name="transfer_reingest",
),
re_path(
r"ingest/status/(?P<unit_uuid>" + settings.UUID_REGEX + ")",
views.status,
{"unit_type": "unitSIP"},
),
re_path(r"ingest/waiting", views.waiting_for_user_input),
re_path(
r"ingest/waiting", views.waiting_for_user_input, name="waiting_for_user_input"
),
re_path(
r"^(?P<unit_type>transfer|ingest)/(?P<unit_uuid>"
+ settings.UUID_REGEX
Expand All @@ -52,7 +61,12 @@
re_path(
r"^ingest/reingest/approve", views.reingest_approve, name="reingest_approve"
),
re_path(r"^ingest/reingest", views.reingest, {"target": "ingest"}),
re_path(
r"^ingest/reingest",
views.reingest,
{"target": "ingest"},
name="ingest_reingest",
),
re_path(r"^ingest/completed", views.completed_ingests, name="completed_ingests"),
path("ingest/copy_metadata_files/", views.copy_metadata_files_api),
path(
Expand Down
8 changes: 6 additions & 2 deletions src/dashboard/src/components/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def waiting_for_user_input(request):
# TODO should this filter based on unit type into transfer vs SIP?
jobs = models.Job.objects.filter(currentstep=models.Job.STATUS_AWAITING_DECISION)
for job in jobs:
unit_uuid = job.sipuuid
unit_uuid = str(job.sipuuid)
directory = os.path.basename(os.path.normpath(job.directory))
unit_name = directory.replace("-" + unit_uuid, "", 1)

Expand Down Expand Up @@ -468,7 +468,11 @@ def unapproved_transfers(request):
)

unapproved.append(
{"type": transfer_type, "directory": job_directory, "uuid": job.sipuuid}
{
"type": transfer_type,
"directory": job_directory,
"uuid": str(job.sipuuid),
}
)

# get list of unapproved transfers
Expand Down
Loading

0 comments on commit c4d1b79

Please sign in to comment.