Fix registration API to accept simplified name/email-only form
- Update API route validation to only require name and email - Simplify RegistrationData interface - Keep sheet column layout unchanged for backward compatibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7524d34e46
commit
ca8f786fb0
|
|
@ -5,10 +5,10 @@ export async function POST(request: NextRequest) {
|
|||
try {
|
||||
const body = await request.json()
|
||||
|
||||
const { name, email, contact, contributions, expectations, howHeard, dietary, crewConsent, wantFood } = body
|
||||
const { name, email } = body
|
||||
|
||||
// Validate required fields
|
||||
if (!name || !email || !contact || !contributions || !expectations || !crewConsent) {
|
||||
if (!name || !email) {
|
||||
return NextResponse.json(
|
||||
{ error: "Missing required fields" },
|
||||
{ status: 400 }
|
||||
|
|
@ -22,13 +22,6 @@ export async function POST(request: NextRequest) {
|
|||
const rowNumber = await addRegistration({
|
||||
name,
|
||||
email,
|
||||
contact,
|
||||
contributions,
|
||||
expectations,
|
||||
howHeard: howHeard || "",
|
||||
dietary: Array.isArray(dietary) ? dietary.join(", ") : dietary || "",
|
||||
crewConsent,
|
||||
wantFood: wantFood || false,
|
||||
})
|
||||
|
||||
console.log(`[Register API] Registration added for ${name} at row ${rowNumber}`)
|
||||
|
|
|
|||
|
|
@ -18,13 +18,6 @@ const SHEET_NAME = process.env.GOOGLE_SHEET_NAME || "Registrations"
|
|||
export interface RegistrationData {
|
||||
name: string
|
||||
email?: string
|
||||
contact: string
|
||||
contributions: string
|
||||
expectations: string
|
||||
howHeard: string
|
||||
dietary: string
|
||||
crewConsent: string
|
||||
wantFood: boolean
|
||||
}
|
||||
|
||||
export interface PaymentUpdateData {
|
||||
|
|
@ -53,12 +46,12 @@ export async function addRegistration(data: RegistrationData): Promise<number> {
|
|||
timestamp, // A: Timestamp
|
||||
data.name, // B: Name
|
||||
data.email || "", // C: Email
|
||||
data.contact, // D: Contact
|
||||
data.contributions, // E: Contributions
|
||||
data.expectations, // F: Expectations
|
||||
data.howHeard || "", // G: How Heard
|
||||
data.dietary, // H: Dietary
|
||||
data.crewConsent, // I: Crew Consent
|
||||
"", // D: Contact (unused)
|
||||
"", // E: Contributions (unused)
|
||||
"", // F: Expectations (unused)
|
||||
"", // G: How Heard (unused)
|
||||
"", // H: Dietary (unused)
|
||||
"", // I: Crew Consent (unused)
|
||||
"Pending", // J: Payment Status
|
||||
"", // K: Payment Method
|
||||
"", // L: Payment Session ID
|
||||
|
|
@ -66,7 +59,7 @@ export async function addRegistration(data: RegistrationData): Promise<number> {
|
|||
"", // N: Payment Date
|
||||
"", // O: Accommodation Venue
|
||||
"", // P: Accommodation Type
|
||||
data.wantFood ? "Yes" : "No", // Q: Want Food
|
||||
"", // Q: Want Food (unused)
|
||||
],
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue