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

Commit

Permalink
intrn(server): add method to get post policy middlewares
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Oct 15, 2022
1 parent 5644e79 commit acb510f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions server/bases/controller-like.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export default abstract class extends Middleware {
*/
abstract get validations(): Validation[]

/**
* Lists middlewares to run after authorizing the current user.
*/
get postPolicyMiddlewares(): OptionalMiddleware[] { return [] }

/**
* Lists middlewares to run after body parsing is done.
*/
Expand All @@ -54,6 +59,7 @@ export default abstract class extends Middleware {
get middlewares(): OptionalMiddleware[] {
return [
this.policy,
...this.postPolicyMiddlewares,
this.bodyParser,
...this.postParseMiddlewares,
...this.validations,
Expand All @@ -73,16 +79,16 @@ export default abstract class extends Middleware {
get routeInformation(): RouteInformation {
return <RouteInformation>{
...extractRouteInfo(this.filePath),
description: this.description
"description": this.description
}
}

get handlers(): RouteHandlers {
return {
middlewares: this.middlewares,
controller: this.intermediate.bind(this),
postJobs: this.postJobs,
endHandler: this.endHandler
"controller": this.intermediate.bind(this),
"endHandler": this.endHandler,
"middlewares": this.middlewares,
"postJobs": this.postJobs
}
}
}

0 comments on commit acb510f

Please sign in to comment.