Commit Graph

143 Commits

Author SHA1 Message Date
masoodafar-web
217ef147dd feat: Implement manual payment system with gRPC service and related commands/queries 2025-12-05 17:26:58 +03:30
masoodafar-web
ee1fa9d064 feat: Enhance withdrawal request handling with additional fields and network level configurations 2025-12-04 19:53:30 +03:30
masoodafar-web
5e3112d71f feat: Implement withdrawal reports query and service integration 2025-12-04 17:29:10 +03:30
masoodafar-web
abda623519 chore: Bump CMSMicroservice.Protobuf version to 0.0.142 2025-12-04 05:21:25 +03:30
masoodafar-web
ba6d74fe35 feat: Implement Public Message Management Commands and Queries
- 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.
2025-12-04 03:43:19 +03:30
masoodafar-web
84f642e900 feat: Implement bulk update for product prices and stock, and add low stock products query and toggle product status functionality 2025-12-04 02:56:03 +03:30
masoodafar-web
f0f48118e7 Add validators and services for Product Galleries and Product Tags
- 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.
2025-12-04 02:40:49 +03:30
masoodafar-web
40d54d08fc feat: Implement Bank Mellat and Daya payment gateway services with initiation, verification, and payout processing 2025-12-02 03:31:17 +03:30
masoodafar-web
78606cc5cc feat: Add ClearCart command and response, implement CancelOrder command with validation, and enhance DeliveryStatus and User models 2025-12-02 03:30:36 +03:30
masoodafar-web
25fc73ae28 feat: Enhance network membership and withdrawal processing with user tracking and logging 2025-12-01 20:52:18 +03:30
masoodafar-web
4aaf2247ff feat: Implement Approve and Reject Withdrawal commands with handlers 2025-12-01 16:48:07 +03:30
masoodafar-web
8d31a8c026 feat: Add GetClubStatistics and GetNetworkStatistics APIs with corresponding request and response messages 2025-12-01 16:43:53 +03:30
masoodafar-web
199e7e99d1 feat: Add monitoring alerts skeleton and enhance worker with notifications 2025-11-30 20:18:10 +03:30
masoodafar-web
55fa71e09b docs: Complete Phase 8 documentation
Added comprehensive Phase 8 documentation:
- Migration 20251129002222_AddNetworkClubSystemV2 details
- 11 new tables created
- 3 existing tables updated
- Complete index and foreign key specifications
- 10 default SystemConfigurations seeded
- ApplicationDbContextInitialiser logic documented
- Updated project statistics (15 commits total)
- System marked as fully operational

Database Status:  Ready for production
All phases except Testing (optional) complete!
2025-11-29 05:00:41 +03:30
masoodafar-web
0ddf64370d feat: Complete Phase 8 - Migration & Seed Data
Database Migration:
- Applied migration 20251129002222_AddNetworkClubSystemV2
- Created 11 new tables:
  * SystemConfigurations
  * SystemConfigurationHistories
  * ClubMemberships
  * ClubMembershipHistories
  * ClubFeatures
  * UserClubFeatures
  * NetworkWeeklyBalances
  * WeeklyCommissionPools
  * UserCommissionPayouts
  * CommissionPayoutHistories
  * NetworkMembershipHistories
- Updated existing tables:
  * Users: Added NetworkParentId, LegPosition
  * UserWallets: Added DiscountBalance
  * Products: Added IsClubExclusive, ClubDiscountPercent

Seed Data:
- Added 10 default SystemConfigurations:
  * Network settings (MaxDepth, AllowOrphanNodes)
  * Club settings (DefaultDuration, MinimumActivation)
  * Commission settings (PoolPercent, MinimumPayout, WithdrawalMethods)
  * System settings (MaintenanceMode, AuditLog)

Migration Status:  Applied successfully
Database Schema:  Verified
Build Status:  Success (0 errors)
2025-11-29 04:57:42 +03:30
masoodafar-web
6651063297 docs: Update progress for Phase 6 completion
Added Phase 6 (gRPC API Integration) documentation:
- 4 Protobuf files with complete RPC definitions
- 4 gRPC Service classes with MediatR integration
- 26 RPC endpoints (Configuration: 5, ClubMembership: 6, NetworkMembership: 6, Commission: 9)
- HTTP transcoding support
- Auto-registration mechanism
- Updated overall project statistics

Total project stats:
- 145+ files created
- ~10,830 lines of code
- 12 successful commits
- 6 phases completed
2025-11-29 04:49:21 +03:30
masoodafar-web
2bb8c2a13c feat: Add gRPC API Layer - Phase 6 Integration
Added Protobuf definitions and gRPC services for all CQ layers:

Protobuf Files (4):
- configuration.proto: 2 Commands + 3 Queries (5 RPCs)
- clubmembership.proto: 3 Commands + 3 Queries (6 RPCs)
- networkmembership.proto: 3 Commands + 3 Queries (6 RPCs)
- commission.proto: 5 Commands + 4 Queries (9 RPCs)

gRPC Services (4):
- ConfigurationService: SetConfigurationValue, Deactivate, GetByKey, GetAll, GetHistory
- ClubMembershipService: Activate, Deactivate, AssignFeature, Get, GetAll, GetHistory
- NetworkMembershipService: Join, Move, Remove, GetPosition, GetTree, GetHistory
- CommissionService: Calculate+Process+Withdraw (5 commands), Get queries (4)

Features:
- HTTP transcoding enabled via google.api.http annotations
- Auto-registration via ConfigureGrpcEndpoints
- MetaData pagination support
- Request/Response DTOs for all endpoints
- Integration with MediatR CQRS handlers

Total: 4 proto files, 4 service classes, 26 RPC endpoints
Build:  Successful (0 errors)
2025-11-29 04:45:27 +03:30
masoodafar-web
3010881b4e docs: Update implementation-progress.md for Phase 5 completion
Added Phase 5 (CommissionCQ) complete documentation:
- 5 Commands with detailed logic explanations
- 4 Queries with filters and features
- Recursive Binary Tree algorithm documentation
- State machine and withdrawal system
- Type conversion fixes documented
- Overall project statistics updated

Total lines: ~9,670 | Total files: 137+ | Total commits: 11
2025-11-29 04:34:58 +03:30
masoodafar-web
487d1ceb15 feat: Add CommissionCQ - Phase 5 Application Layer
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
2025-11-29 04:32:17 +03:30
masoodafar-web
e68a7182d9 docs: Update implementation progress - Phase 4 complete 2025-11-29 04:21:54 +03:30
masoodafar-web
db96a02f89 feat: Add NetworkMembershipCQ - Phase 4 Application Layer
- 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
2025-11-29 04:19:40 +03:30
masoodafar-web
b21dda515e docs: Update implementation progress - Phase 3 complete 2025-11-29 04:15:05 +03:30
masoodafar-web
fe66d478ee feat: Add ClubMembershipCQ - Phase 3 Application Layer
- 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
2025-11-29 04:13:27 +03:30
masoodafar-web
fb911cd0fd docs: Update progress - ConfigurationCQ completed (Phase 2)
ConfigurationCQ Implementation Summary:
 2 Commands: SetConfigurationValue, DeactivateConfiguration
 3 Queries: GetByKey, GetAll, GetHistory
 6 Validators with FluentValidation
 6 Handlers with history tracking
 4 DTOs for clean data transfer
 612+ lines of code added
 Build successful (0 errors)

Next: ClubMembershipCQ implementation
2025-11-29 04:03:22 +03:30
masoodafar-web
f6fa070067 feat: Add ConfigurationCQ - Phase 2 Application Layer
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)
2025-11-29 04:02:02 +03:30
masoodafar-web
0d52515be4 docs: Update implementation progress - Phase 1 completed
Phase 1 (Domain Layer) - 100% Complete:
 All enums created (8 files)
 All entities created (11 new + 3 updated)
 All EF configurations created (14 files)
 Migration created and tested
 6,300+ lines of code added
 Build successful with no errors

Ready for Phase 2: Application Layer (CQRS)
2025-11-29 03:54:49 +03:30
masoodafar-web
04bc593184 feat: Add EF configurations and migration for network-club system
EF Core Configurations (11 files):
- SystemConfigurationConfiguration with Scope+Key composite index
- ClubMembershipConfiguration with one-to-one User relationship
- ClubFeatureConfiguration with IsActive+SortOrder index
- UserClubFeatureConfiguration with composite unique index
- NetworkWeeklyBalanceConfiguration with UserId+WeekNumber index
- WeeklyCommissionPoolConfiguration with unique WeekNumber
- UserCommissionPayoutConfiguration with multiple indexes
- ClubMembershipHistoryConfiguration for audit trail
- NetworkMembershipHistoryConfiguration for audit trail
- CommissionPayoutHistoryConfiguration for audit trail
- SystemConfigurationHistoryConfiguration for audit trail

Configuration Updates:
- UserConfiguration: Add NetworkParentId, LegPosition with indexes
- UserWalletConfiguration: Add DiscountBalance field
- ProductsConfiguration: Add IsClubExclusive, ClubDiscountPercent with index

Infrastructure Updates:
- ApplicationDbContext: Add 11 new DbSets for network-club entities
- GlobalUsings: Add Domain entity namespaces

Migration:
- AddNetworkClubSystemV2: Complete database schema for network-club system
2025-11-29 03:52:46 +03:30
masoodafar-web
d20dc86d2f feat: Add core entities and history tables for network-club system
Core Entities:
- Add SystemConfiguration for dynamic config management
- Add ClubMembership, ClubFeature, UserClubFeature for club management
- Add NetworkWeeklyBalance for binary network tracking
- Add WeeklyCommissionPool, UserCommissionPayout for commission system

History Entities (Audit Trail):
- Add ClubMembershipHistory
- Add NetworkMembershipHistory
- Add CommissionPayoutHistory
- Add SystemConfigurationHistory

Updates to Existing Entities:
- User: Add NetworkParentId, LegPosition, and navigation properties
- UserWallet: Add NetworkBalance and DiscountBalance fields
- Products: Add IsClubExclusive and ClubDiscountPercent fields
- GlobalUsings: Add new namespaces for club/network/commission entities
2025-11-29 03:44:41 +03:30
masoodafar-web
462ae5dcc0 feat: Add enums for network-club system
- Add CommissionPayoutStatus enum (Pending, Paid, WithdrawRequested, Withdrawn, Cancelled)
- Add WithdrawalMethod enum (Cash, Diamond)
- Add NetworkLeg enum (Left, Right)
- Add ClubMembershipAction enum for history tracking
- Add NetworkMembershipAction enum for history tracking
- Add CommissionPayoutAction enum for history tracking
- Add ConfigurationScope enum (System, Network, Club, Commission)
- Update TransactionType enum with NetworkCommission, ClubActivation, DiscountWalletCharge
2025-11-29 03:36:54 +03:30
masoodafar-web
6089181bcf Add documentation for network club commission system and wallet management 2025-11-29 03:33:42 +03:30
masoodafar-web
8f77097278 Bump version to 0.0.139 in CMSMicroservice.Protobuf 2025-11-28 14:44:49 +03:30
masoodafar-web
99ef7983f8 Add CreatedAt field to wallet change log responses 2025-11-28 14:07:10 +03:30
masoodafar-web
a3c7033d95 Add CategoryId filter to product query and proto 2025-11-28 11:00:36 +03:30
masoodafar-web
ce2bf3f1f0 Make amount, user_id and address_id optional in user order update 2025-11-28 04:02:00 +03:30
masoodafar-web
84f08f11e4 Make package_id optional in user order proto and command 2025-11-28 02:47:27 +03:30
masoodafar-web
746c0b2542 Fix filter null checks and status comparisons in order query 2025-11-27 23:24:26 +03:30
masoodafar-web
b706e02d4f Update payment date filter to use greater than or equal comparison 2025-11-27 18:58:28 +03:30
masoodafar-web
38ce54d367 Fix PaymentStatus comparison in order filter query 2025-11-27 18:49:01 +03:30
masoodafar-web
c011645433 Add user full name and national code to order responses 2025-11-27 18:21:17 +03:30
masoodafar-web
32b7cb3238 Add delivery tracking fields to UserOrder entity 2025-11-27 06:39:47 +03:30
masoodafar-web
23ac9f77a1 Add category support to products commands and queries 2025-11-27 05:39:26 +03:30
masoodafar-web
e2bd966098 update4 2025-11-25 05:46:46 +03:30
masoodafar-web
7ba48b2f11 update3 2025-11-25 05:39:39 +03:30
masoodafar-web
c01e85381c update2 2025-11-25 05:23:55 +03:30
masoodafar-web
dcb3ce69a8 update1 2025-11-25 04:59:50 +03:30
masoodafar-web
b91c83db7e Generator Changes at 11/25/2025 4:32:37 AM +03:30 2025-11-25 04:33:50 +03:30
masoodafar-web
c871f8e4c0 Update model.ndm2 2025-11-25 04:31:56 +03:30
masoodafar-web
1a0012eb86 update 2025-11-25 03:56:45 +03:30
masoodafar-web
88f38f5d8e update 2025-11-25 03:04:00 +03:30
masoodafar-web
8a7d02ce81 Generator Changes at 11/25/2025 2:19:02 AM +03:30 2025-11-25 02:21:08 +03:30