refactor: rename product to partyEvent in API route, types and frontend components
This commit is contained in:
@@ -31,23 +31,23 @@ export async function GET(req: NextRequest) {
|
||||
const { searchParams } = req.nextUrl;
|
||||
|
||||
// RULES: eventId must exist
|
||||
const eventId = searchParams.get('eventId');
|
||||
if (!eventId) {
|
||||
return response({ message: 'Event ID is required!' }, STATUS.BAD_REQUEST);
|
||||
const partyEventId = searchParams.get('partyEventId');
|
||||
if (!partyEventId) {
|
||||
return response({ message: 'PartyEvent ID is required!' }, STATUS.BAD_REQUEST);
|
||||
}
|
||||
|
||||
// NOTE: eventId confirmed exist, run below
|
||||
const event = await getEvent(eventId);
|
||||
const partyEvent = await getEvent(partyEventId);
|
||||
|
||||
if (!event) {
|
||||
return response({ message: 'Event not found!' }, STATUS.NOT_FOUND);
|
||||
if (!partyEvent) {
|
||||
return response({ message: 'PartyEvent not found!' }, STATUS.NOT_FOUND);
|
||||
}
|
||||
|
||||
logger('[PartyEvent] details', event.id);
|
||||
logger('[PartyEvent] details', partyEvent.id);
|
||||
|
||||
createAppLog(L_INFO, 'Get event detail OK', debug);
|
||||
|
||||
return response({ event }, STATUS.OK);
|
||||
return response({ partyEvent }, STATUS.OK);
|
||||
} catch (error) {
|
||||
createAppLog(L_ERROR, 'event detail error', debug);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
###
|
||||
|
||||
# Get details for a specific party event
|
||||
GET http://localhost:7272/api/party-event/details?eventId=e99f09a7-dd88-49d5-b1c8-1daf80c2d7b01
|
||||
GET http://localhost:7272/api/party-event/details?partyEventId=e99f09a7-dd88-49d5-b1c8-1daf80c2d7b01
|
||||
|
||||
###
|
||||
|
||||
|
Reference in New Issue
Block a user