8000 GitHub - jnafolayan/workforce-backend: Human resource management service for organizations
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jnafolayan/workforce-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Workforce API

Models

Admin {#admin}

{
  "username": string,
  "password": string
}

Employee {#employee}

{
  "firstname": string,
  "lastname": string,
  "phone": string,
  "email": string,
  "picture": string,
  "dob": Date,
  "gender": string,
  "role": string,
  "password": string,
  "employedAt": Date,
  "cv": string
}

Attendance {#attendance}

{
  "id": string,
  "employee": Employee,
  "entry": Date,
  "exit": Date
}

Leave {#leave}

{
  "id": string,
  "by": Employee,
  "reason": string,
  "status": string (pending, accepted, declined),
  "start": Date,
  "end": string
}

Task {#task}

{
  "id": string,
  "issuer": Employee,
  "details": string,
  "recepient": string,
  "eta": Date,
  "complete": Boolean,
  "closed": Boolean
}

Role {#role}

{
  "id": string,
  "name": string,
  "actions": [string]
}

Specification

Admin

POST /api/admin - Register a new admin

Request
{
  "username": string,
  "password": string
}
Response
{
  "status": number,
  "message": string
}

POST /api/admin/login - Sign in as an admin

Request
{
  "username": string,
  "password": string
}
Response
{
  "status": number,
  "message": string,
  "data": {
    "token": string
  }
}

Attendance

GET /api/attendance

Response
{
  "status": number,
  "data": [{
    "entry": Date,
    "exit": Date | null,
    "employee": [Employee](#employee)
  }]
}

POST /api/attendance/entry - Employee can sign in for the day

Response
{
  "status": number,
  "message": string
}

POST /api/attendance/exit - Employee can sign out for the day

Response
{
  "status": number,
  "message": string
}

POST /api/attendance/today - Get attendance for the day for an employee

Response
{
  "status": number,
  "data": [{
    "entry": Date,
    "exit": Date | null
  }]
}

Employees

POST /api/employees - Sign up a new employee

Request
{
  "firstname": string,
  "lastname": string,
  "phone": string,
  "email": string,
  "picture": string,
  "dob": Date,
  "gender": string,
  "role": string,
  "password": string,
  "cv": string
}
Response
{
  "status": number,
  "message": string
}

POST /api/employees/login - Sign in as an employee

Request
{
  "email": string,
  "password": string
}
Response
{
  "status": number,
  "message": string,
  "data": [{
    "token": string 
  }]
}

GET /api/employees - Get all employees

Response
{
  "status": number,
  "data": [Employee]
}

GET /api/employees/:employeeId - Get an employee

Response
{
  "status": number,
  "data": [Employee]
}

DELETE /api/employees/:employeeId - Remove an employee

Response
{
  "status": number,
  "message": string
}

GET /api/employees/:employeeId/leaves - Get all leaves applied for by an employee

Response
{
  "status": number,
  "data": [Leave]
}

GET /api/employees/:employeeId/tasks - Get all tasks assigned to an employee

Response
{
  "status": number,
  "data": [Task]
}

Leaves

POST /api/leaves - Request for a leave

Request
{
  "reason": string,
  "start": Date,
  "end": Date
}
Response
{
  "status": number,
  "message": string,
  "data": [Leave]
}

GET /api/leaves/:leaveId - Get details of a leave

Response
{
  "status": number,
  "data": [Leave]
}

GET /api/leaves - Get details of all leaves

Response
{
  "status": number,
  "data": [Leave]
}

PATCH /api/leaves/:leaveId/accept - Grant a leave

Response
{
  "status": number,
  "message": string
}

PATCH /api/leaves/:leaveId/decline - Refuse a leave

Response
{
  "status": number,
  "message": string
}

Tasks

POST /api/tasks - Create and assign a new task

Request
{
  "details": string,
  "recepient": string (employee id),
  "eta": Date
}
Response
{
  "status": number,
  "message": string,
  "data": [Task]
}

GET /api/tasks/:taskId - Get details of a task

Response
{
  "status": number,
  "data": [Task]
}

GET /api/tasks - Get details of all tasks

Response
{
  "status": number,
  "data": [Task]
}

PATCH /api/tasks/:taskId/complete - Label a task as complete

Response
{
  "status": number,
  "message": string
}

PATCH /api/tasks/:taskId/close - Tag a task as closed

Response
{
  "status": number,
  "message": string
}

PATCH /api/tasks/:taskId/open - Tag a task as open and not complete

Response
{
  "status": number,
  "message": string
}

About

Human resource management service for organizations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
0