-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added descriptor-codes and added documentation for codes
- Loading branch information
1 parent
50f9d24
commit 1c0ffc8
Showing
9 changed files
with
125 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,83 @@ | ||
import express from "express"; | ||
import defaults from "../helpers/defaults"; | ||
import express from 'express'; | ||
require('express-list-endpoints-descriptor')(express); | ||
import defaults from '../helpers/defaults'; | ||
import { IRouter } from '../../types/Router'; | ||
|
||
import validate from "../policies/validate"; | ||
import * as masterValidation from "../helpers/validations"; | ||
import * as MasterController from "../controllers/masterController"; | ||
import validate from '../policies/validate'; | ||
import * as masterValidation from '../helpers/validations'; | ||
import * as MasterController from '../controllers/masterController'; | ||
|
||
const routes: IRouter = express.Router(); | ||
|
||
const routes = express.Router(); | ||
routes.use(express.json()); | ||
|
||
const authenticate = (req: any, res: any, next: any) => { | ||
return defaults.authentication(req, res, next); | ||
}; | ||
|
||
routes.post( | ||
`/create`, | ||
authenticate, | ||
validate(masterValidation.CreateSchema), | ||
MasterController.createMaster | ||
); | ||
// .descriptor("admin.master.create"); | ||
routes.put( | ||
`/update/:id`, | ||
authenticate, | ||
validate(masterValidation.UpdateSchema), | ||
MasterController.updateMaster | ||
); | ||
// .descriptor("admin.master.update"); | ||
routes.patch( | ||
`/partial-update/activate/:id`, | ||
authenticate, | ||
validate(masterValidation.activate), | ||
MasterController.activateMaster | ||
); | ||
// .descriptor("admin.master.active"); | ||
routes.patch( | ||
`/partial-update/default/:id`, | ||
authenticate, | ||
validate(masterValidation.isDefault), | ||
MasterController.defaultMaster | ||
); | ||
// .descriptor("admin.master.default"); | ||
routes.patch( | ||
`/partial-update/web-visible/:id`, | ||
authenticate, | ||
validate(masterValidation.webVisible), | ||
MasterController.webVisibleMaster | ||
); | ||
routes.patch( | ||
`/partial-update/sequence`, | ||
authenticate, | ||
validate(masterValidation.sequence), | ||
MasterController.sequenceMaster | ||
); | ||
// .descriptor("admin.master.sequence"); | ||
routes.put( | ||
`/soft-delete`, | ||
authenticate, | ||
validate(masterValidation.DeleteSchema), | ||
MasterController.softDeleteMaster | ||
); | ||
// .descriptor("admin.master.softDelete"); | ||
routes.post( | ||
`/list`, | ||
authenticate, | ||
validate(masterValidation.ListSchema), | ||
MasterController.listMaster | ||
); | ||
// .descriptor("admin.master.getAll"); | ||
routes | ||
.post( | ||
`/create`, | ||
authenticate, | ||
validate(masterValidation.CreateSchema), | ||
MasterController.createMaster | ||
) | ||
.descriptor('master.create'); | ||
routes | ||
.put( | ||
`/update/:id`, | ||
authenticate, | ||
validate(masterValidation.UpdateSchema), | ||
MasterController.updateMaster | ||
) | ||
.descriptor('master.update'); | ||
routes | ||
.patch( | ||
`/partial-update/activate/:id`, | ||
authenticate, | ||
validate(masterValidation.activate), | ||
MasterController.activateMaster | ||
) | ||
.descriptor('master.active'); | ||
routes | ||
.patch( | ||
`/partial-update/default/:id`, | ||
authenticate, | ||
validate(masterValidation.isDefault), | ||
MasterController.defaultMaster | ||
) | ||
.descriptor('master.default'); | ||
routes | ||
.patch( | ||
`/partial-update/web-visible/:id`, | ||
authenticate, | ||
validate(masterValidation.webVisible), | ||
MasterController.webVisibleMaster | ||
) | ||
.descriptor('master.webVisible'); | ||
routes | ||
.patch( | ||
`/partial-update/sequence`, | ||
authenticate, | ||
validate(masterValidation.sequence), | ||
MasterController.sequenceMaster | ||
) | ||
.descriptor('master.sequence'); | ||
routes | ||
.put( | ||
`/soft-delete`, | ||
authenticate, | ||
validate(masterValidation.DeleteSchema), | ||
MasterController.softDeleteMaster | ||
) | ||
.descriptor('master.softDelete'); | ||
routes | ||
.post( | ||
`/list`, | ||
authenticate, | ||
validate(masterValidation.ListSchema), | ||
MasterController.listMaster | ||
) | ||
.descriptor('master.list'); | ||
|
||
export default routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Router } from 'express'; | ||
|
||
export interface IRouter extends Router { | ||
descriptor?: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters