Overview
Hubstaff is created to consolidate and compile all ais hubstaff users.
📁 Hubstaff Related files:
THis is only the Hubstaff related files.
- Controllers/Hubstaff.php - Contains all the function and logic used in hubstaff_attendance_report.
- Pages/hubstaff/hubstaff_attendance_report.php - The page is used to consolidate all hubstaff AMTI users data.
- Pages/hubstaff/hubstaff_management.php - This page is currently not in production as it is complete. See Hubstaff wiki for this tech debt.
- application/cache/HUBSTAFF_* - All cached hubstaff files in inside the cache folder prefixed by
HUBSTAFF_keywork.
Hubstaff Flow
Functions of the Hubstaff
- Daily of Hubstaff request (every 11:59pm)
graph LR;
ais[AIS Server]--request to hubstaff server-->a
a[1. Refresh access token and then cache]
a--returj response will be cache-->ais
ais--request to hubstaff server-->b[2. Cache Organization Members]
b--return response will be cached-->ais
ais--request hubstaff server-->c[3. Cache Users]
c--return response will be cached-->ais
The diagram above shows how the CRON job works. The code implementation below:
/**
* Update all the data cache of hubstaff
* This function is used for the CRON JOB in server
*/
public function hubstaffJobsDaily() {
$this->refreshAccessToken();
$this->cacheOrganizationMembers();
$this->cacheUsers();
}
POST API: cacheAttendanceShifts
This API is mostly used to get the hubstaff users current shift status. This is also used when the Payroll requests a certain range of date to be pulled from the API server.
Please also note that this API is called every hour to prevent multiple API requests when loading the Hubstaff modle page in the AIS.