추가
This commit is contained in:
30
backend/api/employee/[id]/detail.get.ts
Normal file
30
backend/api/employee/[id]/detail.get.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { queryOne } from '../../../utils/db'
|
||||
|
||||
/**
|
||||
* 사원 상세 조회
|
||||
* GET /api/employee/[id]/detail
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const employeeId = getRouterParam(event, 'id')
|
||||
|
||||
const employee = await queryOne<any>(`
|
||||
SELECT * FROM wr_employee_info WHERE employee_id = $1
|
||||
`, [employeeId])
|
||||
|
||||
if (!employee) {
|
||||
throw createError({ statusCode: 404, message: '사원을 찾을 수 없습니다.' })
|
||||
}
|
||||
|
||||
return {
|
||||
employeeId: employee.employee_id,
|
||||
employeeNumber: employee.employee_number,
|
||||
employeeName: employee.employee_name,
|
||||
employeeEmail: employee.employee_email,
|
||||
employeePhone: employee.employee_phone,
|
||||
employeePosition: employee.employee_position,
|
||||
joinDate: employee.join_date,
|
||||
isActive: employee.is_active,
|
||||
createdAt: employee.created_at,
|
||||
updatedAt: employee.updated_at
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user