- Add auth_test.go with setupTestDB/setupAuthService helpers using SQLite in-memory database and GORM AutoMigrate
- Add TestAuthService_Register with duplicate username/email validation and invalid role handling
- Add TestAuthService_Login with invalid username/password checks and inactive user validation
- Add TestJWTService_GenerateToken with database session verification and token storage validation
- Add TestJWTService_ValidateToken with invalid
- Add AutomationService struct with database dependency and NewAutomationService constructor
- Add AutomationFilter struct with enabled/type fields for filtering automations
- Add List method with enabled/type filtering, created_at DESC ordering, and context support
- Add Get method with ID lookup, gorm.ErrRecordNotFound handling, and error wrapping
- Add CreateAutomationInput struct with name/description/type/enabled
- Add AuthHandler struct with authService dependency and NewAuthHandler constructor
- Add LoginRequest/LoginResponse/RegisterRequest/ChangePasswordRequest structs with validation tags
- Add Login method with username/password validation, token generation, and user response
- Add Register method with email/password/role validation and user creation
- Add RefreshToken method with JWT refresh token validation
- Add CachedDatabase struct wrapping Database with cache.Cache field and NewCachedDatabase constructor
- Add CachedFind method with cache key generation from query/args, cache hit deserialization, database fallback on miss, and 5-minute TTL
- Add CachedFirst method with same caching pattern as CachedFind for single record queries
- Add InvalidateCache method for clearing all cache entries and InvalidateCacheKey
- Add ConfigStoreService struct with database dependency and NewConfigStoreService constructor
- Add List method with optional section filtering, section/key ordering, and sensitive value masking (********)
- Add UpsertConfigInput struct with section/key/value/type/sensitive/description/updated_by fields and required validation
- Add Upsert method with section+key lookup, default
- Add error code constants for validation/auth/resource/system/business logic errors (VALIDATION_FAILED/UNAUTHORIZED/NOT_FOUND/INTERNAL_ERROR/etc)
- Add EnhancedErrorResponse with error/code/details/context/timestamp/request_id fields and ValidationErrorResponse with field-specific errors array
- Add handleError function with gorm.ErrRecordNotFound/ErrDuplicatedKey/ErrInvalidData handling
- Add CasbinService struct with enforcer/db fields and NewCasbinService constructor with GORM adapter initialization
- Add Casbin model configuration with request_definition/policy_definition/role_definition/policy_effect/matchers for RBAC
- Add initializeDefaultPolicies with admin (full access), operator (manage services/monitoring), and viewer (read-only) role permissions
- Add CheckPermission method
- Replace interface{} with any in sendDeactivationRequest method signature in es2_helpers.go
- Add plugin_service_test.go with setupPluginTest helper using in-memory SQLite and gorm.AutoMigrate
- Add TestPluginService_List with test cases for all/enabled/disabled/by-type filtering and no matches
- Add TestPluginService_Install with tests for successful install, duplicate prevention, and missing fields
- Add Subscriber model with IMSI/MSISDN/email/status/plan_id/profile_status fields and validation examples
- Add Service model with name/namespace/replicas/ready_replicas/available_replicas/creation_timestamp fields
- Add Deployment model with service/version/status/started_at/completed_at/metadata fields and status enum
- Add Plugin model with name/version/author/description/enabled/config fields
- Add Automation model with name/description/trigger/
- Add DeploymentService struct with database dependency and NewDeploymentService constructor
- Add DeploymentFilter struct with Service/Environment/Status/Limit/Offset fields for query filtering
- Add List method with context support, filter application (service/environment/status), pagination (default limit: 20), and DESC ordering by created_at
- Add Get method with gorm.ErrRecordNotFound handling and formatted
- Add websocket.Upgrader with CheckOrigin allowing all origins in development
- Add Message struct with type/data/timestamp fields for WebSocket messages
- Add Client struct with conn/send/mutex/closed fields and readPump/writePump/Close methods
- Add Hub struct with clients map, broadcast/register/unregister channels, and sync.RWMutex
- Add NewHub constructor and Run method with client registration/
- Add PluginService struct with database dependency and NewPluginService constructor
- Add PluginFilter struct with Enabled/Type/Category fields for query filtering
- Add List method with context support, filter application (enabled/type/category), and DESC ordering by installed_at
- Add Get method with gorm.ErrRecordNotFound handling and formatted error messages
- Add InstallPluginInput struct with name/
- Add PrometheusService struct with baseURL/http.Client (10s timeout) and PROMETHEUS_URL env config (default: http://prometheus:9090)
- Add Available method with /-/ready endpoint health check
- Add Query method with instant PromQL execution via /api/v1/query, URL escaping, error handling
- Add promResponse/promVectorData/PromVectorSample structs for query result parsing with metric/value fields
- Update GetSystemStats to query active sessions, total accounts, blocked users, and low balance alerts from database
- Update GetHealthStatus to check database connectivity and set ActiveSync status
- Update GetUsageStats to query usage events by IMSI and period with trend calculation comparing to previous period
- Update GetRealTimeUsage to query current session and today's usage from database
- Update ListUsageEvents to query usage events with
- Add WebhookHandler with Stripe webhook validation and event processing
- Add webhook event handlers: payment succeeded, failed, canceled, and dispute created
- Update transaction status and subscriber balance on successful payments
- Create alerts for failed payments and disputes with appropriate severity levels
- Add sendTopUpNotification to create notifications for successful top-ups
- Add PaymentController
- Add Balance float64 field to Subscriber struct with JSON and GORM tags
- Set default value to 0 in database schema
- Align PlanID and Status field formatting
- Add stripeGW field to SubscriberService and initialize in NewSubscriberService with API key and webhook secret
- Add processPaymentToken to call Stripe API and retrieve payment method details from token
- Update AddPaymentMethod to call processPaymentToken and use real card details (last4, brand, expiry dates) from Stripe
- Update AddPaymentMethod to use req.IsDefault instead of hardcoded false value
- Import
- Add TimeSeriesStorage with InfluxDB client, write API, and query API for org/bucket
- Add metric types: MetricPoint, UsageMetrics, SystemMetrics, ChargingMetrics with subscriber/IMSI/transaction fields
- Add StoreUsageMetrics, StoreSystemMetrics, StoreChargingMetrics, and StorePacketMetrics to write metrics to InfluxDB
- Add GetUsageStats to query subscriber usage statistics for time range with last aggreg
- Add CreateTransaction to insert new transaction records
- Add UpdateSubscriberBalance to increment/decrement balance using SQL expression
- Add CreatePaymentMethod, GetPaymentMethod, DeletePaymentMethod, and ListPaymentMethods for payment method CRUD
- Add GetTransaction, GetTransactionByGatewayID, GetTransactionByChargeID to query transactions by different IDs
- Add UpdateTransaction to save transaction changes
- Add List
- Add StripeGateway with secret key, webhook secret, and HTTP client with 30s timeout
- Add ProcessPayment to create payment intents with amount conversion to cents and metadata
- Add CreateCustomer to create Stripe customers with subscriber details and IMSI metadata
- Add ProcessRefund to process full or partial refunds via payment intent ID
- Add GetPaymentStatus to retrieve payment intent status and details
- Update SubscribeToSubscriberUpdates to poll database every 3 seconds for subscriber changes since last update
- Add buffered channel (size 5) to prevent blocking on subscriber updates
- Track lastUpdatedAt timestamp to query only new subscriber changes
- Add SubscribeToAlertUpdates to poll database every 2 seconds for new alerts
- Add buffered channel (size 10) for alert updates with ID-based filtering
- Support optional
- Update GetAccount to query actual usage events and balance from database instead of returning zeros
- Update ListInvoices to query invoices with filters, pagination, and preload subscriber data
- Update GetInvoice to query invoice by ID with line items and subscriber preloading
- Update ListRatingPlans to query active rating plans ordered by monthly fee
- Update GetRatingPlan to query rating plan by ID with active
- Add ChargingEngineClient with base URL and HTTP client with configurable timeout
- Add CheckCredit to verify subscriber credit availability by IP with bytes requested
- Add DeductCredit to deduct bytes from subscriber credit balance
- Add AddCredit to add bytes to subscriber credit balance
- Add GetBalance to retrieve current credit balance for subscriber by IP
- Add HealthCheck to verify charging engine availability
- Add ChargingService with database and charging engine client dependencies
- Add GetSystemStats to retrieve active sessions, accounts, blocked users, and uptime metrics
- Add GetHealthStatus to check Redis connection, sync status, and memory usage
- Add GetUsageStats to get subscriber usage statistics with data/voice/SMS volumes, costs, and trends
- Add GetRealTimeUsage to track current session and today's usage metrics
- Add InvoiceService with database dependency for invoice management operations
- Add GenerateMonthlyInvoice to create invoices with plan fees and usage charges from billing period
- Add SendInvoice to update invoice status to pending (email integration TODO)
- Add MarkInvoiceAsPaid to update invoice payment status
- Add GetOverdueInvoices to query invoices past due date with pending status
- Add GetSubscriber
- Add SubscriberAccount with balance, usage limits (data/voice/SMS), and status tracking
- Add UsageEvent for tracking usage sessions with volume, rate, and cost
- Add Invoice with line items and status (DRAFT, PENDING, PAID, OVERDUE, CANCELLED)
- Add RatingPlan with rate definitions for data/voice/SMS and monthly fees
- Add Alert with types (LOW_BALANCE, HIGH_USAGE, PAYMENT_FAILED, SYSTEM_ERROR) and severity levels
- Add Pay
- Add PaymentConfig with Stripe API key and webhook secret fields
- Add ChargingEngineConfig with base URL and timeout settings
- Add InfluxDBConfig with URL, token, org, and bucket fields
- Add MetricsPort field to ServerConfig for Prometheus metrics endpoint
- Set default values: MetricsPort 9090, ChargingEngine localhost:3001, InfluxDB localhost:8086
- Update Config struct to include Payment, ChargingEngine, and Infl
- Add main server setup with Gin router, GraphQL handler, and graceful shutdown
- Initialize database connection and metrics collectors (Prometheus and InfluxDB time-series)
- Add HTTP middleware for Prometheus metrics collection
- Add /metrics endpoint for Prometheus scraping and /health endpoint for health checks
- Implement periodic metrics collection (30s interval) for subscribers, sessions, and system
- Add GetAccount to retrieve subscriber account information with balance and usage limits
- Add ListInvoices/GetInvoice for invoice management with line items
- Add ListRatingPlans/GetRatingPlan for rating plan queries
- Add ListAlerts/CreateAlert/ResolveAlert for alert management
- Add SearchSubscribers for subscriber search functionality
- Add SubscribeToSubscriberUpdates/SubscribeToAlertUpdates
- Add parseID tests for valid IDs, invalid format, and zero values
- Add encodeCursor/decodeCursor tests for base64 cursor encoding/decoding with valid and invalid inputs
- Add buildUsageFilterWhere tests for empty filters, usage type filtering, and cost range filtering
- Add ResolverRoot method tests to verify Query/Mutation/Subscription return receiver
- Include helper function implementations (encodeCursor, decodeCursor, buildUsageFilterWhere)