Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 2 additions & 3 deletions src/app/api/volunteer/details/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SHEET_COLUMNS,
SHEET_TAB,
} from "@/app/toronto/volunteer/build-the-vote";
import { sheetTimestamp, upsertSheetRow } from "@/lib/google-sheet";
import { upsertSheetRow } from "@/lib/google-sheet";

// Build the Vote step 2: optional details, added to the volunteer's row in the
// Sheet shared with CJPAC. The row is found by the email step 1's response put
Expand Down Expand Up @@ -36,9 +36,8 @@ export async function POST(req: NextRequest) {
email,
values: {
Availability: availability.join(", "),
"Mayoral candidate": mayoral,
"Mayoral Candidate": mayoral,
Issues: issues,
"Details added at": sheetTimestamp(),
},
});

Expand Down
16 changes: 6 additions & 10 deletions src/app/api/volunteer/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { NextRequest, NextResponse } from "next/server";
import {
DETAILS_API_PATH,
EMAIL_COOKIE,
PARTNER_SOURCE,
SHEET_COLUMNS,
SHEET_TAB,
} from "@/app/toronto/volunteer/build-the-vote";
Expand Down Expand Up @@ -57,16 +56,13 @@ export async function POST(req: NextRequest) {
columns: SHEET_COLUMNS,
email,
values: {
"Signed up at": sheetTimestamp(),
"First name": firstName,
"Last name": lastName,
"Submitted At": sheetTimestamp(),
"First Name": firstName,
"Last Name": lastName,
Phone: phone,
City: city,
"Postal code": postalCode,
Source: str(body.utm_source, 100),
Medium: str(body.utm_medium, 100),
Campaign: str(body.utm_campaign, 100),
Partner: PARTNER_SOURCE,
"Postal Code": postalCode,
// Submitting the form is consent; the form says so above the button.
"Consent to share with CJPAC": "Yes",
},
});

Expand Down
22 changes: 6 additions & 16 deletions src/app/toronto/volunteer/build-the-vote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,21 @@ export const VOLUNTEER_PATH = "/toronto/volunteer";
export const STEP_2_PATH = `${VOLUNTEER_PATH}/step-2`;
export const THANKS_PATH = `${VOLUNTEER_PATH}/thanks`;

/** Written to every row's Partner column so CJPAC can tell our sign-ups from
* those of their other partners. Not the visitor's own utm_source, which goes
* in the Source column. */
export const PARTNER_SOURCE = "buildcanada";

/** The tab of CJPAC's Sheet that sign-ups are written to, and the header row
* it starts with if empty. Values are matched to columns by these names, so
* renaming one in the Sheet means renaming it here too. */
export const SHEET_TAB = "Sign-ups";
export const SHEET_COLUMNS = [
"Signed up at",
"First name",
"Last name",
"Submitted At",
"First Name",
"Last Name",
"Email",
"Phone",
"City",
"Postal code",
"Postal Code",
"Availability",
"Mayoral candidate",
"Mayoral Candidate",
"Issues",
"Details added at",
"Source",
"Medium",
"Campaign",
"Partner",
"Consent to share with CJPAC",
] as const;

/** Set by step 1's API response so step 2 can add to the right row without
Expand Down
Loading