Set up domain foundation for batching strategy#11
Merged
CoderMariusz merged 2 commits intomainfrom Nov 23, 2025
Merged
Conversation
Complete implementation of city-building game domain layer with comprehensive test coverage. ## BATCH 0: Foundation (3 SP) ✅ - Building entity with production & upgrade mechanics - Time-based resource accumulation - Level scaling (+20% production, +50% costs per level) ## BATCH 1: Domain Foundation (3 SP) ✅ - Resource entity (gold, wood, stone, food) - PlayerEconomy entity for resource management - Resource validation and inventory operations ## BATCH 2: Domain Use Cases (10 SP) ✅ - CollectResources use case (single + batch operations) - UpgradeBuilding use case (with preview & validation) - Complete error handling with custom exceptions ## Files Added ### Domain Entities (3 files) - lib/features/city_builder/domain/entities/building.dart - lib/features/city_builder/domain/entities/resource.dart - lib/features/city_builder/domain/entities/player_economy.dart ### Use Cases (2 files) - lib/features/city_builder/domain/usecases/collect_resources.dart - lib/features/city_builder/domain/usecases/upgrade_building.dart ### Tests (5 files, 78 tests total) - test/features/city_builder/domain/entities/building_test.dart (23 tests) - test/features/city_builder/domain/entities/resource_test.dart (6 tests) - test/features/city_builder/domain/entities/player_economy_test.dart (14 tests) - test/features/city_builder/domain/usecases/collect_resources_test.dart (25 tests) - test/features/city_builder/domain/usecases/upgrade_building_test.dart (20 tests) ### Documentation - lib/features/city_builder/README.md ## Key Features ### Building Entity - Production rates (resources per hour) - Upgrade cost calculation - Time-based resource accumulation - Level progression mechanics ### Resource Management - Multiple resource types (gold, wood, stone, food) - Max storage limits - Add/subtract operations with validation - Total wealth calculation ### Use Cases - Collect resources from buildings (single + batch) - Upgrade buildings with cost validation - Preview upgrades before executing - Comprehensive error handling ## Technical Details - Clean Architecture (domain layer only) - Immutable entities (Freezed pattern) - Result type for error handling - Batch operations for performance - 78 unit tests with full coverage ## Next Steps - BATCH 3: Flame Grid & Camera (13 SP) - BATCH 4: Presentation & Integration (8 SP) Story Points: 16 SP (3 + 3 + 10) Test Coverage: 78 unit tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.