38 lines
935 B
TypeScript
38 lines
935 B
TypeScript
import { query } from '../../utils/db'
|
|
import { getCurrentUserId } from '../../utils/user'
|
|
|
|
/**
|
|
* 내 VCS 계정 목록 조회
|
|
* GET /api/vcs-account/my
|
|
*/
|
|
export default defineEventHandler(async (event) => {
|
|
const userId = await getCurrentUserId(event)
|
|
|
|
const accounts = await query(`
|
|
SELECT
|
|
a.*,
|
|
s.server_name,
|
|
s.server_type,
|
|
s.server_url
|
|
FROM wr_employee_vcs_account a
|
|
JOIN wr_vcs_server s ON a.server_id = s.server_id
|
|
WHERE a.employee_id = $1
|
|
ORDER BY s.server_name, a.vcs_username
|
|
`, [userId])
|
|
|
|
return {
|
|
accounts: accounts.map((a: any) => ({
|
|
accountId: a.account_id,
|
|
serverId: a.server_id,
|
|
serverName: a.server_name,
|
|
serverType: a.server_type,
|
|
serverUrl: a.server_url,
|
|
vcsUsername: a.vcs_username,
|
|
vcsEmail: a.vcs_email,
|
|
authType: a.auth_type,
|
|
isActive: a.is_active,
|
|
createdAt: a.created_at
|
|
}))
|
|
}
|
|
})
|