You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TechMate - Hệ thống quản lý & đặt lịch sửa chữa thiết bị điện tử
Giới thiệu
TechMate là một hệ thống quản lý và đặt lịch sửa chữa thiết bị điện tử. Hệ thống này giúp người dùng có thể dễ dàng đăng ký lịch sửa chữa, theo dõi tình trạng thiết bị và quản lý dịch vụ sửa chữa một cách hiệu quả.
Tính năng chính
📌 Quản lý tài khoản người dùng: Đăng ký, đăng nhập, phân quyền khách hàng và nhân viên.
🛠 Quản lý lịch sửa chữa: Khách hàng có thể đặt lịch sửa chữa trực tuyến.
📋 Quản lý thiết bị: Theo dõi tình trạng thiết bị và lịch sử sửa chữa.
💰 Thanh toán và báo giá: Hỗ trợ báo giá trước và các phương thức thanh toán.
📊 Báo cáo và thống kê: Theo dõi doanh thu, số lượng khách hàng và thiết bị sửa chữa.
🔔 Thông báo tự động: Gửi thông báo qua email hoặc SMS về tình trạng sửa chữa.
Công nghệ sử dụng
Backend
Node.js (Express.js) - API Backend
MongoDB - Cơ sở dữ liệu NoSQL
Mongoose - ORM cho MongoDB
JWT - Xác thực người dùng
Nodemailer - Gửi email thông báo
Cloudinary - Lưu trữ hình ảnh thiết bị
Frontend
React.js + Vite - Framework UI hiện đại
Tailwind CSS - Thiết kế giao diện
Axios - Kết nối API
Cấu trúc thư mục
📁 Backend
backend/
├── src/
│ ├── controllers/ # Controller xử lý nghiệp vụ
│ │ ├── humanResources/ # Quản lý nhân sự
│ │ ├── deviceService/ # Quản lý dịch vụ thiết bị
│ │ └── repairScheduling/ # Quản lý lịch sửa chữa
│ ├── middleware/ # Middleware xác thực và phân quyền
│ ├── models/ # Mongoose models
│ │ ├── humanResources/ # Models nhân sự
│ │ ├── deviceService/ # Models dịch vụ thiết bị
│ │ └── repairScheduling/ # Models lịch sửa chữa
│ ├── routes/ # Định nghĩa API routes
│ │ ├── humanResources/ # Routes nhân sự
│ │ ├── deviceService/ # Routes dịch vụ thiết bị
│ │ └── repairScheduling/ # Routes lịch sửa chữa
│ ├── services/ # Business logic
│ │ ├── humanResources/ # Services nhân sự
│ │ ├── deviceService/ # Services dịch vụ thiết bị
│ │ └── repairScheduling/ # Services lịch sửa chữa
│ └── utils/ # Các hàm tiện ích
├── .env # Biến môi trường
├── index.js # Entry point
└── package.json # Dependencies
📁 Frontend
frontend/
├── src/
│ ├── assets/ # Tài nguyên tĩnh (ảnh, icon, font)
│ ├── components/ # Các component tái sử dụng
│ │ ├── common/ # Component chung
│ │ ├── layout/ # Component layout
│ │ └── ui/ # Component giao diện
│ ├── config/ # Cấu hình
│ ├── contexts/ # React Context
│ ├── hooks/ # Custom Hooks
│ ├── pages/ # Các trang chính
│ │ ├── admin/ # Trang quản trị
│ │ ├── auth/ # Trang xác thực
│ │ ├── user/ # Trang người dùng
│ │ └── employee/ # Trang nhân viên
│ ├── services/ # API services
│ ├── store/ # State management
│ ├── styles/ # Global styles
│ └── utils/ # Utility functions
├── public/ # Tệp tĩnh public
├── .env # Biến môi trường
├── index.html # Entry HTML
├── vite.config.js # Cấu hình Vite
└── package.json # Dependencies
Yêu cầu hệ thống
Node.js >= 16
MongoDB Community Edition hoặc MongoDB Atlas
npm hoặc yarn
Trình duyệt hiện đại (Chrome, Firefox,...)
Hệ điều hành: Windows / macOS / Linux
Cài đặt dự án
Cài đặt Backend
cd backend
npm install
npm start
Cài đặt Frontend
cd frontend
npm install
npm run dev
API ENDPOINTS
📂 NHÓM 1 – NHÂN SỰ
Base URL:http://localhost:8000/v1
🔐 Authentication
Method
Endpoint
Description
Auth Required
Roles
POST
/auth/login
Login để lấy access/refresh token
No
-
POST
/auth/verify-accessToken
Kiểm tra accessToken
Yes
-
POST
/auth/sign-accessToken
Tạo accessToken mới từ refreshToken
Yes
-
POST
/auth/verify-refreshToken
Kiểm tra refreshToken
Yes
-
GET
/auth/me
Lấy thông tin người dùng hiện tại
Yes
-
👤 Admin
Method
Endpoint
Description
Auth Required
Roles
POST
/admin/register
Đăng ký admin mới
No
-
POST
/admin/login
Đăng nhập admin
No
-
GET
/admin
Lấy danh sách admin
Yes
admin
GET
/admin/:id
Lấy thông tin admin theo ID
Yes
admin
PUT
/admin/:id
Cập nhật thông tin admin
Yes
admin
DELETE
/admin/:id
Xoá admin
Yes
admin
PUT
/admin/:id/password
Đổi mật khẩu admin
Yes
admin
👤 User
Method
Endpoint
Description
Auth Required
Roles
POST
/user/register
Đăng ký người dùng mới
No
-
POST
/user/login
Đăng nhập người dùng
No
-
GET
/user
Lấy danh sách người dùng
Yes
admin
GET
/user/:id
Lấy thông tin người dùng theo ID
Yes
user/admin
PUT
/user/:id
Cập nhật người dùng
Yes
user/admin
DELETE
/user/:id
Xoá người dùng
Yes
admin
PUT
/user/:id/password
Đổi mật khẩu người dùng
Yes
user
👨💼 Employee
Method
Endpoint
Description
Auth Required
Roles
POST
/employee/add
Thêm nhân viên
Yes
admin
POST
/employee/login
Đăng nhập nhân viên
No
-
GET
/employee
Lấy danh sách nhân viên
Yes
admin
GET
/employee/:id
Lấy thông tin nhân viên theo ID
Yes
user/admin
PUT
/employee/:id
Cập nhật nhân viên
Yes
admin
DELETE
/employee/:id
Xoá nhân viên
Yes
admin
PUT
/employee/:id/password
Đổi mật khẩu nhân viên
Yes
employee
🛂 Permission
Method
Endpoint
Description
Auth Required
Roles
POST
/permission/add
Thêm phân quyền mới
Yes
admin
GET
/permission
Lấy toàn bộ phân quyền
Yes
admin
PUT
/permission/update/:id
Cập nhật phân quyền
Yes
admin
DELETE
/permission/delete/:id
Xoá phân quyền
Yes
admin
📂 NHÓM 2 – DỊCH VỤ THIẾT BỊ
🛠 Service
Method
Endpoint
Description
Auth Required
Roles
POST
/service
Tạo dịch vụ mới
Yes
admin
GET
/service
Lấy danh sách dịch vụ
Yes
-
GET
/service/:id
Lấy thông tin dịch vụ theo ID
Yes
-
PUT
/service/:id
Cập nhật dịch vụ
Yes
admin
DELETE
/service/:id
Xóa dịch vụ
Yes
admin
🔧 Part
Method
Endpoint
Description
Auth Required
Roles
POST
/part
Tạo linh kiện mới
Yes
admin
GET
/part
Lấy danh sách linh kiện
Yes
-
GET
/part/:id
Lấy thông tin linh kiện theo ID
Yes
-
PUT
/part/:id
Cập nhật linh kiện
Yes
admin
DELETE
/part/:id
Xóa linh kiện
Yes
admin
📦 Parts Inventory
Method
Endpoint
Description
Auth Required
Roles
POST
/parts-inventory
Tạo kho linh kiện mới
Yes
admin
GET
/parts-inventory
Lấy danh sách kho linh kiện
Yes
-
GET
/parts-inventory/:id
Lấy thông tin kho linh kiện theo ID
Yes
-
PUT
/parts-inventory/:id
Cập nhật kho linh kiện
Yes
admin
DELETE
/parts-inventory/:id
Xóa kho linh kiện
Yes
admin
📱 Device Template
Method
Endpoint
Description
Auth Required
Roles
POST
/device-template
Tạo mẫu thiết bị mới
Yes
admin
GET
/device-template
Lấy danh sách mẫu thiết bị
Yes
-
GET
/device-template/:id
Lấy thông tin mẫu thiết bị theo ID
Yes
-
PUT
/device-template/:id
Cập nhật mẫu thiết bị
Yes
admin
DELETE
/device-template/:id
Xóa mẫu thiết bị
Yes
admin
📱 Device User
Method
Endpoint
Description
Auth Required
Roles
POST
/device-user
Tạo thiết bị người dùng mới
Yes
user
GET
/device-user
Lấy danh sách thiết bị người dùng
Yes
-
GET
/device-user/:id
Lấy thông tin thiết bị người dùng theo ID
Yes
-
PUT
/device-user/:id
Cập nhật thiết bị người dùng
Yes
user
DELETE
/device-user/:id
Xóa thiết bị người dùng
Yes
user
📂 NHÓM 3 – LỊCH SỬA CHỮA
📅 Appointments
Method
Endpoint
Description
Auth Required
Roles
POST
/appointments
Tạo lịch hẹn mới
Yes
user
GET
/appointments
Lấy danh sách lịch hẹn
Yes
user
GET
/appointments/:id
Lấy thông tin lịch hẹn theo ID
Yes
user
PUT
/appointments/:id
Cập nhật lịch hẹn
Yes
user
DELETE
/appointments/:id
Xóa lịch hẹn
Yes
user
🔧 Repair Status
Method
Endpoint
Description
Auth Required
Roles
POST
/repair-status
Tạo trạng thái sửa chữa mới
Yes
admin
GET
/repair-status
Lấy danh sách trạng thái sửa chữa
Yes
-
GET
/repair-status/:id
Lấy thông tin trạng thái theo ID
Yes
-
PUT
/repair-status/:id
Cập nhật trạng thái sửa chữa
Yes
admin
DELETE
/repair-status/:id
Xóa trạng thái sửa chữa
Yes
admin
👨💼 Employee Work
Method
Endpoint
Description
Auth Required
Roles
POST
/employee-work
Tạo lịch làm việc nhân viên mới
Yes
admin
GET
/employee-work
Lấy danh sách lịch làm việc
Yes
admin
GET
/employee-work/:id
Lấy thông tin lịch làm việc theo ID
Yes
-
PUT
/employee-work/:id
Cập nhật lịch làm việc
Yes
admin
DELETE
/employee-work/:id
Xóa lịch làm việc
Yes
admin
📌 Lưu ý:
Tất cả các API (trừ login/register) yêu cầu access token qua header Authorization.
Một số API yêu cầu role cụ thể như admin hoặc user.
Trả về kết quả dạng JSON, có message và dữ liệu chi tiết hoặc lỗi.