Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements comprehensive partner statistics APIs (daily, monthly, and total) for item-level data, adds a netPayloadWeight column to the TradeItem entity with proper database migration, refactors partner statistics access control to separate Admin and Partner permissions (removing Agency access), and establishes Flyway for database schema management with detailed documentation.
Changes:
- Added
netPayloadWeightcolumn totrade_itemtable with safe Flyway migration (nullable → backfill → NOT NULL) - Implemented partner daily/monthly/total item statistics query APIs with QueryDSL
- Refactored partner statistics API permissions: Admin can view any partner, Partners can only view their own statistics, Agency access removed
- Set up Flyway with auto-repair for dev/test environments and comprehensive Korean/English documentation
Reviewed changes
Copilot reviewed 52 out of 68 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/main/resources/db/migration/V20260129__add_trade_item_net_payload_weight.sql |
Flyway migration adding netPayloadWeight column with safe backfill pattern |
src/main/java/greenfirst/be/trade/adapter/out/persistence/entity/TradeItemEntity.java |
Added netPayloadWeight NOT NULL column to entity |
src/main/java/greenfirst/be/trade/domain/command/create/CreateTradeItemCommand.java |
Added validation ensuring netPayloadWeight = weight - weightLoss |
src/main/java/greenfirst/be/trade/domain/service/CarbonReductionCalculator.java |
Updated to use netPayloadWeight with fallback calculation |
src/main/java/greenfirst/be/stats/application/service/*/ |
Implemented daily/monthly/total statistics services with permission checks |
src/main/java/greenfirst/be/stats/adapter/out/persistence/querydsl/*/ |
QueryDSL repository implementations for statistics aggregation using netPayloadWeight |
src/main/java/greenfirst/be/stats/adapter/in/web/controller/*/ |
REST controllers with separate Admin and Partner endpoints |
src/main/java/greenfirst/be/global/config/flyway/FlywayConfig.java |
Auto-repair configuration for local/test/test-dev profiles only |
src/main/resources/application.yml |
Added Flyway baseline-on-migrate and graceful shutdown configuration |
build.gradle |
Added Flyway dependencies and plugin configuration |
.claude/skills/flyway/SKILL.md |
Comprehensive Flyway skill documentation (English & Korean) |
md-ko-ver/flyway-guide.ko.md |
User-facing Flyway usage guide in Korean |
| Test files | Comprehensive test coverage for all new features with fixture updates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (netWeight == null && data.getWeight() != null) { | ||
| netWeight = data.getWeightLoss() == null ? data.getWeight() : data.getWeight().subtract(data.getWeightLoss()); | ||
| } | ||
| BigDecimal itemCarbonReduction = netWeight.multiply(factor.getEmissionFactorKgCo2ePerKg()); // 품목별 탄소 저감량 |
There was a problem hiding this comment.
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.
Issue ✨
변경점 👍