template-saas/apps/backend/dist/modules/feature-flags/dto/create-flag.dto.js
rckrdmrd 26f0e52ca7 feat: Initial commit - template-saas
Template base para proyectos SaaS multi-tenant.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React/Vite)
- apps/database (PostgreSQL DDL)
- docs/ (Documentación)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:24 -06:00

93 lines
4.5 KiB
JavaScript

"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.CreateFlagDto = void 0;
const class_validator_1 = require("class-validator");
const swagger_1 = require("@nestjs/swagger");
const feature_flag_entity_1 = require("../entities/feature-flag.entity");
class CreateFlagDto {
constructor() {
this.flag_type = feature_flag_entity_1.FlagType.BOOLEAN;
this.scope = feature_flag_entity_1.FlagScope.GLOBAL;
this.is_enabled = false;
}
}
exports.CreateFlagDto = CreateFlagDto;
__decorate([
(0, swagger_1.ApiProperty)({ description: 'Unique flag key (lowercase, underscores allowed)' }),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(100),
(0, class_validator_1.Matches)(/^[a-z][a-z0-9_]*$/, {
message: 'Key must start with lowercase letter and contain only lowercase letters, numbers, and underscores',
}),
__metadata("design:type", String)
], CreateFlagDto.prototype, "key", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ description: 'Human-readable flag name' }),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(255),
__metadata("design:type", String)
], CreateFlagDto.prototype, "name", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ description: 'Flag description' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], CreateFlagDto.prototype, "description", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ description: 'Flag value type', enum: feature_flag_entity_1.FlagType }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsEnum)(feature_flag_entity_1.FlagType),
__metadata("design:type", String)
], CreateFlagDto.prototype, "flag_type", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ description: 'Flag scope', enum: feature_flag_entity_1.FlagScope }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsEnum)(feature_flag_entity_1.FlagScope),
__metadata("design:type", String)
], CreateFlagDto.prototype, "scope", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ description: 'Default value for the flag' }),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", Object)
], CreateFlagDto.prototype, "default_value", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ description: 'Is flag enabled globally' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], CreateFlagDto.prototype, "is_enabled", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ description: 'Targeting rules for conditional evaluation' }),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", Object)
], CreateFlagDto.prototype, "targeting_rules", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ description: 'Rollout percentage (0-100)' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
(0, class_validator_1.Min)(0),
(0, class_validator_1.Max)(100),
__metadata("design:type", Number)
], CreateFlagDto.prototype, "rollout_percentage", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ description: 'Category for grouping flags' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(100),
__metadata("design:type", String)
], CreateFlagDto.prototype, "category", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ description: 'Additional metadata' }),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", Object)
], CreateFlagDto.prototype, "metadata", void 0);
//# sourceMappingURL=create-flag.dto.js.map