Created
June 10, 2020 13:07
-
-
Save ojhaujjwal/a8de8b0967a0fa14b05f88ce36b46bcc to your computer and use it in GitHub Desktop.
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
import { Controller, ControllerOptions } from '@nestjs/common'; | |
import { join } from 'path'; | |
import { AuthenticationGuard, AccessControlGuard } from 'app/guards'; | |
expose function AdminController(options: ControllerOptions) { | |
return function (target: Function) { | |
Controller(join('/admin', options.path))(target); | |
AuthenticationGuard()(target); | |
AccessControlGuard({ role: 'admin' })(target); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment