- NodeJS 16
- Express 4
- clone this repo
npm install
npm run start
if using docker is preferred
docker build . -t ando-hunterz/pervasive-backend
docker run -itd --name pervasive-backend -p 80:4500
- Postgresql
- MongoDB
method: 'GET'
endpoint: /data
required: admin role jwt
response:
[
{
"_id": {
"year": int,
"week": int
},
"start_date": Date,
"count": int
}
-
login
endpoint:
/login
method:
POST
body:
{ "email": email, "password": password }
response:
{ "token": string }
-
register
method:
POST
endpoint:
/register
body:
{ "nim": int, "uid": string, "email": email, "first_name": string, "last_name": string, "password": string }
reponse:
{ "id": int, "nim": string, "uid": string, "email": string, "first_name": string, "last_name": string, "password": string, "updatedAt": string, "createdAt": string, "role": string }
-
Get All Booking endpoint:
/
method:
GET
required:
user jwt
response:
[ { "_id": string, "start_date": string, "end_date": string, "duration": int, "room_id": string, "status": string, "user_booking_nim": string, "participant": [string], "createdAt": string, "updatedAt": string, "__v": 0 } ]
-
Specific user booking endpoint:
/user/:nim
method:
GET
params:
nim: int
required:
user jwt
reponse:
{ "_id": string, "start_date": string, "end_date": string, "duration": int, "room_id": string, "status": string, "user_booking_nim": string, "participant": [string], "createdAt": string, "updatedAt": string, "__v": 0 }
-
Add new booking endpoint:
/
method:
POST
required:
user jwt
body:
{ "user_booking_nim": int, "room_id": int, "start_date": date, "end_date": date, "participant": [string] }
response:
{ "_id": string, "start_date": string, "end_date": string, "duration": int, "room_id": string, "status": string, "user_booking_nim": string, "participant": [string], "createdAt": string, "updatedAt": string, "__v": 0 }
-
Check room availability endpoint:
/checkRoom
method:
GET
required:
user jwt
query params:
?date=yyyy-mm-dd&start_time=00:00&end_time=00:00
response:
{ "room": [ { "id": int, "name": string, "capacity": int } ]
-
Get specific booking endpoint:
/:id
method:
GET
required:
user jwt
response:
{ "_id": string, "start_date": string, "end_date": string, "duration": int, "room_id": string, "status": string, "user_booking_nim": string, "participant": [string], "createdAt": string, "updatedAt": string, "__v": 0 }
-
edit specific booking endpoint:
/:id
method:
PUT
required:
user jwt
body:
{ "user_booking_nim": int, "room_id": int, "start_date": date, "end_date": date, "participant": [string] }
response:
{ "message": string, "booking": { "_id": string, "start_date": string, "end_date": string, "duration": int, "room_id": string, "status": string, "user_booking_nim": string, "participant": [string], "createdAt": string, "updatedAt": string, "__v": int } }