UNPKG

@mbc-cqrs-serverless/sequence

Version:

Generate increment sequence with time-rotation

107 lines 4.98 kB
"use strict"; 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; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GenerateFormattedSequenceWithProvidedSettingDto = void 0; const swagger_1 = require("@nestjs/swagger"); const class_transformer_1 = require("class-transformer"); const class_validator_1 = require("class-validator"); const rotate_by_enum_1 = require("../enums/rotate-by.enum"); const sequence_param_dto_1 = require("./sequence-param.dto"); class GenerateFormattedSequenceWithProvidedSettingDto { } exports.GenerateFormattedSequenceWithProvidedSettingDto = GenerateFormattedSequenceWithProvidedSettingDto; __decorate([ (0, class_validator_1.IsOptional)(), (0, class_transformer_1.Type)(() => Date), (0, swagger_1.ApiProperty)({ type: Date, required: false, description: 'Date for sequence generation.', }), __metadata("design:type", Date /** * Rotation criteria for the sequence (e.g., yearly, fiscal-yearly). */ ) ], GenerateFormattedSequenceWithProvidedSettingDto.prototype, "date", void 0); __decorate([ (0, swagger_1.ApiProperty)({ enum: rotate_by_enum_1.RotateByEnum, example: rotate_by_enum_1.RotateByEnum.FISCAL_YEARLY }), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsEnum)(rotate_by_enum_1.RotateByEnum), __metadata("design:type", String) ], GenerateFormattedSequenceWithProvidedSettingDto.prototype, "rotateBy", void 0); __decorate([ (0, class_validator_1.IsString)(), (0, swagger_1.ApiProperty)(), __metadata("design:type", String) ], GenerateFormattedSequenceWithProvidedSettingDto.prototype, "tenantCode", void 0); __decorate([ (0, class_validator_1.IsString)(), (0, swagger_1.ApiProperty)(), __metadata("design:type", String) ], GenerateFormattedSequenceWithProvidedSettingDto.prototype, "typeCode", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsObject)(), (0, swagger_1.ApiProperty)({ type: sequence_param_dto_1.SequenceParamsDto, description: 'Parameters for generating the sequence. code1, code2, code3, code4, code5', }), __metadata("design:type", sequence_param_dto_1.SequenceParamsDto /** * Optional prefix to add before formatted sequence. */ ) ], GenerateFormattedSequenceWithProvidedSettingDto.prototype, "params", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)(), (0, swagger_1.ApiProperty)({ required: false, description: 'Optional prefix to prepend to the formatted sequence.', }), __metadata("design:type", String) ], GenerateFormattedSequenceWithProvidedSettingDto.prototype, "prefix", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)(), (0, swagger_1.ApiProperty)({ required: false, description: 'Optional postfix to append to the formatted sequence.', }), __metadata("design:type", String) ], GenerateFormattedSequenceWithProvidedSettingDto.prototype, "postfix", void 0); __decorate([ (0, class_validator_1.IsString)(), (0, swagger_1.ApiProperty)({ description: 'Format string defining the structure of the generated sequence. Example: "YYMM-SEQ".', }), __metadata("design:type", String) ], GenerateFormattedSequenceWithProvidedSettingDto.prototype, "format", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)(), (0, swagger_1.ApiProperty)({ required: false, description: 'Optional registration date to influence fiscal year calculation. Format: ISO 8601.', }), __metadata("design:type", String) ], GenerateFormattedSequenceWithProvidedSettingDto.prototype, "registerDate", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsNumber)(), (0, swagger_1.ApiProperty)({ required: false, description: 'Starting month of the fiscal year (1–12). Defaults to 4 (April) if not provided.', }), __metadata("design:type", Number) ], GenerateFormattedSequenceWithProvidedSettingDto.prototype, "startMonth", void 0); //# sourceMappingURL=generate-formatted-sequence-with-provided-setting.dto.js.map