Commit Graph
80 Commits
Author SHA1 Message Date
NutcaseandGitHub ea44b746e4 Cli (#6)
* feat: Update Go version to 1.26.1 and add CLI application to workspace

- Update Go version from 1.26 to 1.26.1 in workspace file
- Add ./apps/cli to workspace modules alongside api-server and carrier-connector

* feat: Add CLI application with Bubble Tea TUI framework and configuration management

- Add go.mod and go.sum for CLI application module
- Add Bubble Tea v1.3.10 for terminal UI framework
- Add Charm Bracelet libraries: bubbles v1.0.0, lipgloss v1.1.0 for UI components and styling
- Add Viper v1.21.0 for configuration management
- Add testify v1.11.1 for testing support
- Include dependencies for terminal handling, color profiles, and text rendering

* feat: Add dashboard TUI with service monitoring table and keyboard navigation

- Add Dashboard model with table, spinner, help, and key bindings for service status display
- Add keyMap with shortcuts: refresh (r), subscribers (s), services (v), billing (b), monitoring (m), config (c), deploy (d), help (?), quit (q)
- Add service status table with columns: Service, Status, CPU, Memory, Uptime, Version
- Add initial service data: API Server, Charging Engine, Packet Gateway, Web Dashboard, Prometheus,

* feat: Add enhanced CLI with command routing and global configuration management

- Add EnhancedCLI with CLIConfig for API endpoint, token, profile, verbose, no-color, and theme settings
- Add command routing: dashboard, subscribers, services, billing, monitoring, config, deploy, plugins, automation
- Add runDashboard to launch Bubble Tea dashboard interface
- Add showHelp with command descriptions and global options documentation
- Add parseConfig to parse global flags: --endpoint, --token, --profile

* feat: Add CLI application entry point with main function delegating to internal app package

- Add main.go with main function calling app.Main() from internal/app package
- Import telecom-platform CLI app package for application initialization

* feat: Add billing command handler with invoice and payment management

- Add HandleBilling with command routing: invoices, payments, generate
- Add showBillingHelp with command descriptions and usage examples
- Add handleInvoices to display invoice list with ID, date, status, amount, and subscriber
- Add handlePayments to display payment transactions with ID, date, amount, method, and status
- Add generateInvoice to create invoices for subscribers with ID validation

* feat: Add deployment command handler with status, start, rollback, and history management

- Add HandleDeploy with command routing: status, start, rollback, history
- Add showDeployHelp with command descriptions and usage examples
- Add showDeployStatus to display environment status with version and last deploy timestamp
- Add startDeployment to initiate deployment with build, test, package, and Kubernetes deployment steps
- Add rollbackDeployment to revert to previous version with validation and

* feat: Add config command handler with show, set, get, and validate operations

- Add HandleConfig with command routing: show, set, get, validate
- Add showConfigHelp with command descriptions and usage examples
- Add showConfig to display current configuration with API, database, Redis, monitoring, logging, and billing settings
- Add setConfig to update configuration key-value pairs with validation
- Add getConfig to retrieve individual configuration values by key
- Add validateConfig to verify database

* feat: Add enhanced command handlers for billing, monitoring, config, deploy, plugins, and automation

- Add HandleBillingEnhanced with commands: invoices, payments, reports, settings
- Add HandleMonitoringEnhanced with commands: overview, metrics, alerts, logs, health
- Add HandleConfigEnhanced with commands: show, get, set, profiles, secrets
- Add HandleDeployEnhanced with commands: status, start, stop, rollback, environments
- Add HandlePluginsEnhanced with commands: list, show, install, uninstall,

* feat: Add enhanced services command handler with status, control, and monitoring operations

- Add HandleServicesEnhanced with command routing: list, status, start, stop, restart, logs, metrics, health, scale
- Add showServicesEnhancedHelp with command descriptions and usage examples
- Add listServicesEnhanced to display services table with status icons, CPU/memory metrics, uptime, and version using styled UI components
- Add showServiceStatusEnhanced to display service details with version, uptime, CPU

* feat: Add enhanced subscribers command handler with CRUD operations and usage management

- Add HandleSubscribersEnhanced with command routing: list, show, create, update, delete, activate, deactivate, balance, usage, search
- Add showSubscribersEnhancedHelp with command descriptions and usage examples
- Add listSubscribersEnhanced to display subscribers table with status icons, IMSI, name, balance, plan, and last activity using styled UI components
- Add showSubscriberEnhanced to display subscriber

* feat: Add monitoring command handler with metrics, alerts, health, and logs operations

- Add HandleMonitoring with command routing: metrics, alerts, health, logs
- Add showMonitoringHelp with command descriptions and usage examples
- Add showMetrics to display system metrics with API response time, database connections, CPU/memory usage, disk usage, network throughput, active subscribers, and request rate
- Add showAlerts to display active alerts table with severity, service, message, and timestamp
- Add showHealth to display

* feat: Add basic services and subscribers command handlers with list, status, and CRUD operations

- Add HandleServices with command routing: list, status, restart, logs
- Add showServicesHelp with command descriptions and usage examples
- Add listServices to display services table with status, version, and uptime
- Add showServiceStatus to display service details with CPU/memory usage and last restart
- Add restartService to restart specified service
- Add showServiceLogs to display recent service

* feat: Add configuration management with viper integration and profile support

- Add Config struct with API, UI, Plugins, and Logging sections
- Add APIConfig with endpoint, timeout, retries, token, insecure, and headers settings
- Add UIConfig with theme, colors, pager, table-style, chart-width, and chart-height settings
- Add PluginConfig with enabled/disabled lists and config map
- Add LoggingConfig with level, format, output, max-size, max-backups, and max-age settings
- Add NewConfig to initialize

* feat: Add UI styling system with lipgloss integration and icon definitions

- Add colors.go with color palette: primary, accent, muted, semantic colors (success, warning, error, info)
- Add base styles: focused, blurred, help, header, subheader, title styles
- Add status styles for services (running, stopped, pending, unknown) and subscribers (active, inactive, suspended)
- Add metric styles with threshold-based coloring (good, warning, critical)
- Add table styles: header, border, even/odd rows

* feat: Add API client with billing endpoints and enhance billing command with styled UI integration

- Add Client struct with baseURL, apiKey, and httpClient with 30s timeout
- Add data models: Invoice, Payment, Subscriber, GenerateInvoiceRequest, GenerateInvoiceResponse
- Add GetInvoices to retrieve invoices from /api/v1/invoices endpoint
- Add GetPayments to retrieve payments from /api/v1/payments endpoint
- Add GenerateInvoice to create invoices via /api/v1/invoices/generate endpoint
- Add IsConn

* feat: Integrate API client with billing command handlers and add real data support with fallback to placeholders

- Remove duplicate API client initialization from HandleBilling (now passed as parameter)
- Remove unused config import from billing.go
- Update handleInvoices to fetch real invoice data via apiClient.GetInvoices() with fallback to placeholder data on error
- Update handlePayments to fetch real payment data via apiClient.GetPayments() with fallback to placeholder data on error

* feat: Update table border rendering to use different characters based on position

- Add borderChar variable to determine border style based on position parameter
- Use "=" for top and bottom borders, "-" for middle borders
- Replace hardcoded "=" with dynamic borderChar in sections rendering
- Remove redundant comment about convenience methods

* feat: Add comprehensive integration test suite with mock API server and benchmarks

- Add IntegrationTestSuite with httptest server, temp config directory, and CLI instance
- Add SetupSuite/TearDownSuite for test environment lifecycle management
- Add handleMockAPI to mock endpoints: subscribers, services, billing/invoices, health
- Add TestSubscribersCommand to test list operations with different formats and enhanced mode
- Add TestServicesCommand to test service listing with format options
- Add TestBilling

* feat: Add comprehensive CLI documentation with commands reference, configuration, and plugin system

- Add README.md with installation instructions (source, go install, binary release)
- Add quick start guide with initial setup and interactive dashboard
- Add global options table with help, version, verbose, no-color, format, and profile flags
- Add configuration commands reference with set/get/profiles operations and options table
- Add subscribers commands reference with list/show/create/update/delete operations and

* feat: Add UI context helper with colorizer, icons, API client, and styled output methods

- Add uiContext struct bundling colorizer, icons, client, config, and connected state
- Add newUIContext to initialize context from CLIConfig and probe API connectivity
- Add styled output methods: header, info, success, warn, errorln, muted
- Add connectivityBanner to display warning when API server is unreachable
- Add endpointDisplay to format API endpoint for display
- Add newTable convenience method to create configured UI table
- Add statusStyle to map status strings to semantic styles (success, warning, error,

* feat: Add PostRestart method to API client for service restart operations

- Add PostRestart to request service restart via /api/v1/services/{name}/restart endpoint
- Add godoc comment describing restart functionality

* refactor: Migrate billing and config commands to uiContext with error handling and simplified output

- Update HandleBilling to accept CLIConfig, return error, and use uiContext for all output
- Update HandleConfig to accept CLIConfig, return error, and use uiContext for all output
- Replace manual colorizer/icon initialization with uiContext helper methods
- Simplify error handling with uiContext.errorln, warn, success, info, muted methods
- Replace direct table creation with uiContext.newTable()

* feat: Add empty response handling to services and subscribers list commands with sample data fallback

- Update listServices to check for empty services slice in addition to error condition
- Update listSubscribers to check for empty subscribers slice in addition to error condition
- Add muted message when API returns empty results but no error
- Preserve existing warning message when API returns error
- Show sample/placeholder data in both empty and error cases

* refactor: Replace if-else chain with switch statement in showAlerts severity styling

- Replace if-else chain with switch statement for severity level styling
- Maintain existing logic: High maps to ERROR style, Medium maps to WARNING style
- Improve code readability and maintainability

* feat: Add persistent config loading, styled help screen, and API connectivity banner to enhanced CLI

- Update NewEnhancedCLI to load persisted config from disk with fallback to defaults
- Add loadPersistedConfig helper for best-effort viper-backed config hydration
- Add Config() method to expose read-only CLI configuration
- Update showHelp to use lipgloss styling with color support and theme awareness
- Add API connectivity banner to help screen showing connection status
- Add help/version command

* feat: Add BaseURL method to API client for exposing configured endpoint

- Add BaseURL() method to return configured API endpoint
- Add godoc comment describing use case for UI display

* refactor: Update enhanced subscribers error handling to return error instead of nil

- Change HandleSubscribers call to ignore return value with blank identifier
- Return explicit error for unknown command instead of propagating HandleSubscribers result
- Improve error clarity by returning formatted error message

* feat: Add API integration to dashboard with live service data and connection status

- Update NewDashboard to accept optional CLIConfig and initialize API client
- Add populateRows to fetch live services from API with fallback to sample data
- Add connection status indicator to footer showing API connectivity state
- Add status message line displaying API endpoint or error condition
- Update refreshData to fetch fresh service data instead of simulating updates
- Add clientEndpoint helper to format API endpoint

* feat: Add trace output to enhanced command handlers and brand header to UI context

- Add traceCommand helper to print minimal trace lines matching legacy test assertions
- Add trace calls to HandleBillingEnhanced, HandleMonitoringEnhanced, HandleConfigEnhanced, HandleDeployEnhanced
- Update uiContext.header to prefix output with "Telecom Platform CLI" brand line
- Add godoc explaining trace format mirrors old placeholder output for test compatibility

* refactor: Clean up colors.go formatting and remove unused style variables

- Remove unused color variables: blackColor, greenColor, blueColor, purpleColor, cyanColor
- Remove unused base styles: baseStyle, focusedStyle, blurredStyle, helpStyle
- Remove unused text styles: boldStyle, italicStyle, underlineStyle, dimStyle
- Remove unused semantic styles: errorStyle, successStyle, warningStyle, infoStyle
- Remove unused icon styles: iconStyle, iconSuccessStyle, iconErrorStyle, iconWarningStyle, iconInfoStyle
2026-04-17 16:38:38 +03:00
NutcaseandGitHub 1b2b9d2412 Revert "Revert "App layer"" (#5) 2026-04-17 16:08:27 +03:00
NutcaseandGitHub 828e7e39cf Merge pull request #4 from nutcas3/revert-3-app-layer
Revert "App layer"
2026-04-17 15:59:47 +03:00
NutcaseandGitHub efed7e936c Revert "App layer" 2026-04-17 15:59:31 +03:00
NutcaseandGitHub 5d74888852 Merge pull request #3 from nutcas3/app-layer
App layer
2026-04-17 15:59:00 +03:00
nutcas3 dd15ecdb93 feat: Replace placeholder data with database queries in charging service methods
- 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
2026-04-17 15:55:41 +03:00
nutcas3 cea79ef825 feat: Add PaymentMethodDetails struct for token-based payment method retrieval
- Add PaymentMethodDetails with payment method ID, type, card details (last4, brand, expiry), fingerprint, and creation timestamp
- Support structured response for payment method token processing
2026-04-17 15:55:32 +03:00
nutcas3 04846c8564 feat: Add chaos engineering service with experiment execution and HTTP middleware
- Add ChaosService with experiment management and concurrent execution tracking
- Add experiment types: latency, kill, crash, partition, flush, and load with configurable duration/probability
- Add experiment status tracking: idle, running, completed, and failed states
- Add RunExperiment to start chaos experiments in background goroutines with automatic cleanup
- Add experiment executors: injectLatency, killConnections, crashService
2026-04-17 15:55:21 +03:00
nutcas3 3332edf9ca feat: Add payment webhook handler with Stripe integration and transaction processing
- 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
2026-04-17 15:53:57 +03:00
nutcas3 ed04533db6 feat: Add Balance field to Subscriber model with default value of 0
- 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
2026-04-17 15:53:29 +03:00
nutcas3 d5ca53030c feat: Replace placeholder card details with Stripe API integration in AddPaymentMethod
- 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
2026-04-17 15:53:20 +03:00
nutcas3 2fa56f0d83 feat: Add InfluxDB time-series storage with usage, system, and charging metrics tracking
- 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
2026-04-17 15:53:06 +03:00
nutcas3 a1222025e0 feat: Add Prometheus metrics collector with comprehensive telecom system monitoring
- Add MetricsCollector with HTTP middleware, subscriber tracking, and system uptime monitoring
- Add HTTP request metrics: total requests counter and duration histogram by method/endpoint/status
- Add subscriber metrics: total, active, and suspended subscriber gauges
- Add usage metrics: data bytes, voice seconds, and SMS count counters by subscriber
- Add charging metrics: credit balance gauge and payment transaction counter by
2026-04-17 15:52:53 +03:00
nutcas3 547abf1889 feat: Add database methods for transactions, payment methods, alerts, and notifications
- 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
2026-04-17 15:52:41 +03:00
nutcas3 d24aa2cef0 feat: Add RetrievePaymentMethodFromToken to extract card details from Stripe tokens
- Add RetrievePaymentMethodFromToken to create payment method from token and extract card details
- Import paymentmethod package from stripe-go/v82
- Import payment package for PaymentMethodDetails type
- Return PaymentMethodDetails with ID, type, last4, brand, expiry dates, fingerprint, and creation timestamp
- Add error handling for payment method creation and missing card details
2026-04-17 15:51:50 +03:00
nutcas3 3d0f0188fb feat: Add Stripe payment gateway with customer management, invoicing, and webhook validation
- 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
2026-04-17 15:50:03 +03:00
nutcas3 cbfe5a4b9f feat: Implement real-time subscription polling for subscriber and alert updates
- 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
2026-04-17 15:47:47 +03:00
nutcas3 9d2e5b7175 feat: Remove comment separators and fix AlertUpdates severity parameter conversion
- Remove comment separators for mutations, subscriptions, filter helpers, and GraphQL handler sections
- Update AlertUpdates to convert AlertSeverity enum to string pointer for service call
- Add inline comment explaining severity conversion in AlertUpdates resolver
2026-04-17 15:46:55 +03:00
nutcas3 9ce03cf81e feat: Replace placeholder data with database queries in subscriber service methods
- 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
2026-04-17 15:44:59 +03:00
nutcas3 7cbd3b89b6 feat: Add payment gateway with Stripe integration, transaction processing, and webhook validation
- Add PaymentGateway interface with ProcessPayment, RefundPayment, GetPaymentStatus, CreatePaymentMethod, DeletePaymentMethod, and ValidateWebhook methods
- Add payment request/response types: PaymentRequest, PaymentResponse, RefundResponse, PaymentStatus, CreatePaymentMethodRequest, PaymentMethod
- Add payment status types: PENDING, PROCESSING, COMPLETED, FAILED, REFUNDED, CANCELLED
- Add payment method types
2026-04-17 15:44:41 +03:00
nutcas3 adbdb40066 feat: Add charging engine HTTP client with credit management and health monitoring
- 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
2026-04-17 15:43:53 +03:00
nutcas3 99bff17756 feat: Add charging service with usage tracking, system monitoring, and real-time statistics
- 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
2026-04-17 15:41:11 +03:00
nutcas3 d248b9b5e5 feat: Add invoice service with monthly invoice generation, payment tracking, and automated billing
- 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
2026-04-17 15:40:57 +03:00
nutcas3 72d5a9c8e0 feat: Add account management models with billing, payments, alerts, and system monitoring types
- 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
2026-04-17 15:38:47 +03:00
nutcas3 565052e406 feat: Add configuration for payment processing, charging engine, metrics, and time-series storage
- 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
2026-04-17 15:36:44 +03:00
nutcas3 764e95619b feat: Add GraphQL, Prometheus, InfluxDB, and Stripe dependencies to API server
- Add gqlgen v0.17.89 for GraphQL server implementation
- Add prometheus/client_golang v1.23.2 for metrics collection
- Add influxdata/influxdb-client-go/v2 v2.14.0 for time-series metrics storage
- Add stripe/stripe-go/v82 v82.5.1 for payment processing
- Update go.mongodb.org/mongo-driver/v2 from v2.5.0 to v2.5.1
- Add supporting dependencies: gqlparser, oapi-codegen/runtime, line-protocol, prometheus client_model/
2026-04-17 15:36:14 +03:00
nutcas3 ccd50ac79e feat: Add API server main entry point with GraphQL, metrics collection, and system monitoring
- 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
2026-04-17 15:35:33 +03:00
nutcas3 bcc42ae4c3 feat: Add subscriber service methods for account management, invoicing, alerts, and payment operations
- 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
2026-04-17 15:35:22 +03:00
NutcaseandGitHub 96c10a5298 Merge pull request #2 from nutcas3/graphql
Graphql
2026-04-17 15:24:27 +03:00
nutcas3 129a61c826 test: Add unit tests for GraphQL resolver helper functions
- 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)
2026-04-17 15:21:38 +03:00
nutcas3 eef5f21717 feat: Add GraphQL code generation scaffolding with comprehensive type definitions and resolver interfaces
- Add custom GraphQL types and enums: SubscriberStatus, ProfileStatus, UsageType, SessionStatus, PaymentMethodType, InvoiceStatus, AlertType, AlertSeverity, SubscriberSort, UsagePeriod, TrendDirection
- Define input types: SubscriberFilter, UsageEventFilter, CreateSubscriberInput, UpdateSubscriberInput, TopUpInput, UsageStatsInput, PaymentMethodInput, CreateAlertInput
- Define output types: Page
2026-04-17 15:21:21 +03:00
nutcas3 1383e08645 feat: Implement GraphQL resolvers for subscriber management, charging operations, and real-time monitoring
- Add Resolver struct with database, subscriber, charging, and ES2 service dependencies
- Implement query resolvers: Subscriber, SubscriberByImsi, Subscribers, SubscriberAccount, UsageEvents, UsageStats, RealTimeUsage, Invoices, Invoice, RatingPlans, RatingPlan, Alerts, SystemStats, HealthStatus, SearchSubscribers, SearchUsageEvents
- Implement mutation resolvers: CreateSubscriber, UpdateSubscriber, DeleteSubscriber, TopUpBalance, Suspend
2026-04-17 15:21:03 +03:00
nutcas3 86141062fe feat: Add comprehensive GraphQL schema for subscriber management and charging operations
- Add custom scalars (DateTime, JSON) for complex data types
- Define enums for subscriber status, profile status, usage types, session status, payment methods, invoice status, and alert types
- Add core types: Subscriber, SubscriberAccount, UsageEvent, RatingPlan, ChargingSession, PaymentMethod, Invoice, Alert
- Add system monitoring types: SystemStats, HealthStatus
- Implement Relay-style pagination with Connection
2026-04-17 15:18:06 +03:00
nutcas3 386707d02f feat: Implement actual uptime calculation and memory usage tracking in monitoring
- Replace placeholder uptime with actual elapsed time since startup using startup_time
- Add fallback to UNIX epoch time if system time goes backwards
- Implement get_process_memory to read actual memory from /proc/self/status on Linux
- Add estimate_memory_usage fallback for non-Linux systems (35MB base estimate)
- Add get_redis_memory_usage to query Redis memory info as secondary fallback
- Update get_memory_usage to use
2026-04-14 20:08:37 +03:00
nutcas3 da712a524f feat: Add startup_time field to ChargingEngine for tracking service uptime
- Add SystemTime import from std::time
- Add startup_time field to ChargingEngine struct
- Initialize startup_time with SystemTime::now() during engine creation
2026-04-14 20:08:11 +03:00
NutcaseandGitHub 49187ee836 Merge pull request #1 from nutcas3/phase-2
Phase 2
2026-04-14 18:31:03 +03:00
nutcas3 b6edcb8436 feat: Implement actual uptime and memory usage tracking in monitoring
- Replace placeholder uptime calculation with actual elapsed time since startup
- Add fallback to current time if system time goes backwards
- Implement get_process_memory to read actual memory from /proc/self/status on Linux
- Add estimate_memory_usage fallback for non-Linux systems (35MB base estimate)
- Add get_redis_memory_usage to query Redis memory info as secondary fallback
- Update get_memory_usage to use layered fallback approach (
2026-04-14 17:42:03 +03:00
nutcas3 c63c92245f refactor: Reorganize charging and errors modules into proper directory structure
- Move charging module files into charging/ directory (types.rs, engine.rs, credit_management.rs, rating_billing.rs)
- Move error module files into errors/ directory (types.rs, helpers.rs)
- Create mod.rs files for charging and errors modules with simplified exports
- Update import paths to use super:: for intra-module references
- Remove charging_new/errors_new aliases and use charging/errors directly
- Simplify module
2026-04-14 16:29:27 +03:00
nutcas3 c1f408c789 refactor: Extract credit management and monitoring functionality into separate modules
- Move credit operations (get_balance, add_credit, deduct_credit, check_credit) to credit_management.rs
- Move user blocking operations (block_user, unblock_user, is_user_blocked) to credit_management.rs
- Move subscriber account operations (get_subscriber_account, update_subscriber_account, record_usage_event) to credit_management.rs
- Move monitoring operations (get_system_statistics, health_check, get_performance
2026-04-14 16:25:36 +03:00
nutcas3 a42ef5d8db refactor: Transition to new modular charging and error handling architecture
- Alias charging_new as charging and errors_new as errors
- Add new charging module imports (charging_types, charging_engine, credit_management, rating_billing, monitoring_sync, sync_operations, monitoring)
- Add new error module imports (error_types, error_helpers)
- Prepare for gradual migration from monolithic to modular structure
2026-04-14 16:24:21 +03:00
nutcas3 2a2f481daa refactor: Split charging engine into separate modules for better code organization
- Move core types (SubscriberAccount, AccountStatus, UsageEvent, UsageType, RatingPlan, ChargingSession, SessionStatus, ChargingRule, Condition, Action) to charging_types.rs
- Move main ChargingEngine struct and initialization to charging_engine.rs
- Move credit operations (check_credit, get_balance, deduct_credit, add_credit) to credit_management.rs
- Move account operations (create_account, get_account, top_up_balance,
2026-04-14 16:24:04 +03:00
nutcas3 577f625bbd refactor: Split error handling into separate modules for better code organization
- Move ChargingError enum and IntoResponse implementation to error_types.rs
- Move ChargingResult, ErrorContext trait, validation functions, error conversions, and logging to error_helpers.rs
- Keep module declarations and re-exports in errors.rs
- Add validate_imsi, validate_session_id, and validate_amount validation helpers
- Add log_error helper for structured error logging with tracing
- Update error variants:
2026-04-14 16:22:56 +03:00
nutcas3 a335c6754e refactor: Split subscriber service into separate files for better code organization
- Move IMSI allocation logic to subscriber_imsi.go
- Move authentication key generation (generateAuthKeys, getOperatorVariant, generateOPc) to subscriber_auth.go
- Move eSIM profile operations (provisionESIMProfile, deactivateESIMProfile) to subscriber_esim.go
- Keep core subscriber CRUD operations and session management in subscriber.go
- Remove unused crypto/aes, crypto/rand, encoding/hex, and os imports from main
2026-04-14 16:22:22 +03:00
nutcas3 3a3b4d93a0 refactor: Split ES2 client into separate files for better code organization
- Move ES2 request/response types to es2_types.go
- Move profile operations (download, activate, deactivate, delete, status, list) to es2_operations.go
- Move helper methods (send requests, validation, generateRequestID) to es2_helpers.go
- Keep core ES2Service struct and ProvisionProfile in es2_client.go
- Revert sendDeactivationRequest parameter type from any back to interface{}
2026-04-14 16:22:07 +03:00
nutcas3 62cdffee2b feat: Remove unused generateRequestID helper function from AMF client
- Remove generateRequestID function and its fmt/time imports
- Function was not being used in AMF client implementation
2026-04-14 16:21:43 +03:00
nutcas3 1ead99440e feat: Replace interface{} with any type alias for improved code clarity
- Remove omitempty from Plan field in Subscriber model
- Update NotifySubscriberUpdate to use any instead of interface{}
- Update sendDeactivationRequest parameter type from interface{} to any
2026-04-14 16:07:04 +03:00
nutcas3 13355a07e7 feat: Add environment-based operator variant configuration with padding support
- Add os import for environment variable access
- Update getOperatorVariant to read OP from OPERATOR_VARIANT env var
- Add fallback to default "TelecomOP1234567" for development
- Add zero-padding for OP values shorter than 16 bytes
- Update comments to reference environment variable configuration
2026-04-14 16:06:09 +03:00
nutcas3 745ebe3bb4 chore: Update Go dependencies to latest versions
- Update bytedance/gopkg from v0.1.3 to v0.1.4
- Update bytedance/sonic/loader from v0.5.0 to v0.5.1
- Update gabriel-vasile/mimetype from v1.4.12 to v1.4.13
- Update gin-contrib/sse from v1.1.0 to v1.1.1
- Update go-playground/validator/v10 from v10.30.1 to v10.30.2
- Update goccy/go-json from v0.10.5 to v0.10.6
- Update golang/snappy from v0.0.4 to v1.0.0
- Update jackc/pgx/v5 from v5.6.0 to v5.9.1
- Update klauspost/compress from v1.17.6 to v1.18.5
2026-04-14 16:04:19 +03:00
nutcas3 e260ea3baa feat: Implement proper AES-128 OPc derivation per 3GPP specification
- Replace XOR-based OPc generation with AES-128 ECB encryption
- Add getOperatorVariant for consistent OP across subscribers
- Add AES cipher block creation with error handling
- Add OP length validation for AES-128 block size
- Update generateOPc to use crypto/aes for 3GPP-compliant OPc derivation
- Add hardcoded OP placeholder with production configuration note
2026-04-14 16:03:46 +03:00
nutcas3 a78599fa1f feat: Implement eSIM provisioning and AMF integration in subscriber service
- Add AMFClient and ES2Service dependencies to SubscriberService
- Initialize AMF client with default URL and ES2 service in NewSubscriberService
- Implement provisionESIMProfile with EID validation, profile provisioning, activation, and AMF notification
- Implement deactivateESIMProfile with profile deactivation, status updates, and session termination
- Add generateOPc helper for deriving OPc from OP and K using XOR-based
2026-04-14 16:00:46 +03:00