Skip to content

API controller

Vu edited this page Apr 7, 2025 · 9 revisions

PLEASE GO TO project-insight/db/UPDATED_Database_April to get the .CSV files to build you database in your local machine

Here are the APIs that I have created (some of it is still empty, which means you will not receive any result(NULL)). If you guys need any more methods or suggestions, leave comments.

models (these are what I'm gonna return to front-end, because you use GUI so the return value is an Object not a JSON)

Employee { int empid; String Fname; String Lname; String job_title; String email; double salary; String ssn;

int getEmpid() { return empid }
String getFname() { return Fname }
...

} EmployeePayInfo{ int empid, String Fname, String Lname, Date payDate, double earning, double fed_tax, double fed_med, double fed_SS, double state_tax, double retire_401K, double health_care

int getEmpid() { return empid }
String getFname() { return Fname }
....

} User { int empid

int role; (0 for admin, 1 for employee)

int getEmpid() {return empid}

public int getRole() {return role} }

API Controller(these are the methods you guys can use):

TO LOGIN:

UserLogin.login(String username, String password) =======> return User{}

TO VIEW EMPLOYEE INFO:

EmployeeInfo.viewEmployeeInfoById(int empid) =======> return Employee{}

EmployeeInfo.viewEmployeeInfoByName(String Name, String Name) =======> return Employee{}

EmployeeInfo.viewEmployeeInfoBySsn(String ssn) =======> return Employee{}

EmployeeInfo.viewAllEmployee() =======> return A LIST OF Employee{}

TO VIEW EMPLOYEE PAY INFO (FOR REPORT)

Report.getEmployeePayReport(int empId) =======> return A LIST OF EmployeePayInfo

Report.getTotalPayByJobtitle(int jobtitle_id) =======> return a float number

Report.getTotalPayByDivision(int division_id) =======> return a float number

(please prompt admin to input jobtitle_id or division_id NOT THE NAME), you can refer to the database to know the id

TO UPDATE SALARY BY RANGE:

UpdateRangeSalary.updateRangeSalary(int min, int max, int increment) =======> return an integer of how many people got updated

TO UPDATE Employee INFORMATION:

UpdateEmployeeInfo.updateInfo(Employee employee) =======> return an integer of how many row got updated (If any of the field of employee that you send to backend code has the NULL value(empty), that field in database will be updated as NULL

TO ADD NEW Employee:

AddEmployee.addNewEmployee(Employee employee) =======> return integer 1 if success.

Clone this wiki locally