Files
aura-crm/production/backend/internal/featuremodules/validate.go
T

25 lines
1.1 KiB
Go

// Package featuremodules lets an owner turn whole business sections on or
// off — Магазин, Справочники, Картриджи — hiding their nav entries for
// every staff role. Separate from core's own `modules` table (external
// service registry with health checks, and where the actual online store
// module lives); this is a same-deployment feature flag, not a service
// pointer. "service" (orders/kanban/warehouse/cash) is intentionally not a
// toggleable key here — it's the permanent fallback a staff member lands on
// if their current section gets disabled, so there's never a state where
// nothing is left to show.
package featuremodules
// validKeys is the fixed, known set of toggleable modules — a Go-side
// allowlist rather than a DB CHECK constraint so adding a new one later is
// a code change plus a migration INSERT, not a constraint rewrite.
var validKeys = map[string]bool{
"online_shop": true,
"catalogs": true,
"cartridges": true,
"delivery": true,
}
func isValidKey(key string) bool {
return validKeys[key]
}