mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-04 16:22:48 +08:00
typescript
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user