UNPKG

@wepublish/api

Version:
116 lines 4.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UpdateSettingInput = exports.SettingFilter = exports.Setting = exports.SettingRestriction = exports.AllowedSettingVals = exports.GraphQLSettingValueType = void 0; const tslib_1 = require("tslib"); const graphql_1 = require("@nestjs/graphql"); const setting_1 = require("./setting"); const common_1 = require("@nestjs/common"); (0, graphql_1.registerEnumType)(setting_1.SettingName, { name: 'SettingName' }); let GraphQLSettingValueType = exports.GraphQLSettingValueType = class GraphQLSettingValueType { constructor() { this.description = 'Setting Value'; } serialize(value) { return value; } parseValue(value) { return value; } parseLiteral(ast) { switch (ast.kind) { case 'StringValue': return ast.value; case 'BooleanValue': return ast.value; case 'IntValue': return parseInt(ast.value, 10); case 'FloatValue': return parseFloat(ast.value); default: throw new common_1.BadRequestException(`Value scalar error: cannot handle kind: ${ast.kind}`); } } }; exports.GraphQLSettingValueType = GraphQLSettingValueType = tslib_1.__decorate([ (0, graphql_1.Scalar)('GraphQLSettingValueType') ], GraphQLSettingValueType); let AllowedSettingVals = exports.AllowedSettingVals = class AllowedSettingVals { }; tslib_1.__decorate([ (0, graphql_1.Field)(type => [String], { nullable: true }), tslib_1.__metadata("design:type", Array) ], AllowedSettingVals.prototype, "stringChoice", void 0); tslib_1.__decorate([ (0, graphql_1.Field)({ nullable: true }), tslib_1.__metadata("design:type", Boolean) ], AllowedSettingVals.prototype, "boolChoice", void 0); exports.AllowedSettingVals = AllowedSettingVals = tslib_1.__decorate([ (0, graphql_1.ObjectType)() ], AllowedSettingVals); let SettingRestriction = exports.SettingRestriction = class SettingRestriction { }; tslib_1.__decorate([ (0, graphql_1.Field)(type => graphql_1.Int, { nullable: true }), tslib_1.__metadata("design:type", Number) ], SettingRestriction.prototype, "maxValue", void 0); tslib_1.__decorate([ (0, graphql_1.Field)(type => graphql_1.Int, { nullable: true }), tslib_1.__metadata("design:type", Number) ], SettingRestriction.prototype, "minValue", void 0); tslib_1.__decorate([ (0, graphql_1.Field)(type => graphql_1.Int, { nullable: true }), tslib_1.__metadata("design:type", Number) ], SettingRestriction.prototype, "inputLength", void 0); tslib_1.__decorate([ (0, graphql_1.Field)(type => AllowedSettingVals, { nullable: true }), tslib_1.__metadata("design:type", AllowedSettingVals) ], SettingRestriction.prototype, "allowedValues", void 0); exports.SettingRestriction = SettingRestriction = tslib_1.__decorate([ (0, graphql_1.ObjectType)() ], SettingRestriction); let Setting = exports.Setting = class Setting { }; tslib_1.__decorate([ (0, graphql_1.Field)(type => graphql_1.ID), tslib_1.__metadata("design:type", String) ], Setting.prototype, "id", void 0); tslib_1.__decorate([ (0, graphql_1.Field)(type => setting_1.SettingName), tslib_1.__metadata("design:type", String) ], Setting.prototype, "name", void 0); tslib_1.__decorate([ (0, graphql_1.Field)(type => GraphQLSettingValueType, { nullable: true }), tslib_1.__metadata("design:type", Object) ], Setting.prototype, "value", void 0); tslib_1.__decorate([ (0, graphql_1.Field)(type => SettingRestriction, { nullable: true }), tslib_1.__metadata("design:type", SettingRestriction) ], Setting.prototype, "settingRestriction", void 0); exports.Setting = Setting = tslib_1.__decorate([ (0, graphql_1.ObjectType)() ], Setting); let SettingFilter = exports.SettingFilter = class SettingFilter { }; tslib_1.__decorate([ (0, graphql_1.Field)({ nullable: true }), tslib_1.__metadata("design:type", String) ], SettingFilter.prototype, "name", void 0); exports.SettingFilter = SettingFilter = tslib_1.__decorate([ (0, graphql_1.InputType)() ], SettingFilter); let UpdateSettingInput = exports.UpdateSettingInput = class UpdateSettingInput { }; tslib_1.__decorate([ (0, graphql_1.Field)(type => setting_1.SettingName), tslib_1.__metadata("design:type", String) ], UpdateSettingInput.prototype, "name", void 0); tslib_1.__decorate([ (0, graphql_1.Field)(type => GraphQLSettingValueType), tslib_1.__metadata("design:type", Object) ], UpdateSettingInput.prototype, "value", void 0); exports.UpdateSettingInput = UpdateSettingInput = tslib_1.__decorate([ (0, graphql_1.ArgsType)() ], UpdateSettingInput); //# sourceMappingURL=settings.model.js.map