Skip to content

nodejs app to handle leave application submission and approval

Notifications You must be signed in to change notification settings

eksha/leave-application-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leave-application-manager

NodeJS app to handle leave application submission and approval.

The App involves APIs for two roles of users : Employee and Manager.

Start the app

Run node start or node server.js

Employee API

1. Get details of previous applications

http://localhost:8092/username
This returns json array of all the leave applications previously submitted. username is the username field from User collection.

2. Submit new leave application

POST request URL
http://localhost:8092/username
The request body must contain leave schema as:

{
  startdate: String,
  enddate:String,
  leavetype:{type: String, enum :['Earned Leave','Sick Leave','Casual Leave','Maternity Leave']},
  reason:{type:String, default:"Not Specified"},
}

Manager API

1. Review all the leave applications

GET request URL
http://localhost:8092/username
This request returns all the leave applications in the system.

2. Approve a leave application

PUT request URL
http://localhost:8092/username/leaveId

This request will change the approvalStatus of leave application with _id as leaveId to true. The default approvalStatus is false.

Authentication

The api endpoints check for the role of the username to allow access.

About

nodejs app to handle leave application submission and approval

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published