import { execute, insertReturning } from '../../utils/db' import { requireAuth } from '../../utils/session' /** * 구글 그룹 등록 * POST /api/google-group/create */ export default defineEventHandler(async (event) => { await requireAuth(event) const body = await readBody(event) if (!body.groupEmail || !body.groupName) { throw createError({ statusCode: 400, message: '그룹 이메일과 이름은 필수입니다.' }) } const result = await insertReturning(` INSERT INTO wr_google_group (group_email, group_name, description) VALUES ($1, $2, $3) RETURNING group_id `, [body.groupEmail.toLowerCase().trim(), body.groupName.trim(), body.description || null]) return { success: true, groupId: result.group_id, message: '그룹이 등록되었습니다.' } })