Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Classes

This document provides an overview of all classes in the backend system. Each class represents a specific domain of functionality with its own state management, business logic, and API endpoints.

Core Classes

Core classes provide shared functionality, system services, and infrastructure support across all entity classes.

ApprovalManager

Centralized approval workflow management providing approval processing for all entity types with hybrid storage (MongoDB + RDK file storage) for handling large jsonPatch data, workflow integration, and comprehensive audit trails.

→ View ApprovalManager Documentation


RoleManager

Role and permission management system with dynamic role creation, permission-based access control, and deployment automation.

→ View Role Manager Documentation


LogManager

Centralized logging and audit trail system with hybrid storage (MongoDB + RDK file storage) for handling large log entries, providing entity-specific log management and paginated log retrieval across all classes.

→ View Log Manager Documentation


FileManager

Secure file storage and management system providing entity-based file organization with comprehensive validation, metadata tracking, and token-based security.

→ View File Manager Documentation


Setting

System configuration and reference data management including global settings, company groups, member types, tier types, and streaming capabilities.

→ View Setting Documentation


SystemEmail

Email template management and delivery system with dynamic templates, approval workflows, and AWS SES integration for multi-purpose email delivery.

→ View SystemEmail Documentation


Workflow

Business process automation and workflow configuration providing rule definition and process automation integration.

→ View Workflow Documentation


Otp

OTP record storage and management service providing authentication workflow support with comprehensive audit trails and validation history.

→ View Otp Documentation

Entity Classes

Entity classes manage the core business entities and their lifecycles in the loyalty program system.

Member

Core member profile and lifecycle management with comprehensive profile tabs, photo management, and eligibility rules.

→ View Member Documentation


Company

Management of companies participating in the loyalty program with CRUD operations, approval workflows, and hierarchical structures.

→ View Company Documentation


Tier

Individual membership tier management with eligibility rules, payment configurations, and approval workflows.

→ View Tier Documentation


ProgramManagementUser

Administrative user management for program operators with role-based access, SSO (SAML 2.0) and email/password authentication, and invitation workflows.

→ View Program Management User Documentation

Architecture Overview

Method Types

The classes use four types of Rio methods:

  • READ: Synchronous data retrieval (1-30s)
  • WRITE: Synchronous state mutations (1-30s)
  • QUEUED_WRITE: Asynchronous operations with longer processing times (1-890s)
  • STATIC: Stateless utility methods (no instance required)

Success Response Standardization

All classes implement a unified success response system that provides:

  • Consistent Response Structure: Standardized success response format across all classes
  • Localization Support: Built-in multi-language support with fallback mechanisms
  • Type Safety: Type-safe success definitions with class-specific constants
  • Centralized Management: Success messages defined in classes/*/constants/success.responses.ts

Success Response Architecture

Success Response Pattern:

data.response = new SuccessResponse({
    success: ClassSuccess.OPERATION_TYPE,
    localization: culture,
    body: { responseData }
})

Key Benefits:

  1. Consistency: All methods return standardized success responses
  2. Localization: Automatic message localization based on user culture
  3. Maintenance: Centralized success message management per class
  4. Type Safety: Compile-time validation of success response types

Error Response Standardization

All classes implement a unified error response system that provides:

  • Consistent Error Structure: Standardized error response format with HTTP status codes
  • Unique Error Codes: Class-specific error codes for precise error identification
  • Localization Support: Multi-language error messages with fallback mechanisms
  • Type Safety: Type-safe error definitions with class-specific constants
  • Centralized Management: Error definitions in classes/*/constants/error.responses.ts

Error Response Pattern:

// Throwing specific business logic errors
throw new ErrorResponse({
    error: ClassError.SPECIFIC_ERROR_TYPE,
    details: { additionalContext }
})

// Handling unexpected errors in catch blocks
catch (error) {
    data.response = parseError(error, ClassIdentities.enum.ClassName, culture)
}

Error Response Format:

{
    statusCode: 400 | 403 | 404 | 500 | 502,
    body: {
        code: number,  // Unique error code per class
        message: "Localized error message",
        classId: "ClassName"
    }
}

Error Code Ranges by Class:

  • ProgramManagementUser: 4000-4099
  • Member: 5000-5099
  • Company: 6000-6099
  • Tier: 7000-7099
  • ApprovalManager: 8000-8099
  • RoleManager: 9000-9099
  • Setting: 10000-10099
  • SystemEmail: 11000-11099
  • LogManager: 12000-12099
  • FileManager: 13000-13099
  • Workflow: 14000-14099
  • Otp: 15000-15099

Key Benefits:

  1. Traceability: Unique error codes enable precise error tracking and debugging
  2. Client Handling: Predictable error format simplifies client-side error handling
  3. Localization: Automatic error message translation based on user locale
  4. Maintainability: Centralized error definitions per class
  5. Type Safety: Compile-time validation prevents using non-existent error types

Inter-Class Dependencies

Classes integrate through:

  • ApprovalManager: Used by classes needing approval workflows
  • LogManager: Used across all classes for audit trails
  • RoleManager: Provides authorization for ProgramManagementUser operations
  • Setting: Provides configuration data to various classes
  • SystemEmail: Authorized for use by all classes for email delivery (implementations pending)

API Documentation

Complete API documentation for all classes is available at /api in the live environment and rendered to docs/api directory.