routing-controllers
Version:
Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript.
24 lines • 985 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.SessionParam = SessionParam;
const index_1 = require("../index");
/**
* Injects a Session object property to the controller action parameter.
* Must be applied on a controller action parameter.
*/
function SessionParam(propertyName, options) {
return function (object, methodName, index) {
(0, index_1.getMetadataArgsStorage)().params.push({
type: 'session-param',
object: object,
method: methodName,
index: index,
name: propertyName,
parse: false, // it makes no sense for Session object to be parsed as json
required: options && options.required !== undefined ? options.required : false,
classTransform: options && options.transform,
validate: options && options.validate !== undefined ? options.validate : false,
});
};
}
//# sourceMappingURL=SessionParam.js.map
;