@eddaic/nestjs-decorators
Version:
Additional decorators intended for use with NestJS framework.
27 lines (26 loc) • 1.28 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParseBigIntPipe = void 0;
const common_1 = require("@nestjs/common");
const transformer_1 = require("../transformer");
let ParseBigIntPipe = class ParseBigIntPipe {
transform(value, metadata) {
const bigIntValue = (0, transformer_1.transformBigInt)(value);
if (bigIntValue === null) {
throw new common_1.BadRequestException(`${metadata.data} must be a valid bigint`);
}
else {
return bigIntValue;
}
}
};
exports.ParseBigIntPipe = ParseBigIntPipe;
exports.ParseBigIntPipe = ParseBigIntPipe = __decorate([
(0, common_1.Injectable)()
], ParseBigIntPipe);