UNPKG

@ackplus/nest-dynamic-templates

Version:

Dynamic template management for NestJS applications

128 lines 6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NestDynamicTemplate = void 0; const tslib_1 = require("tslib"); const typeorm_1 = require("typeorm"); const template_types_1 = require("../interfaces/template.types"); const class_validator_1 = require("class-validator"); const swagger_1 = require("@nestjs/swagger"); let NestDynamicTemplate = class NestDynamicTemplate extends typeorm_1.BaseEntity { }; exports.NestDynamicTemplate = NestDynamicTemplate; tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String, format: 'uuid', readOnly: true }), (0, typeorm_1.PrimaryGeneratedColumn)('uuid'), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "id", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String }), (0, class_validator_1.IsString)(), (0, class_validator_1.IsNotEmpty)(), (0, class_validator_1.Matches)(/^[a-z0-9\-_]+$/, { message: 'Invalid template name format' }), (0, typeorm_1.Column)(), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "name", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String, nullable: true }), (0, class_validator_1.IsString)(), (0, class_validator_1.IsOptional)(), (0, typeorm_1.Column)({ nullable: true }), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "displayName", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String, nullable: true }), (0, class_validator_1.IsString)(), (0, class_validator_1.IsOptional)(), (0, typeorm_1.Column)({ type: 'text', nullable: true }), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "description", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String, nullable: true }), (0, class_validator_1.IsString)(), (0, class_validator_1.IsOptional)(), (0, typeorm_1.Column)({ type: 'text', nullable: true }), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "type", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateEngineEnum, type: String }), (0, class_validator_1.IsEnum)(template_types_1.TemplateEngineEnum), (0, typeorm_1.Column)({ type: 'text', enum: template_types_1.TemplateEngineEnum, default: template_types_1.TemplateEngineEnum.NUNJUCKS }), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "engine", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ enum: template_types_1.TemplateLanguageEnum, type: String, nullable: true }), (0, class_validator_1.IsEnum)(template_types_1.TemplateLanguageEnum), (0, class_validator_1.IsOptional)(), (0, typeorm_1.Column)({ type: 'text' }), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "language", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String, nullable: true }), (0, class_validator_1.IsString)(), (0, class_validator_1.IsOptional)(), (0, typeorm_1.Column)({ nullable: true }), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "subject", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String }), (0, class_validator_1.IsString)(), (0, class_validator_1.IsOptional)(), (0, typeorm_1.Column)('text'), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "content", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String, nullable: true }), (0, class_validator_1.IsString)(), (0, class_validator_1.IsOptional)(), (0, typeorm_1.Column)({ nullable: true }), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "templateLayoutName", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String, nullable: true }), (0, class_validator_1.IsString)(), (0, typeorm_1.Column)({ nullable: true, default: 'system' }), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "scope", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String, nullable: true }), (0, class_validator_1.IsString)(), (0, typeorm_1.Column)({ nullable: true }), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "scopeId", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: String, nullable: true }), (0, class_validator_1.IsString)(), (0, typeorm_1.Column)({ nullable: true, default: 'en' }), tslib_1.__metadata("design:type", String) ], NestDynamicTemplate.prototype, "locale", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: Object, nullable: true }), (0, class_validator_1.IsOptional)(), (0, typeorm_1.Column)('simple-json', { nullable: true }), tslib_1.__metadata("design:type", Object) ], NestDynamicTemplate.prototype, "previewContext", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: Boolean }), (0, class_validator_1.IsBoolean)(), (0, typeorm_1.Column)({ default: true }), tslib_1.__metadata("design:type", Boolean) ], NestDynamicTemplate.prototype, "isActive", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: Date, readOnly: true }), (0, typeorm_1.CreateDateColumn)(), tslib_1.__metadata("design:type", Date) ], NestDynamicTemplate.prototype, "createdAt", void 0); tslib_1.__decorate([ (0, swagger_1.ApiProperty)({ type: Date, readOnly: true }), (0, typeorm_1.UpdateDateColumn)(), tslib_1.__metadata("design:type", Date) ], NestDynamicTemplate.prototype, "updatedAt", void 0); exports.NestDynamicTemplate = NestDynamicTemplate = tslib_1.__decorate([ (0, typeorm_1.Entity)('nest_dynamic_templates'), (0, typeorm_1.Index)(['name', 'scope', 'scopeId', 'locale'], { unique: true }) ], NestDynamicTemplate); //# sourceMappingURL=template.entity.js.map