Feature/conluz 189#192
Merged
Merged
Conversation
Mirror the Datadis consumption monthly aggregation for production: - Domain service + repository port under domain/production/datadis/aggregate - InfluxDB impl aggregating hourly datadis_production_kwh into datadis_production_kwh_month via SUM(production_kwh)/LAST(obtain_method), GROUP BY cups, with a deterministic first-of-month timestamp so re-runs overwrite instead of duplicating - Monthly aggregation job (cron 5AM, after the 4AM hourly sync) - DatadisProductionMonthlyPoint read model - Arch-test exception for the non-transactional aggregation service - Influx integration test: per-cups sums across two months, deterministic timestamp, and idempotent re-run Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirror the Datadis consumption yearly aggregation for production: - Domain service + repository port under domain/production/datadis/aggregate - InfluxDB impl reading the monthly datadis_production_kwh_month measurement and writing datadis_production_kwh_year via SUM(production_kwh)/ LAST(obtain_method), GROUP BY cups, with a deterministic Jan-1 timestamp - Yearly aggregation job (cron 6AM, after the 5AM monthly aggregation) - DatadisProductionYearlyPoint read model - Arch-test exception for the non-transactional aggregation service - Influx integration test: per-cups yearly sums from monthly points, deterministic timestamp, and idempotent re-run Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Expose manual triggers for the monthly and yearly Datadis production
aggregations, mirroring the consumption sync controllers:
- POST /api/v1/communities/{communityId}/production/datadis/sync/monthly
- POST /api/v1/communities/{communityId}/production/datadis/sync/yearly
- Authorization lives only in the controller via
@communityAccessGuard.canManageCommunity(#communityId); OpenAPI tag
ApiTag.PRODUCTION; gated on the community's Datadis config being enabled
(409 otherwise)
- Request bodies with year/month/supplyCode validation
- Security matrix tests per endpoint: 401 (no token), 403 (member who
cannot manage), 404 (community not visible), happy path verifying the
service is invoked, plus 409-disabled and validation cases
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cover DatadisProductionMonthlyAggregationServiceImpl and DatadisProductionYearlyAggregationServiceImpl with Mockito unit tests, mirroring the consumption aggregation service tests: global/community/ single-supply overloads, skipping supplies without a distributor code, per-supply exception isolation, and SupplyNotFoundException for missing or cross-community supplies. Tests are named after the service interfaces. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The production Datadis sync controllers embedded domain logic (config gating that called GetDatadisConfigRepository directly, plus supply/month dispatch branching). Controllers must be thin and never call repositories. - Add syncMonthlyProductions/syncYearlyProductions to the aggregation services; the service impls now own the Datadis-enabled precondition (throwing DatadisDisabledException) and all the supply/month dispatch, delegating to the granular aggregation methods. - Controllers now only authorize, validate the body, and make a single service call. Removed the GetDatadisConfigRepository dependency and the now-unused getMonthEnum() from the monthly body. - Move the config-gating and dispatch assertions from the controller tests into the service unit tests; controller tests now assert pass-through and that service-thrown exceptions map to 409/404. - CLAUDE.md: add a standard requiring thin controllers (no domain logic, no repository calls). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the config gating and supply/plant dispatch out of every Datadis and Huawei sync controller and into the services, so controllers only authorize, validate the body, and make a single service call — never touching a repository. - Consumption aggregation: add syncMonthly/YearlyConsumptions to the services (Datadis config gating + dispatch); thin the monthly/yearly controllers; drop the unused getMonthEnum from the monthly body. - Hourly consumption sync: add synchronize(..., String supplyCode) to DatadisSyncService (config gating + dispatch); thin the controller. - Huawei aggregation: add syncMonthly/YearlyProductions to the services (Huawei config gating + dispatch); thin the monthly/yearly controllers; drop the unused getMonthEnum from the monthly body. - Move the config-gating/dispatch assertions from the controller tests into the service unit tests; controller tests now assert pass-through and that service-thrown exceptions map to 409/404, plus the 401/403/404 matrix. - Add ControllerRepositoryAccessArchTest: no @Controller/@RestController may depend on a *Repository / *RepositoryDatabase / *RepositoryInflux type. - CLAUDE.md: reference the new arch test from the thin-controller rule. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.