typescript

This commit is contained in:
itsrubberduck
2026-02-17 18:19:55 +01:00
parent 8f45c3397d
commit f88fced5b1
16 changed files with 60 additions and 33 deletions

View File

@@ -70,8 +70,8 @@ export default defineEventHandler(async (event) => {
}
}
const startedAt = toISO(items[0].createdAt)
const updatedAt = toISO(items[items.length - 1].createdAt)
const startedAt = toISO(items[0]?.createdAt)
const updatedAt = toISO(items[items.length - 1]?.createdAt)
const callsign = extractCallsign(items)
return {

View File

@@ -16,7 +16,7 @@ export default defineEventHandler(async (event) => {
throw createError({ statusCode: 400, statusMessage: 'Missing user ID' })
}
const body = await readBody<UpdateNotesBody>(event).catch(() => ({}))
const body = await readBody<UpdateNotesBody>(event).catch(() => ({}) as UpdateNotesBody)
const rawNotes = typeof body.notes === 'string' ? body.notes.replace(/\r\n/g, '\n') : ''
const notes = rawNotes.trim()

View File

@@ -15,7 +15,7 @@ export default defineEventHandler(async (event) => {
throw createError({ statusCode: 400, statusMessage: 'Missing user ID' })
}
const body = await readBody<UpdateRoleBody>(event).catch(() => ({}))
const body = await readBody<UpdateRoleBody>(event).catch(() => ({}) as UpdateRoleBody)
const role = body.role?.trim()
if (!role || !['user', 'admin', 'dev'].includes(role)) {

View File

@@ -1,3 +1,4 @@
import mongoose from 'mongoose'
import { createError, defineEventHandler, readBody } from 'h3'
import { requireAdmin } from '../../../../utils/auth'
import { WaitlistEntry } from '../../../../models/WaitlistEntry'
@@ -48,7 +49,7 @@ export default defineEventHandler(async (event) => {
createdBy: admin._id,
})
entry.invitationCode = invitation._id
entry.invitationCode = invitation._id as mongoose.Types.ObjectId
}
entry.invitationSentAt = now