기능구현중
This commit is contained in:
23
backend/api/google-group/create.post.ts
Normal file
23
backend/api/google-group/create.post.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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: '그룹이 등록되었습니다.' }
|
||||
})
|
||||
Reference in New Issue
Block a user