fix type error

This commit is contained in:
2026-01-15 16:38:25 +13:00
parent aa58dfe58b
commit c1e39bbf86

View File

@@ -7,16 +7,16 @@ import { httpResponse } from '../../../utils/response';
export async function GET({ params }: APIContext) {
try {
const { id } = params
if (!id) {
if (!id || isNaN(Number(id))) {
return httpResponse({'error': 'no id provided'}, 400)
}
return getEntry(id)
return getEntry(Number(id))
} catch (error) {
return httpResponse({ error: `Failed to retrieve entry: ${error}` }, 500);
}
}
async function getEntry(id) {
async function getEntry(id: number) {
try {
const entry = await db.select().from(entryTable).where(eq(entryTable.id, id))
if (entry.length == 0) {