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

Setting

< - Configuration Management

Overview

The Setting class manages system configuration and reference data for the entire platform. It provides centralized configuration management including company groups, member types, tier definitions, and global settings with streaming capabilities for data distribution.

General Purpose:

  • System configuration and reference data management
  • Centralized settings for company groups, member types, and tier configurations
  • Global settings with streaming capabilities for real-time data distribution
  • Singleton architecture with 'default' instance ID
  • Integration point for all classes requiring configuration data

Data Structure

State Schema

interface SettingState {
  private: {
    settings: {
      [SettingTypes.CompanyGroups]: {
        title: string
        description: string
        value: CompanyGroupSettingValue[]
      }
      [SettingTypes.MemberSubType]: {
        title: string
        description: string
        value: MemberSubTypeSettingValue[]
      }
      [SettingTypes.TierTypes]: {
        title: string
        description: string
        value: TierTypeSettingValue[]
      }
      [SettingTypes.TierConfig]: {
        title: string
        description: string
        value: TierConfigSettingValue
      }
      [SettingTypes.MemberType]: {
        title: string
        description: string
        value: MemberTypeSettingValue[]
      }
    }
  }
  public: object
}

Enums and Types

enum CompanyGroupStatus {
  PENDING = 'pending',
  ACTIVE = 'active',
  INACTIVE = 'inactive'
}

enum MemberSubTypeStatus {
  PENDING = 'pending',
  ACTIVE = 'active',
  INACTIVE = 'inactive'
}

enum TierGroup {
  BASE = 'base',
  UPGRADE = 'upgrade',
  ADD_ON = 'add_on'
}

enum TierPaymentType {
  CREDIT_CARD = 'credit_card',
  SALARY_DEDUCTION = 'salary_deduction'
}

enum TierTypeStatus {
  ACTIVE = 'active',
  INACTIVE = 'inactive'
}

enum CompanyGroupType {
  INTERNAL = 'internal',
  EXTERNAL = 'external'
}

enum MemberTypeStatus {
  PENDING = 'pending',
  ACTIVE = 'active',
  INACTIVE = 'inactive'
}

// Updatable status definitions using const object pattern for better type safety
const UpdatableCompanyGroupStatus = {
  ACTIVE: CompanyGroupStatus.ACTIVE,
  INACTIVE: CompanyGroupStatus.INACTIVE
} as const

const UpdatableMemberSubTypeStatus = {
  ACTIVE: MemberSubTypeStatus.ACTIVE,
  INACTIVE: MemberSubTypeStatus.INACTIVE
} as const

const UpdatableTierTypeStatus = {
  ACTIVE: TierTypeStatus.ACTIVE,
  INACTIVE: TierTypeStatus.INACTIVE
} as const

const UpdatableMemberTypeStatus = {
  ACTIVE: MemberTypeStatus.ACTIVE,
  INACTIVE: MemberTypeStatus.INACTIVE
} as const

Additional Structures

interface CompanyGroupSettingValue {
  id: string
  name: string
  description?: string
  status: CompanyGroupStatus
  type: CompanyGroupType
  createdBy: StateManagerActor
  createdAt: Date
  updatedAt: Date
}

interface TierTypeSettingValue {
  id: string
  tierGroup: TierGroup
  name: string
  description?: string
  status: TierTypeStatus
  createdBy: StateManagerActor
  createdAt: Date
  updatedAt: Date
}

interface TierConfigSettingValue {
  paymentPeriods: PaymentPeriodSettingValue[]
}

interface PaymentPeriodSettingValue {
  key: string
  label: string
}

interface MemberTypeSettingValue {
  id: string
  name: string
  description?: string
  status: MemberTypeStatus
  systemIdentifier: string
  createdBy: StateManagerActor
  createdAt: Date
  updatedAt: Date
}

Core Functionality

Main Feature Groups

  • Global Settings Management: Centralized storage and retrieval of system-wide configuration settings
  • Company Group Configuration: Management of company groupings with status tracking and categorization
  • Member Type Management: Definition and management of member types with lifecycle control
  • Member Subtype Management: Granular member categorization with status and approval workflows
  • Tier Configuration: Comprehensive tier type management with payment configurations and grouping
  • Streaming Capabilities: Real-time data distribution to MongoDB for external system integration
  • Program Configuration: Management of program-specific settings and business rules

API Methods

Configuration Management

  • setState (WRITE) - Set the class state from rio console

    • Administrative state management for configuration updates
  • getSetting (READ) - Get setting for client

    • Retrieve specific setting values with client-appropriate formatting
  • listSettings (READ) - List settings

    • Returns complete settings overview for administrative interfaces

Company Group Management

  • listCompanyGroups (READ) - List company groups

    • Retrieve all company groups with filtering and pagination
  • getCompanyGroup (READ) - Get company group by id

    • Fetch specific company group details
  • updateCompanyGroup (WRITE) - Update company group by id

    • Modify existing company group with audit tracking
  • createCompanyGroup (WRITE) - Create new company group

    • Add new company groupings with validation and streaming
  • updateCompanyGroupStatus (WRITE) - Update company group status by id

    • Update company group status (active/inactive) with audit tracking

Member Type Management

  • createMemberType (WRITE) - Create new member type

    • Define new member types with status tracking
  • updateMemberType (WRITE) - Update member type by id

    • Modify existing member type configurations
  • getMemberType (READ) - Get member type by id

    • Retrieve specific member type details
  • listMemberTypes (READ) - List member types

    • Access all member types with filtering options
  • updateMemberTypeStatus (WRITE) - Update member type status by id

    • Update member type status (active/inactive) with audit tracking

Member Subtype Management

  • createMemberSubType (WRITE) - Create new member subtype

    • Define granular member categorizations
  • updateMemberSubType (WRITE) - Update member subtype by id

    • Modify existing member subtype definitions
  • getMemberSubType (READ) - Get member subtype by id

    • Retrieve specific member subtype details
  • listMemberSubTypes (READ) - List member subtypes

    • Access all member subtypes with status filtering
  • updateMemberSubTypeStatus (WRITE) - Update member subtype status by id

    • Update member subtype status (active/inactive) with audit tracking

Tier Management

  • createTierType (WRITE) - Create new tier type

    • Define tier types with payment configurations and grouping
  • updateTierType (WRITE) - Update tier type by id

    • Modify existing tier type settings and configurations
  • getTierType (READ) - Get tier type by id

    • Retrieve specific tier type details with payment configurations
  • listTierTypes (READ) - List tier types

    • Access all tier types with filtering by group and status
  • updateTierTypeStatus (WRITE) - Update tier type status by id

    • Update tier type status (active/inactive) with audit tracking
  • getPaymentPeriods (READ) - Get payment periods configuration

    • Retrieve available payment period configurations for tier setup

Program Configuration

  • getProgramManagementConfig (READ) - Get program management configuration
    • Retrieve current program configuration settings including all entity status enums

Data Streaming

  • streamTierType (WRITE) - Stream tier type data to MongoDB

    • Real-time streaming of tier type data to external MongoDB collection
  • streamMemberType (WRITE) - Stream member type data to MongoDB

    • Real-time streaming of member type data to external MongoDB collection
  • streamMemberSubType (WRITE) - Stream member subtype data to MongoDB

    • Real-time streaming of member subtype data to external MongoDB collection
  • streamCompanyGroup (WRITE) - Stream company group data to MongoDB

    • Real-time streaming of company group data to external MongoDB collection

Key Features

  1. Architecture Pattern: Singleton class with 'default' instance ID for centralized configuration management
  2. Integration Points: Core dependency for Member, Company, Tier, and other entity classes requiring configuration data
  3. Security Features: Role-based access control for configuration management and audit tracking for all changes
  4. Data Management: State with real-time streaming to MongoDB
  5. Performance Features: Centralized caching of configuration data for optimal performance across the platform
  6. Audit/Logging: Complete tracking of all configuration changes with actor information and timestamps
  7. Program Configuration: Provides centralized management of all entity status configurations and enums

Class Relations

The following diagram illustrates how Setting integrates with other system components:

Setting Relations