TTMT.ManageWebGUI/Users-API.md

1.3 KiB

User API

Tai lieu mo ta cac endpoint cap nhat role va thong tin nguoi dung.


1) Cap nhat thong tin nguoi dung

  • PUT /api/User/{id}
  • Permission: EDIT_USER_ROLE

Request

{
  "name": "Nguyen Van A",
  "userName": "nguyenvana",
  "accessRooms": [1, 2, 3]
}

Response (200)

{
  "success": true,
  "message": "User updated successfully",
  "data": {
    "userId": 12,
    "userName": "nguyenvana",
    "name": "Nguyen Van A",
    "roleId": 3,
    "accessRooms": [1, 2, 3],
    "updatedAt": "2026-04-03T10:20:30Z",
    "updatedBy": "admin"
  }
}

Ghi chu

  • Neu khong truyen accessRooms thi giu nguyen danh sach phong.
  • Neu truyen accessRooms = [] thi xoa tat ca phong.
  • Neu userName bi trung hoac khong hop le thi tra ve 400.

2) Cap nhat role nguoi dung

  • PUT /api/User/{id}/role
  • Permission: EDIT_USER_ROLE

Request

{
  "roleId": 2
}

Response (200)

{
  "success": true,
  "message": "User role updated",
  "data": {
    "userId": 12,
    "userName": "nguyenvana",
    "roleId": 2,
    "roleName": "Manager",
    "updatedAt": "2026-04-03T10:20:30Z",
    "updatedBy": "admin"
  }
}

Ghi chu

  • Chi System Admin moi duoc phep cap nhat role System Admin.