fix broken build,

This commit is contained in:
louiscklaw
2025-06-13 18:11:12 +08:00
parent 5ff3393f54
commit d767108fcf
18 changed files with 130 additions and 82 deletions

View File

@@ -2,7 +2,7 @@ import type { NextRequest, NextResponse } from 'next/server';
import { STATUS, response, handleError } from 'src/utils/response';
import { listAppLogs, deleteAppLog, updateAppLog, createNewAppLog } from 'src/app/services/AppLog.service';
import { listAppLogs, deleteAppLog, createNewAppLog } from 'src/app/services/AppLog.service';
// import prisma from '../../lib/prisma';
@@ -34,28 +34,29 @@ export async function POST(req: NextRequest) {
}
}
/**
***************************************
* PUT - update AppLog
***************************************
*/
export async function PUT(req: NextRequest) {
const { searchParams } = req.nextUrl;
const appLogId = searchParams.get('appLogId');
// TODO: delete `update AppLog`
// /**
// ***************************************
// * PUT - update AppLog
// ***************************************
// */
// export async function PUT(req: NextRequest) {
// const { searchParams } = req.nextUrl;
// const appLogId = searchParams.get('appLogId');
const { data } = await req.json();
// const { data } = await req.json();
try {
if (!appLogId) throw new Error('appLogId cannot null');
const id: number = parseInt(appLogId);
// try {
// if (!appLogId) throw new Error('appLogId cannot null');
// const id: number = parseInt(appLogId);
const updateResult = await updateAppLog(id, data);
// const updateResult = await updateAppLog(id, data);
return response(updateResult, STATUS.OK);
} catch (error) {
return handleError('AppLog - Update', error);
}
}
// return response(updateResult, STATUS.OK);
// } catch (error) {
// return handleError('AppLog - Update', error);
// }
// }
/**
***************************************
@@ -72,7 +73,7 @@ export async function DELETE(req: NextRequest) {
if (!appLogId) throw new Error('appLogId cannot null');
const id: number = parseInt(appLogId);
const deleteResult = await deleteAppLog(id);
const deleteResult = await deleteAppLog(id.toString());
return response(deleteResult, STATUS.OK);
} catch (error) {