This project is a user management and work report system at PT KMI Wire and Cable Tbk PP Support Production using Express, Prisma, and MySQL. The system has two main roles: ADMIN
and USER
. Admins can add new users and manage work reports, while users can only log in and manage their own work reports.
Endpoint: POST /login
Description: This endpoint is used to log in to the system using username
and password
.
-
Request Body:
{ "username": "string", "password": "string" }
-
Response:
{ "token": "string", "role": "string" }
Endpoint: POST /admin/add-user
Description: This endpoint allows an admin to add a new user to the system.
-
Headers:
Authorization: Bearer <token>
-
Request Body:
{ "username": "string", "password": "string", "role": "string" // Either "ADMIN" or "USER" }
-
Response:
{ "id": "number", "username": "string", "role": "string" }
Endpoint: POST /create-admin
Description: This endpoint is used to create the initial admin account. It can only be used once.
- Response:
{ "message": "Admin account created successfully" }
Endpoint: GET /users
Description: This endpoint allows an admin to retrieve a list of all users in the system.
-
Headers:
Authorization: Bearer <token>
-
Response:
[ { "id": "number", "username": "string", "role": "string" } ]
Endpoint: GET /user/:id
Description: This endpoint allows an admin to retrieve details of a specific user by their ID.
-
Headers:
Authorization: Bearer <token>
-
Response:
{ "id": "number", "username": "string", "role": "string" }
Endpoint: POST /laporan
Description: This endpoint allows a user to create a new work report.
-
Headers:
Authorization: Bearer <token>
-
Request Body:
{ "tanggal": "string (date format)", "nama": "string", "jenisPekerjaan": "string", "deskripsi": ["string"], "hasil": "string", "satuan": "string" }
-
Response:
{ "success": true, "message": "Data berhasil ditambahkan", "laporan": { "id": "number", "tanggal": "string", "nama": "string", "jenisPekerjaan": "string", "deskripsi": "string", "hasil": "string", "satuan": "string" } }
Endpoint: GET /laporan
Description: This endpoint allows a user to retrieve all work reports.
-
Headers:
Authorization: Bearer <token>
-
Response:
[ { "id": "number", "tanggal": "string", "nama": "string", "jenisPekerjaan": "string", "deskripsi": "string", "hasil": "string", "satuan": "string" } ]
Endpoint: GET /laporan/:id
Description: This endpoint allows a user to retrieve a specific work report by its ID.
-
Headers:
Authorization: Bearer <token>
-
Response:
{ "id": "number", "tanggal": "string", "nama": "string", "jenisPekerjaan": "string", "deskripsi": "string", "hasil": "string", "satuan": "string" }
Endpoint: PUT /laporan/:id
Description: This endpoint allows a user to update a specific work report by its ID.
-
Headers:
Authorization: Bearer <token>
-
Request Body:
{ "tanggal": "string (date format)", "nama": "string", "jenisPekerjaan": "string", "deskripsi": ["string"], "hasil": "string", "satuan": ["string"] }
-
Response:
{ "id": "number", "tanggal": "string", "nama": "string", "jenisPekerjaan": "string", "deskripsi": "string", "hasil": "string", "satuan": "string" }
- Vite ReactJS
- TailwindCSS
- Prisma
- ExpressJS
- MySQL
- clone repo
- cd lapordaily
- cd frontend
- npm install
- npm run dev
- clone repo
- cd lapordaily
- cd backend
- npm install
- npx prisma migrate dev --name init
- node index.js
- run apache & mysql xampp control panel or any other web server