Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
docs: routes part 5
Browse files Browse the repository at this point in the history
  • Loading branch information
kndonetm committed Nov 29, 2023
1 parent 2069883 commit f7541e6
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/routes/officers.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ router.get('/:id', async (req, res, next) => {
* @function
* @memberof module:routes/officers~router-officers
* @inner
*
* @param {String} password - Updated password of admin.
*/
router.patch('/admin/password', async (req, res, next) => {
passport.authenticate('admin', { session: false }, async (err, admin, info) => {
Expand Down Expand Up @@ -120,13 +122,16 @@ router.patch('/admin/password', async (req, res, next) => {
* PATCH /:id/password
*
* Update officer's password by UUID. This route is only accessible to the admin.
* id is the ID of the officer whose password is being updated.
*
* Request body must be a JSON object containing the fields specified in the `parameters` section.
*
* @name patch/:id/password
* @function
* @memberof module:routes/officers~router-officers
* @inner
*
* @param {String} password - Updated password of officer.
*/
router.patch('/:id/password', async (req, res, next) => {
passport.authenticate('admin', { session: false }, async (err, admin, info) => {
Expand Down Expand Up @@ -158,7 +163,7 @@ router.patch('/:id/password', async (req, res, next) => {
*
* Mark officer as inactive by UUID. This route is only accessible to the admin.
*
* Request body must be a JSON object containing the fields specified in the `parameters` section.
* id represents the ID of the officer being marked as inactive.
*
* @name delete/:id
* @function
Expand Down
21 changes: 20 additions & 1 deletion src/routes/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,22 @@ router.get('/loans', async (req, res, next) => {
/**
* PATCH /loans/:loanType
*
* Edit the settings of a given loan type
* Edit the settings of a given loan type.
*
* loanType is the loan type whose settings should be edited.
*
* Request body must be a JSON object containing the fields specified in the `parameters` section.
*
* @name patch/loans/:loanType
* @function
* @memberof module:routes/settings~router-settings
* @inner
*
* @param {MandatoryIndividualSettingSchema} interest_rate -The interest rate of the current loan type. Used for automatic interest calculations.
* @param {IndividualSettingSchema} service_fee - Initial service fees for the current loan type. Deducted from the loan value upon loan approval.
* @param {IndividualSettingSchema} capital_build_up - Capital build-up fee for the current loan type. Deducted from the loan value upon loan approval.
* @param {IndividualSettingSchema} savings - Savings contribution for the current loan type. Deducted from the loan value upon loan approval.
* @param {TimeSettingSchema} time - Time period between interest applications.
*/
router.patch('/loans/:loanType', async (req, res, next) => {
passport.authenticate('admin', { session: false }, async (err, admin, info) => {
Expand Down Expand Up @@ -109,12 +117,17 @@ router.get('/deposits', async (req, res, next) => {
*
* Edit the settings of a given deposit type
*
* depositType is the deposit type whose settings should be edited.
*
* Request body must be a JSON object containing the fields specified in the `parameters` section.
*
* @name patch/deposits/:depositType
* @function
* @memberof module:routes/settings~router-settings
* @inner
*
* @param {MandatoryIndividualSettingSchema} interest_rate - Interest rate of the deposit type.
* @param {TimeSettingSchema} time - Time period between interest applications.
*/
router.patch('/deposits/:depositType', async (req, res, next) => {
passport.authenticate('admin', { session: false }, async (err, admin, info) => {
Expand Down Expand Up @@ -175,6 +188,12 @@ router.get('/notifications', async (req, res, next) => {
* @function
* @memberof module:routes/settings~router-settings
* @inner
*
* @param {Number} reminder - How close to the deadline a loan has to be for it to warrant a reminder.
* @param {Number} first_notice - How close to the deadline a loan has to be for it to warrant a first notice.
* @param {Number} second_notice - How close to the deadline a loan has to be for it to warrant a second notice.
* @param {Number} third_notice - How close to the deadline a loan has to be for it to warrant a third notice.
* @param {Number} demand_letter - How close to the deadline a loan has to be for it to warrant a demand letter.
*/
router.patch('/notifications', async (req, res, next) => {
passport.authenticate('admin', { session: false }, async (err, admin, info) => {
Expand Down
35 changes: 31 additions & 4 deletions src/routes/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ router.get('/search', async function (req, res, next) {
* @function
* @memberof module:routes/users~router-users
* @inner
*
* @prop {String} username - Username, unique identifier per user.
* @prop {NameSchema} name - User's full name.
* @prop {Date} birthday - User's birthday.
* @prop {String} birthplace - User's birthplace.
* @prop {String} sex - User's sex. Must be either 'M' or 'F'
* @prop {String} civil_status - User's civil status. Must be either 'Single' or 'Married'
* @prop {String} tin_no - TIN number of the user. Must be of the format XXX-XXX-XXX-XXX where X is a number from 0 to 9
* @prop {String} contact_no - User's contact number..
* @prop {Number} monthly_income - Users' monthly income.
* @prop {LocationSchema} address - Users' address.
* @prop {String} occupation - Users' occupation.
* @prop {SpouseSchema} spouse - Users' spouse, if any.
*/
router.put('/', async function (req, res, next) {
passport.authenticate('is-manager', { session: false }, async (err, manager, info) => {
Expand Down Expand Up @@ -119,10 +132,24 @@ router.put('/', async function (req, res, next) {
*
* Request body must be a JSON object containing the fields specified in the `parameters` section.
*
* @name patch/username
* Username should be the username of the user to edit.
*
* @name patch/:username
* @function
* @memberof module:routes/users~router-users
* @inner
*
* @prop {NameSchema} name - User's full name.
* @prop {Date} birthday - User's birthday.
* @prop {String} birthplace - User's birthplace.
* @prop {String} sex - User's sex. Must be either 'M' or 'F'
* @prop {String} civil_status - User's civil status. Must be either 'Single' or 'Married'
* @prop {String} tin_no - TIN number of the user. Must be of the format XXX-XXX-XXX-XXX where X is a number from 0 to 9
* @prop {String} contact_no - User's contact number..
* @prop {Number} monthly_income - Users' monthly income.
* @prop {LocationSchema} address - Users' address.
* @prop {String} occupation - Users' occupation.
* @prop {SpouseSchema} spouse - Users' spouse, if any.
*/
router.patch('/:username', async function (req, res, next) {
passport.authenticate('is-manager', { session: false }, async (err, manager, info) => {
Expand Down Expand Up @@ -154,11 +181,11 @@ router.patch('/:username', async function (req, res, next) {
})

/**
* Delete the information of a user in the users listing.
* Marks a given user as deleted.
*
* Request body must be a JSON object containing the fields specified in the `parameters` section.
* username should be the Username of the user to be marked as deleted.
*
* @name delete/username
* @name delete/:username
* @function
* @memberof module:routes/users~router-users
* @inner
Expand Down

0 comments on commit f7541e6

Please sign in to comment.