- root location:
data/static.js
const ROLE = { ADMIN: 'admin', STAFF: 'staff' } const GENDER = { M: 'Boys', F: 'Girls' } const COURSE = { BT: 'B.Tech', MT: 'M. Tech' } const BRANCH = { CT: 'Ceramic Technology', IT: 'Information Technology', CSE: 'Computer Science & Engineering' } const BLOCK = [ { id:"1", name: 'Block-A', desc: 'Wifi, Single-Bed ....', type: GENDER.M }, ... ]
- root location:
model/...
-
Model:
User.js
{ "_id": "6252edab39baefbe02a02e33", "name": "Staff User 2", "email": "staff2@yahoo.com", "role": "staff", "password": "$2a$10$NXrAR0F8x6SLBXEcbvYTReL98y4LSRa8TjF4r4yziId2pq3AQhgJC", "block": [ "1", "4" ], "date": "2022-04-10T14:46:03.847Z", "__v": 0 }
-
Room:
Room.js
{ "_id": "62532fb56fd49992f74b36c5", "block": "2", "room_no": "100-C", "desc": "Non-AC", "status": [], "date": "2022-04-10T19:27:49.845Z", "__v": 0 }
-
Student:
Student.js
// left
dev purpose
- name:
Admin User
- email:
admin@yahoo.com
- password:
admin@1234
- function
- All staff (CRUD)
- All function of staff
- name:
Staff User {{num}}
- email:
staff{{num}}@yahoo.com
- password:
staff{{num}}@1234
- function
- Self staff (RU)
- All room in given block (CRUD)
- Allot Student to rooms
- All function of student
- function
- View room status block-wise
- **Send Application
Assumption
- Admin cannot change email(uid)
- Admin cannot delete itself
- Admin cannot change own role
Request to admin and staff
// body
{
"email": "test@yahoo.com",
"password": "admin@1234"
}
Response
// JWT TOKEN
eyJhbGciOiJ...1m3t5qOCAd8dvXi6D5w
Request access to admin
//header
{
"auth-token": "JWT_TOKEN"
}
// body
{
"name": "Staff Test 1",
"email": "staff1@yahoo.com",
"password": "staff@1234",
"role": "staff"
}
Response
// USER ID
{
"user": "6252e68c3a908c0f120992fe"
}
Request access to admin
//header
{
"auth-token": "JWT_TOKEN"
}
Request access to admin
//header
{
"auth-token": "JWT_TOKEN"
}
Request access to admin
//header
{
"auth-token": "JWT_TOKEN"
}
Request access to admin
//header
{
"auth-token": "JWT_TOKEN"
}
//BODY
{
"name": "Staff User 1",
"password": "staff1@1234",
"role": "staff",
"block": ["1","4"]
}
Request access to admin and staff
//header
{
"auth-token": "JWT_TOKEN"
}
Access: All users
Access: All users
Access: Staff & Admin with Block Permission
Request
//header
{
"auth-token": "JWT_TOKEN"
}
//body
{
"block": "1",
"room_no": "123-C",
"desc": "Non-AC",
"status": []
}
Response
{
"room": "6253bcd3063288cd5a63675c"
}
Request
//header
{
"auth-token": "JWT_TOKEN"
}
Response
{
"_id": "62532fb56fd49992f74b36c5",
"block": "2",
"room_no": "100-C",
"desc": "Non-AC",
"status": [],
"date": "2022-04-10T19:27:49.845Z",
"__v": 0
}