Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.
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
22 changes: 9 additions & 13 deletions app/api/map/flights/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,15 @@ export async function GET(request: Request) {
return NextResponse.json({error: 'Unauthorized'}, {status: 401});
}
try {
// Ensure the user is marked with the attending tag
const attendingTag = await prisma.userTag.findFirst({
where: {
userId: session?.user?.id,
tag: {
name: {
equals: 'attending',
mode: 'insensitive', // Case-insensitive match
},
},
},
});
if (!attendingTag) {
// Ensure the user is attending the event
const attendingTableName = "RSVPs"
const attendingRecords = await getRecords(attendingTableName, {
filterByFormula: `{Email} = '${session.user.email}'`,
sort: [{field: 'Email', direction: 'asc'}],
maxRecords: 1
})
const attending = attendingRecords[0] && attendingRecords[0].fields['Attending'];
if (!attending) {
return NextResponse.json({error: 'User is not attending event'}, {status: 403});
}
// If necessary, send cached reponse
Expand Down
2 changes: 1 addition & 1 deletion lib/airtable/airtable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function getRecords(tableName: string, options?: {
filterByFormula: options?.filterByFormula,
sort: options?.sort,
maxRecords: options?.maxRecords,
view: options?.view,
...(options?.view && { view: options.view })
})
.all();

Expand Down
Loading