"feat: add EventItem, EventReview models with seed data and mock files, update User and Event schemas"

This commit is contained in:
louiscklaw
2025-06-03 15:29:05 +08:00
parent a0a4ffcb4e
commit 24920fb313
52 changed files with 2140 additions and 56 deletions

View File

@@ -1,7 +1,8 @@
# GUIDELINE
this is a helloworld api endpoint
this is a demo to handle helloworld record
- this is a helloworld api endpoint
- this is a demo to handle helloworld record
- use single file for single db table/collection only
## `route.ts`

View File

@@ -0,0 +1,39 @@
// src/app/api/helloworld/detail/route.ts
//
// PURPOSE:
// Get single helloworld record detail
//
// RULES:
// - For helloworld requests, return simple response
//
import type { NextRequest } from 'next/server';
import { STATUS, response, handleError } from 'src/utils/response';
import prisma from '../../../lib/prisma';
// ----------------------------------------------------------------------
/**
**************************************
* GET - Handle both helloworld and user details
**************************************
*/
export async function GET(req: NextRequest) {
// Original user details functionality
try {
const { searchParams } = req.nextUrl;
// RULES: helloworldId must exist
const helloworldId = searchParams.get('helloworldId');
if (!helloworldId) return response({ message: 'helloworldId is required!' }, STATUS.BAD_REQUEST);
const helloworld = await prisma.userItem.findFirst({ where: { id: helloworldId } });
if (!helloworld) return response({ message: 'User not found!' }, STATUS.NOT_FOUND);
return response({ helloworld }, STATUS.OK);
} catch (error) {
return handleError('Product - Get details', error);
}
}

View File

@@ -0,0 +1,4 @@
###
GET http://localhost:7272/api/helloworld/details?helloworldId=1165ce3a-29b8-4e1a-9148-1ae08d7e8e01

View File

@@ -6,6 +6,11 @@ import { listHelloworlds, deleteHelloworld, updateHelloworld, createNewHelloworl
// import prisma from '../../lib/prisma';
/**
***************************************
* GET - list all Helloworlds
***************************************
*/
export async function GET(req: NextRequest, res: NextResponse) {
try {
const result = await listHelloworlds();