feat: pre-registrant management and invitation system
Admin interface to review, filter, and batch-invite the 95 pre-registrants from Baby Ghosts. Accept-invitation page pre-fills their data and collects circle, pronouns, motivation, contribution tier, and agreement before creating their member record.
This commit is contained in:
parent
bab53cec9e
commit
501be10bfe
15 changed files with 1896 additions and 1 deletions
26
server/api/admin/pre-registrants/[id].put.js
Normal file
26
server/api/admin/pre-registrants/[id].put.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import PreRegistration from '../../../models/preRegistration.js'
|
||||
import { connectDB } from '../../../utils/mongoose.js'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
await requireAdmin(event)
|
||||
const id = getRouterParam(event, 'id')
|
||||
const body = await validateBody(event, preRegistrantStatusUpdateSchema)
|
||||
await connectDB()
|
||||
|
||||
const existing = await PreRegistration.findById(id)
|
||||
if (!existing) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'Pre-registrant not found' })
|
||||
}
|
||||
|
||||
// Only allow status changes to pending/selected (invite/accept are handled by other endpoints)
|
||||
if (existing.status === 'accepted') {
|
||||
throw createError({ statusCode: 400, statusMessage: 'Cannot modify an accepted pre-registrant' })
|
||||
}
|
||||
|
||||
const update = {}
|
||||
if (body.status !== undefined) update.status = body.status
|
||||
if (body.adminNotes !== undefined) update.adminNotes = body.adminNotes
|
||||
|
||||
const updated = await PreRegistration.findByIdAndUpdate(id, update, { new: true }).lean()
|
||||
return updated
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue