@ptc-org/nestjs-query-graphql
Version:
Nestjs graphql query adapter
41 lines • 1.7 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateManyInputType = CreateManyInputType;
const tslib_1 = require("tslib");
const graphql_1 = require("@nestjs/graphql");
const class_transformer_1 = require("class-transformer");
const class_validator_1 = require("class-validator");
/**
* The abstract input type for create many input types.
* @param fieldName - the name of field to be exposed in the graphql schema
* @param InputClass - the InputType to be used.
*/
// eslint-disable-next-line @typescript-eslint/no-redeclare -- intentional
function CreateManyInputType(fieldName, InputClass) {
var _a;
let CreateManyInput = class CreateManyInput {
get [_a = fieldName]() {
return this.input;
}
set [fieldName](input) {
this.input = input;
}
};
tslib_1.__decorate([
(0, class_transformer_1.Type)(() => InputClass),
(0, class_validator_1.ArrayNotEmpty)(),
(0, class_validator_1.ValidateNested)({ each: true }),
(0, graphql_1.Field)(() => [InputClass], { description: 'Array of records to create', name: fieldName }),
tslib_1.__metadata("design:type", Array)
], CreateManyInput.prototype, "input", void 0);
tslib_1.__decorate([
(0, class_transformer_1.Type)(() => InputClass),
tslib_1.__metadata("design:type", Array),
tslib_1.__metadata("design:paramtypes", [])
], CreateManyInput.prototype, _a, null);
CreateManyInput = tslib_1.__decorate([
(0, graphql_1.InputType)({ isAbstract: true })
], CreateManyInput);
return CreateManyInput;
}
//# sourceMappingURL=create-many-input.type.js.map
;