feat: Implement feature flag system with helpers, service, and loader
- Added feature flag helpers and decorators for easy usage in commands. - Created a feature flag service for managing flags, including initialization, caching, and evaluation strategies. - Implemented a loader to initialize the feature flag service on bot startup. - Defined types for feature flags, including configurations, contexts, evaluations, and statistics. - Provided examples of feature flag usage in commands, demonstrating various patterns such as A/B testing, gradual rollouts, and access control.
This commit is contained in:
@@ -1052,3 +1052,40 @@ model DeathLog {
|
||||
@@index([userId, guildId])
|
||||
@@index([createdAt])
|
||||
}
|
||||
|
||||
/**
|
||||
* -----------------------------------------------------------------------------
|
||||
* Sistema de Feature Flags
|
||||
* -----------------------------------------------------------------------------
|
||||
* Control de features para rollouts progresivos, A/B testing y toggles
|
||||
* Permite activar/desactivar funcionalidades sin deployar código
|
||||
*/
|
||||
model FeatureFlag {
|
||||
id String @id @default(cuid())
|
||||
name String @unique
|
||||
|
||||
description String?
|
||||
status String @default("disabled") // enabled|disabled|rollout|maintenance
|
||||
|
||||
// Nivel de aplicación: global, guild, user, channel
|
||||
target String @default("global")
|
||||
|
||||
// Estrategia de rollout (para status = rollout)
|
||||
rolloutStrategy String? // percentage|whitelist|blacklist|gradual|random
|
||||
|
||||
// Configuración de la estrategia (JSON)
|
||||
rolloutConfig String? // JSON serializado
|
||||
|
||||
// Fechas de inicio/fin
|
||||
startDate DateTime?
|
||||
endDate DateTime?
|
||||
|
||||
// Metadata adicional
|
||||
metadata String? // JSON serializado
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([status])
|
||||
@@index([target])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user