Human Resources & Auth / Technical / api-spec.html
Technical spec

NestJS REST APIs Specification

Tài liệu chi tiết danh sách REST APIs endpoint, tham số request và response mẫu cho các tác vụ Nhân sự và Xác thực.

🔌 REST Endpoints

Bảng tổng hợp chi tiết các API endpoints được xây dựng trong NestJS backend.

POST /api/auth/login

Xác thực tài khoản người dùng và cấp phát JWT Token.

Request Body:
{
  "username": "EMP0042",
  "password": "strongpassword123"
}
Response (200 OK):
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsIn...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsIn...",
  "user": {
    "id": 12,
    "username": "EMP0042",
    "isSuperAdmin": false
  }
}
POST /api/employees

Tạo mới hồ sơ nhân sự (Onboard Employee).

Request Body:
{
  "employeeCode": "EMP0042",
  "fullName": "Nguyễn Văn A",
  "departmentId": 2,
  "jobTitleId": 5,
  "email": "vana@kingstonvn.co",
  "phone": "0901234567"
}
Response (201 Created):
{
  "id": 15,
  "employeeCode": "EMP0042",
  "fullName": "Nguyễn Văn A",
  "departmentId": 2,
  "jobTitleId": 5,
  "status": 1
}
POST /api/employees/:id/skills

Gán kỹ năng năng lực sản xuất cho nhân sự.

Request Body:
{
  "skillIds": [3, 8]
}
Response (200 OK):
{
  "success": true,
  "assignedSkillsCount": 2
}