fix: updated from 9.3.3 to 15
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
import { NextResponse } from 'next/server';
|
||||
import { query, queryOne } from '@/lib/db';
|
||||
import { EventCheckRow } from '@/types/racing';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
@@ -51,12 +52,14 @@ export async function POST(request: Request) {
|
||||
}
|
||||
|
||||
// Check if event exists and is open
|
||||
const eventCheck: unknown = await queryOne(
|
||||
`SELECT event_id, event_status, max_participants,
|
||||
(SELECT COUNT(*) FROM event_registrations
|
||||
WHERE event_id = $1 AND status = 'REGISTERED') as current_registrations
|
||||
FROM events WHERE event_id = $1`,
|
||||
[eventId]
|
||||
|
||||
|
||||
const eventCheck = await queryOne<EventCheckRow>(
|
||||
`SELECT event_id, event_status, max_participants,
|
||||
(SELECT COUNT(*) FROM event_registrations
|
||||
WHERE event_id = $1 AND status = 'REGISTERED') as current_registrations
|
||||
FROM events WHERE event_id = $1`,
|
||||
[eventId]
|
||||
);
|
||||
|
||||
if (!eventCheck) {
|
||||
|
||||
Reference in New Issue
Block a user