Define what APIs are expected from the system...
Here's a breakdown of the essential REST API for our Employee Swap System.
User service:
PUT /auth/login - authenticate a user
PUT /auth/logout - log out user
POST /auth/register - register new user:
{ "name": "name1"
"email":....
"phone": ...
"employe_id":
"position":
"department":
"manager_id"
}
Employee shift matching service:
GET /shift_matching/{empoyee_id}/shifts - get list of the shift schedule by the employee_id:
{ "employee_id":...
"shifts":[
{ "shift_id":....
"startFrom":
"endTo":
},
....
]
PUT /shift_matching/{employee_id1}/{shift_id1}/swap/{employee_id2}/{shift_id2} - try to swap the shift_id1 of the employee_id1 with shift_id2 of employee_id2:
Return :
{ "swap_id"....
"status": IN_PROGRESS,APPROVED_BY_MANAGER,APPROVED_BY_EMPLOYEE,CANCELED
"createdAt": ....
}
GET /shift_matching/{employee_id1}/status/{shift_id} - return the shift attempt status:
{ "swap_id"....
"status": IN_PROGRESS,APPROVED_BY_MANAGER,APPROVED_BY_EMPLOYEE,CANCELED
"createdAt": ....
}
PUT /employee_shift/{emploey_id}/approve/{shift_id} - an employee approves the suggested shift.
PUT /employee_shift/manager/{manager_id}/approve/{shift_id} - a manager approves the suggested shift if the both employees agreed.
Employee Shift service:
GET /employee_shift?dateFrom=&dateTo= - get the full shifts for the given time interval:
{
"date": ...
[{
"shift_id": ...
"employee_id": ....
"startFrom":
"endTo":...
}, ...]
}
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Defining the system data model early on will clarify how data will flow among different components of the system. Also you could draw an ER diagram using the diagramming tool to enhance your design...