- Add GetUserPackageStatusQueryValidator for user package status validation.
- Create ArchiveMessageCommand and ArchiveMessageCommandHandler for archiving public messages.
- Implement ArchiveMessageCommandValidator to validate message ID.
- Introduce PublishMessageCommand and PublishMessageCommandHandler for publishing messages.
- Add PublishMessageCommandValidator for validating publish message requests.
- Implement GetPublicMessageQuery and GetPublicMessageQueryHandler for retrieving public messages.
- Create GetPublicMessageQueryValidator for validating public message requests.
- Add ApplyDiscountToOrderCommand and ApplyDiscountToOrderCommandHandler for applying discounts to orders.
- Implement ApplyDiscountToOrderCommandValidator for validating discount application requests.
- Create UpdateOrderStatusCommand and UpdateOrderStatusCommandHandler for changing order statuses.
- Implement UpdateOrderStatusCommandValidator for validating order status updates.
- Add CalculateOrderPVQuery and CalculateOrderPVQueryHandler for calculating order PV.
- Implement CalculateOrderPVQueryValidator for validating PV calculation requests.
- Create GetOrdersByDateRangeQuery and GetOrdersByDateRangeQueryHandler for retrieving orders by date range.
- Implement GetOrdersByDateRangeQueryValidator for validating date range queries.
- Add PublicMessage entity to represent public messages in the system.
- Implement PublicMessageService for handling public message operations via gRPC.
- Implemented Create, Delete, Get, and Update validators for Product Galleries.
- Added Create, Delete, Get, and Update validators for Product Tags.
- Created service classes for handling Discount Categories, Discount Orders, Discount Products, Discount Shopping Cart, Product Categories, Product Galleries, and Product Tags.
- Each service class integrates with CQRS for command and query handling.
- Established mapping profiles for Product Galleries.
Added 5 Commands and 4 Queries for commission calculation and payout system:
Commands:
- CalculateWeeklyBalances: Recursive binary tree traversal for leg balances
- CalculateWeeklyCommissionPool: Calculate ValuePerBalance from total pool
- ProcessUserPayouts: Distribute commission to users, create payout records
- RequestWithdrawal: User requests cash/diamond withdrawal
- ProcessWithdrawal: Admin approves/rejects withdrawal
Queries:
- GetWeeklyCommissionPool: Retrieve pool details
- GetUserCommissionPayouts: List payouts with filters (status, week, user)
- GetCommissionPayoutHistory: Complete audit trail
- GetUserWeeklyBalances: Show leg balances and contributions
Total: 35 files, ~1,100 lines of code
Binary tree algorithm, state machine, withdrawal system implemented
- Implemented 3 Commands with handlers and validators:
* JoinNetworkCommand: Add user to binary network tree
- Validates parent exists and is in network
- Validates leg position is empty
- Records history with NetworkMembershipAction.Join
* MoveInNetworkCommand: Move user to different position
- Validates new parent and leg availability
- Prevents circular dependencies (IsDescendant check)
- Records old/new parent and leg in history
* RemoveFromNetworkCommand: Remove user from network
- Validates no children exist (must move/remove first)
- Soft delete (sets NetworkParentId to null)
- Idempotent design
- Implemented 3 Queries with handlers, validators, and DTOs:
* GetNetworkTreeQuery: Binary tree visualization
- Recursive tree building with MaxDepth limit (1-10)
- Returns nested structure with Left/Right children
* GetUserNetworkPositionQuery: User position details
- Parent info, leg position, children counts
- Left/Right child counts for balance view
* GetNetworkMembershipHistoryQuery: Complete audit trail
- Filter by UserId, pagination support
- Shows Join/Move/Remove actions with full details
- All operations include complete history tracking
- Binary tree validation (parent-child relationships)
- Circular dependency prevention in MoveInNetwork
- 21 new files, ~850 lines of code
- Build successful with 0 errors
- Implemented 3 Commands with handlers and validators:
* ActivateClubMembership: Create/reactivate membership
* DeactivateClubMembership: Deactivate existing membership
* AssignClubFeature: Assign features to club members
- Implemented 3 Queries with handlers, validators, and DTOs:
* GetClubMembership: Retrieve single membership by UserId
* GetAllClubMemberships: List with filtering and pagination
* GetClubMembershipHistory: Audit trail with full history
- All operations include history tracking via ClubMembershipHistory
- Property names aligned with Domain entity definitions
- 21 new files, ~600 lines of code
- Build successful with 0 errors
Implemented complete CQRS pattern for System Configuration management:
Commands:
- SetConfigurationValueCommand: Create or update configurations with history tracking
- DeactivateConfigurationCommand: Deactivate configurations with audit trail
Queries:
- GetConfigurationByKeyQuery: Retrieve configuration by Scope and Key
- GetAllConfigurationsQuery: List all configurations with filters and pagination
- GetConfigurationHistoryQuery: View complete audit history for any configuration
Features:
- All commands include FluentValidation validators
- History recording to SystemConfigurationHistory table
- Pagination support for list queries
- DTOs for clean data transfer
- Null-safe implementations
Updated:
- IApplicationDbContext: Added 11 new DbSets for network-club entities
- GlobalUsings: Added new entity namespaces
Build Status: ✅ Success (0 errors, 184 warnings in legacy code)