작업계획서대로 진행
This commit is contained in:
23
backend/api/vcs-account/[id]/delete.delete.ts
Normal file
23
backend/api/vcs-account/[id]/delete.delete.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { execute, queryOne } from '../../../utils/db'
|
||||
import { getCurrentUserId } from '../../../utils/user'
|
||||
|
||||
/**
|
||||
* VCS 계정 삭제
|
||||
* DELETE /api/vcs-account/[id]/delete
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const accountId = Number(getRouterParam(event, 'id'))
|
||||
const userId = await getCurrentUserId(event)
|
||||
|
||||
const existing = await queryOne(
|
||||
'SELECT * FROM wr_employee_vcs_account WHERE account_id = $1 AND employee_id = $2',
|
||||
[accountId, userId]
|
||||
)
|
||||
if (!existing) {
|
||||
throw createError({ statusCode: 404, message: 'VCS 계정을 찾을 수 없습니다.' })
|
||||
}
|
||||
|
||||
await execute('DELETE FROM wr_employee_vcs_account WHERE account_id = $1', [accountId])
|
||||
|
||||
return { success: true, message: 'VCS 계정이 삭제되었습니다.' }
|
||||
})
|
||||
Reference in New Issue
Block a user