mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-01 06:06:05 +08:00
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { requireUserSession } from '../../utils/auth'
|
|
import { PilotProfile } from '../../models/PilotProfile'
|
|
import { createDefaultOnboardingProfile } from '~~/shared/onboarding/config'
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const user = await requireUserSession(event)
|
|
const profile = await PilotProfile.findOne({ user: user._id })
|
|
|
|
if (!profile) {
|
|
return createDefaultOnboardingProfile()
|
|
}
|
|
|
|
return {
|
|
simulator: profile.simulator ?? null,
|
|
os: profile.os ?? null,
|
|
hardware: profile.hardware ?? [],
|
|
radioConfidence: profile.radioConfidence ?? null,
|
|
radioPainPoint: profile.radioPainPoint ?? null,
|
|
networkExperience: profile.networkExperience ?? [],
|
|
toolkit: profile.toolkit ?? [],
|
|
toolkitDuration: profile.toolkitDuration ?? {},
|
|
topFeatures: profile.topFeatures ?? [],
|
|
pricingPreference: profile.pricingPreference ?? null,
|
|
resultCallsign: profile.resultCallsign ?? null,
|
|
completedAt: profile.completedAt ? profile.completedAt.toISOString() : null,
|
|
skippedAt: profile.skippedAt ? profile.skippedAt.toISOString() : null,
|
|
}
|
|
})
|