From 53a7cbaacd3763d5a887628c993acd47f6432d46 Mon Sep 17 00:00:00 2001 From: Willard Nilges Date: Fri, 29 Nov 2024 14:17:41 -0500 Subject: [PATCH] Move UUID to end of join record key (#137) * Move UUID to end of join record key * v2 -> v3 * Remove extra slash * Update sample data --- src/components/JoinForm/JoinForm.tsx | 2 +- src/lib/join_record.ts | 2 +- tests/util.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/JoinForm/JoinForm.tsx b/src/components/JoinForm/JoinForm.tsx index 1aea7d6..74ad009 100644 --- a/src/components/JoinForm/JoinForm.tsx +++ b/src/components/JoinForm/JoinForm.tsx @@ -192,7 +192,7 @@ export default function JoinForm() { let record: JoinRecord = Object.assign( structuredClone(joinFormSubmission), { - version: 2, + version: 3, uuid: self.crypto.randomUUID(), submission_time: new Date().toISOString(), code: null, diff --git a/src/lib/join_record.ts b/src/lib/join_record.ts index b5edb65..a34123f 100644 --- a/src/lib/join_record.ts +++ b/src/lib/join_record.ts @@ -48,7 +48,7 @@ class JoinRecordS3 { // - dev vs prod join record // - pre vs post-join form submission // - 2nd quartet of join record UUID (random but not too long) - const key = `${this.PREFIX}${preSubmission ? "/pre" : "/post"}/${joinRecord.uuid.split("-")[1]}/${submissionKey}.json`; + const key = `${this.PREFIX}/v3/${preSubmission ? "pre" : "post"}/${submissionKey}/${joinRecord.uuid.split("-")[1]}.json`; let body = JSON.stringify(joinRecord); diff --git a/tests/util.ts b/tests/util.ts index 9e6e0bb..01c0d72 100644 --- a/tests/util.ts +++ b/tests/util.ts @@ -36,7 +36,7 @@ export const sampleJoinRecord: JoinRecord = { referral: "Mock Sample Data", ncl: true, trust_me_bro: false, - version: 2, + version: 3, uuid: "1a55b949-0490-4b78-a2e8-10aea41d6f1d", submission_time: "2024-11-01T08:24:24", code: 201,