Commit Graph

54 Commits

Author SHA1 Message Date
dac44dcb7d fix(frontend): align @angular/platform-browser-dynamic version to ^21.2.0
Fixed peer dependency conflict by updating @angular/platform-browser-dynamic
from ^20.0.7 to ^21.2.0 to match the rest of the Angular 21 packages.
2026-07-25 17:52:59 +02:00
675c10b949 feat(mako): add admin-selectable EDA communication method (email vs messenger)
- Add EdaCommunicationMethod enum (EMAIL, MESSENGER)
- Add EdaSettings entity with DB-persisted communication method
- Add AdminEdaSettingsController (GET/PUT /api/admin/eda-settings)
- Add EdaCommunicationRouter that resolves the correct EdaConsentService
- Add MessengerEdaConsentService as placeholder (throws UnsupportedOperationException)
- Add AdminEdaSettingsComponent in frontend with radio button selection
- Route /dashboard/admin-eda-settings (ADMIN only)
- Update EdaCommunicationEventListener to use router
- Remove @Profile from EmailEdaConsentService/SimulatedEdaConsentService
- Use @Lazy for EdaMailSender dependency to support non-prod contexts
- Fix pre-existing deleteUserTariff API call mismatch
2026-07-25 15:29:58 +02:00
6cb4ff7a4a fix(frontend): add missing provideEcharts() to app config causing empty dashboard chart
Root cause: ngx-echarts v18+ requires provideEcharts() in the app
config. Without it, NgxEchartsDirective silently fails to render
charts, causing the dashboard overview chart to appear empty.

Added provideEcharts() to app.config.ts and added
DashboardServiceIntegrationTest for the metering data overview endpoint.
2026-07-24 15:57:35 +02:00
0ef4f94933 fix(frontend): add error handling for dashboard overview metering data API
The empty error callback in loadMeteringData() silently swallowed API
failures, causing the chart to show 'Keine Daten' instead of the actual
error. Added proper error logging and user-facing error message.

Also added DashboardServiceTest for getMeteringDataOverview with
scenarios for data, no metering points, empty time range, and
multiple metering points.
2026-07-24 15:27:36 +02:00
cfe989c426 fix(frontend): append UTC offset to Instant date parameters in consumption dashboard
The consumption dashboard sent dates like '2026-06-24T00:00:00' without
timezone offset, which Spring could not parse into java.time.Instant.
Append 'Z' suffix to produce valid ISO-8601 UTC timestamps.
2026-07-24 15:03:22 +02:00
b1f38e752b feat(frontend): group dashboard sidebar navigation into sections
Add section-based grouping to the sidebar navigation with headers and
dividers. Menu items are now organized into 4 sections:
- Allgemein (Übersicht, Zählpunkte, Mein Profil)
- Community (Community beitreten, Meine Mitgliedschaften, Verbrauch)
- Tarife & Einladungen (Meine Tarife, Einladungen)
- Verwaltung (Admin-only: Mitgliedschaften, Benutzerverwaltung, etc.)

Only sections with visible items for the current role are rendered.
All 107 frontend tests passing.
2026-07-24 14:12:26 +02:00
cfc32b3a7d chore: cleanup test data and add missing test files
- Add TariffInviteServiceTest, GlobalExceptionHandlerTest, setup-test.ts
- Add compose plans/specs docs
- Extend .gitignore with *.xlsx, *.ps1, *.http, *.py, *.docx
- Remove stale test data files and scripts from working tree
2026-07-24 11:48:56 +02:00
c6dfa31839 fix(frontend): pass userId to deleteUserTariff API to fix compilation error
The generated API service requires userId as a second parameter for
deleteUserTariff(). Inject AuthService and use getCurrentUserId() to
provide the required argument, unblocking the entire frontend test suite.
2026-07-24 09:43:37 +02:00
54f45d6bf7 test(frontend): fix vitest test infrastructure and admin-user-approval tests
- Add vitest.config.ts for Angular 21 @angular/build:unit-test runner
- Install @angular/platform-browser-dynamic for TestBed initialization
- Regenerate API client from OpenAPI spec (npm run generate-api)
- Fix spec: use includes() for URL matching (generated API prepends basePath)
- Fix spec: 'should not reload' test assertion (0 not 1) for no-reload behavior
- All 107 frontend tests now pass (17 test files)
2026-07-24 09:33:19 +02:00
38e5fb3505 fix(frontend): regenerate API client from OpenAPI spec and fix deleteUserTariff type error 2026-07-24 09:15:54 +02:00
43f3bb6d8a test(frontend): enhance AdminMembershipsComponent tests and fix deleteUserTariff compilation error
- Expand admin-memberships spec from 19 to 42 tests covering:
  approve/reject API calls, isProcessing guards, error handling,
  loading states, tab switching, card/table views, empty states
- Fix deleteUserTariff missing userId argument in user-tariff.ts
  (required after backend API change)
2026-07-24 08:25:00 +02:00
71ecf47948 test(frontend): enhance AdminUserApprovalComponent tests with full coverage
Add comprehensive tests covering:
- Tab navigation (pending/all) with signal verification
- loadAllUsers() calls correct endpoint via generated AdminIAMService
- Error handling for loadPendingUsers and loadAllUsers failures
- Approve/reject user actions including undefined userId guards
- Template rendering: pending tab with Freigeben/Ablehnen buttons
- Template rendering: all users tab without action buttons
- Status badge rendering in both tabs
- Role column display (Unternehmen/Privatperson)
- Empty state messages for both tabs
- Duplicate Status column header bug fix verification
- No reload of allUsers if already loaded
2026-07-24 08:12:32 +02:00
e46b21c8ca test(backend): add OpenAPI spec assertions + regenerate frontend API client
- Add acceptance criteria assertions to OpenApiGeneratorTest:
  - Verify /api/community/admin/memberships path exists
  - Verify /api/admin/users path exists
  - Verify getAllUsers operation exists
- Regenerate frontend API client from OpenAPI spec
- Fix frontend type error: remove unnecessary userId parameter
  from deleteUserTariff call (backend uses @CurrentUserId from JWT)
2026-07-24 07:30:26 +02:00
f1cf152091 chore: update OpenAPI spec, Angular config, and dev application settings 2026-07-23 15:03:17 +02:00
ffa501e89f feat(frontend): add producer and consumer invite pages with navigation 2026-07-23 15:03:05 +02:00
4fdc2d5f7a feat(frontend): add metering data chart to dashboard overview with ECharts 2026-07-23 15:02:51 +02:00
ef933ed0ea feat(frontend): add tab navigation and table view to AdminMembershipsComponent
- Add three tabs: Ausstehende Anträge / Aktive Mitgliedschaften / Alle
- Card view for pending tab (existing approve/reject behavior preserved)
- Table view for active and all tabs (Name, Email, Community, Zählpunkt, Priorität, Status)
- getStatusLabel() for German status display (Ausstehend/Aktiv/Inaktiv)
- getStatusBadgeClass() for color-coded status badges
- Client-side filtering for instant tab switching
- Add comprehensive tests (19 test cases)
- Add getAllUsers() to AdminIAMService (fixes compilation for admin-user-approval)
- Fix deleteUserTariff missing userId argument in user-tariff component
2026-07-23 14:46:27 +02:00
dbd39643aa Merge branch 'mimocode/curious-nebula' 2026-07-23 14:33:24 +02:00
2bf1d49af1 feat(frontend): add tab navigation and all-users table to AdminUserApprovalComponent
- Add activeTab signal ('pending' | 'all') with tab navigation UI
- Add allUsers signal with loadAllUsers() using generated AdminIAMService.getAllUsers()
- Add getStatusLabel() helper for German status labels (Ausstehend/Aktiv/Freigeschaltet/Inaktiv/Abgelehnt)
- Add getStatusBadgeClass() for color-coded status badges (yellow/green/red)
- Fix duplicate 'Status' column header bug in pending users table
- All-users tab shows Name, Email, Status badge, Rolle columns (no action buttons)
- Add 22 passing tests covering signals, helpers, tab switching, approve/reject, and template
2026-07-23 14:32:02 +02:00
344587486a feat(community): add getAllMemberships() to frontend MembershipService
Add method to fetch all admin memberships via GET /api/community/admin/memberships
with corresponding unit tests using Angular HttpClientTestingModule.
2026-07-23 14:22:35 +02:00
2261ffbbd3 feat-common-regenerate-openapi-spec 2026-07-23 14:16:35 +02:00
a651ec946c feat(community): add metering data upload UI with preview and validation
- Add frontend upload page with file selection, drag-and-drop, and preview
- Add preview endpoint (POST /api/community/metering-data/preview/xlsx)
- Validate FEED_IN only for PRODUCER, CONSUMPTION only for CONSUMER metering points
- Optimize deduplication with bulk query (fix N+1 problem)
- Eliminate duplicate DB query in validateRecords
- Add 4 new tests for data type validation
- Add navigation entry for admin users
2026-07-23 07:07:52 +02:00
4b7b26231f feat(community): add member consumption dashboard with coverage preview
Backend:
- ConsumptionDashboardService: aggregates consumption and community
  feed-in data with daily/hourly granularity based on date range
- Coverage calculation: min(consumption, communityFeedIn) per interval
- Ownership check on dashboard endpoint
- 6 new aggregate queries in MeteringDataRepository
- findActiveMeteringPointIdsByCommunityId in MembershipRepository
- 6 unit tests for ConsumptionDashboardService

Frontend:
- Apache ECharts via ngx-echarts for chart visualization
- ConsumptionDashboardComponent with metering point selector,
  date range picker, quick-range buttons (7/30/90 days)
- Chart: blue bars (consumption), green bars (covered), orange
  line (community feed-in), tooltip with coverage percentage
- Summary cards: total consumption, coverage %, feed-in, covered kWh
- Warning when user has no community membership
- Route /dashboard/consumption (MEMBER only)

Tests: 143/143 passing
2026-07-22 13:23:58 +02:00
975f76dbd3 feat(community): add metering data upload and query with XLSX support
Implement complete metering data management for energy communities:

- MeteringData entity with unique constraint (metering_point_id, interval_start, data_type)
- Bulk upload via JSON or XLSX (multipart) with validation
- XLSX parser using Apache POI with comma-decimal support
- Ownership check on GET endpoints (userId must match metering point owner)
- Deduplication: existing records overwritten on re-upload
- DataSource tracking (EMAIL_XLSX, API, MANUAL)
- Query endpoints: by metering point, by type, by upload batch

Additional fixes:
- MapStruct annotation processor: add to execution-level annotationProcessorPaths
  (Spring Boot parent POM was overriding plugin-level config)
- EnergyCommunityMapper + MeteringDataMapper: componentModel=spring
- UserMapper: ignore passwordResetToken/Expiry (unmapped target policy ERROR)
- TariffService: add TariffInviteRepository dependency + invitation check
- TariffServiceTest: add missing @Mock for TariffInviteRepository
- SecurityConfig: permit /actuator/health and /actuator/info
- pom.xml: add poi-ooxml, postgresql, spring-boot-starter-actuator
- .gitignore: add *.log, survey/, backend.log

Tests: 137/137 passing
2026-07-22 12:42:27 +02:00
949e1e6c34 feat(dashboard): add pending memberships card to admin overview
- Add pendingMemberships field to AdminStats DTO
- Add 4th card 'Offene Mitgliedsanträge' to admin dashboard
- Rename 'Offene Freigaben' to 'Ausstehende Freischaltungen'
- Update DashboardService to count pending memberships
- Update tests to match new AdminStats structure
2026-07-22 10:59:01 +02:00
5949359216 fix(tariff): fix critical security and correctness issues from code review
- Fix UserTariffController: use @CurrentUserId instead of broken extractUserId()
- Fix UserTariffController: use @PathVariable instead of @RequestParam for userId in delete
- Add @PreAuthorize annotations to all tariff endpoints (ADMIN for community, MEMBER for user)
- Add duplicate tariff prevention for (source, target) pairs
- Optimize membership check: replace N+1 query with efficient isActiveMemberOfCommunity()
- Update tests to match new membership check API
2026-07-22 10:11:12 +02:00
0dfaa2d507 feat(tariff): implement complete tariff module with admin and user tariffs
Backend:
- Add CommunityTariff entity (admin-managed max price + surcharge per community)
- Add UserTariff entity (user-agreed tariffs between metering points)
- Add TariffController (admin endpoints) and UserTariffController (user endpoints)
- Add TariffService with full validation (price <= max, ACTIVE state, membership)
- Add CommunityTariffChangedEvent and UserTariffChangedEvent
- Update NotificationListener to notify members on tariff changes
- Add 27 comprehensive tests for TariffService

Frontend:
- Add AdminTariffComponent (/dashboard/tariffs) for managing community tariffs
- Add UserTariffComponent (/dashboard/my-tariffs) for managing user tariffs
- Add routing and navigation entries
- Regenerate OpenAPI spec and frontend API client

Note: Old Tariff.java entity replaced by CommunityTariff + UserTariff
2026-07-22 09:52:22 +02:00
a90b7ecc7e fix(frontend): replace alert() with ToastService, remove console.*, fix UI bugs
- Replace alert() with ToastService in admin-user-approval and admin-energy-community
- Remove all console.error/console.warn statements from components and guards
- Fix admin-energy-community modal title (now shows 'Bearbeiten' in edit mode)
- Fix admin-user-approval table header ('Zählpunkt' -> 'Status')
- Remove broken header nav links (#so-gehts, #faq) that pointed to non-existent sections
2026-07-22 09:25:50 +02:00
7baa1c72af refactor(common,community,mako): fix typos and remove dead code
- Rename MakoConsens* -> MakoConsent* (3 event classes + listener)
- Rename EdaCommuncationEventListener -> EdaCommunicationEventListener
- Rename PointType.PROSUME -> PROSUMER
- Remove dead SecurityConfig admin path matchers (actual security via @PreAuthorize)
- Regenerate OpenAPI spec and frontend API client
2026-07-22 09:15:27 +02:00
6770be9bef fix(security): externalize CORS origins, secure JWT secret default, fix RouterLink import
- Externalize CORS origins via app.cors-origins property (configurable per environment)
- Remove hardcoded JWT secret fallback; use env-var-only with safe test default
- Disable show-sql by default (enable only in dev profile)
- Create application-dev.yml with safe development defaults
- Add missing RouterLink import in MyMembershipsComponent (fixes runtime error)
2026-07-22 09:09:36 +02:00
0bfa0d98d5 test(dashboard,frontend): add DashboardControllerTest, fix broken spec files and add login tests
- Add DashboardControllerTest with 4 tests for admin and user dashboard endpoints
- Fix incorrect class name imports in header, admin-user-approval, metering-points, verify-email specs
- Add missing ActivatedRoute/Router/AuthService providers in all spec files
- Replace stub login spec with 10 comprehensive tests (form validation, role redirect, error handling)
- Remove stale 'should render title' test from app.spec.ts
2026-07-22 08:39:58 +02:00
c180d6fd32 fix(frontend): replace HttpClient with generated AuthenticationService in verify-email 2026-07-22 08:39:37 +02:00
d87f6fe95b fix(frontend): activate landing page buttons and add forgot-password link
- Landing page: 'Jetzt Ersparnis berechnen' links to /register
- Landing page: 'Mehr erfahren' links to /dashboard
- Landing page: remove empty li element
- Login page: add 'Passwort vergessen?' link to /forgot-password
2026-07-22 07:50:49 +02:00
20787395ab refactor(frontend): replace hardcoded localhost URLs with environment config
- Create environment.ts with apiUrl constant
- Update all 6 services to use environment.apiUrl
- Update forgot-password and reset-password pages
- Update app.config.ts BASE_PATH provider
2026-07-22 07:50:38 +02:00
a9329b309f feat(frontend): wire notification component into dashboard header
- Import NotificationComponent in DashboardLayout
- Add bell icon with unread badge to dashboard header
2026-07-22 07:42:36 +02:00
cadd5a697e feat(community): add metering point update endpoint and UI
- Add UpdateMeteringPointRequest DTO (type-only update)
- Add PUT /{id} endpoint with owner and state validation
- Only NEW/REJECTED/ERROR states allow editing
- Frontend: inline edit form with type dropdown
- Frontend: updateMeteringPoint() service method
- Add 7 unit tests for update workflow
2026-07-22 07:42:22 +02:00
caf282cb1e fix(mako): fix findPendingWithDetails query and OpenApiGeneratorTest
- Remove invalid JOIN FETCH mp.user from MembershipRepository query
  (MeteringPoint has no @ManyToOne User field, only UUID userId)
- Fix OpenApiGeneratorTest: disable security filters for MockMvc,
  use UTF-8 for getContentAsString and Files.writeString
2026-07-22 07:41:52 +02:00
96bcf57cee feat(community): add metering point deletion with business rules
Backend:
- Add deleteByIdAndUserId to MeteringPointRepository
- Add deleteOwnMeteringPoint with validation (owner, state checks)
- Add DELETE /{id} endpoint to MeteringPointController

Frontend:
- Add deleteMeteringPoint to MeteringPointService
- Add delete button with confirmation dialog
- Only show delete for inactive points (NEW, REJECTED, ERROR)

Business Rules:
- Only owner can delete own metering points
- Only inactive points (NEW, REJECTED, ERROR) can be deleted
- ACTIVE and WAITING_FOR_CONSENT points cannot be deleted

Tests:
- Add MeteringPointServiceTest with 10 unit tests
- All 37 tests passing
2026-07-21 15:06:48 +02:00
04be9a62ea feat(iam): add complete notification system with email and in-app notifications
Backend:
- Generalize MailService with send() method
- Add Notification entity, repository, service, controller
- Add NotificationListener for 6 domain events
- Add password reset flow (forgot-password, reset-password)
- Add configurable frontend URL in application.yml

Frontend:
- Add notification service and bell-icon component
- Add forgot-password and reset-password pages
- Add routes for new pages

Tests:
- Add NotificationServiceTest with 5 unit tests
- All 27 tests passing
2026-07-21 13:38:15 +02:00
a2025a55e4 fix(dashboard): optimize stats queries and add error handling
Backend:
- Add countByStatus() to MembershipRepository
- Add countByUserIdAndStatus() to MembershipRepository
- Add countByStatusAndEmailVerified() to UserRepository
- Add countByUserId() to MeteringPointRepository
- Optimize DashboardService to use count queries instead of findAll

Frontend:
- Add error signal and error message display
- Add loading spinner animation

Tests:
- Add DashboardServiceTest with 2 unit tests
- All 22 tests passing
2026-07-21 13:07:19 +02:00
c66c5fddfa feat(community): add complete membership flow with unit tests
Backend:
- Add MembershipResponse and PendingMembershipResponse DTOs
- Add GET /memberships/me and GET /admin/memberships/pending endpoints
- Add findByUserIdWithDetails and findPendingWithDetails queries
- Add getOwnMemberships and getPendingMemberships service methods

Frontend:
- Add membership service for API calls
- Add join-community page for users to browse and join communities
- Add my-memberships page for users to view their memberships
- Add admin-memberships page for admins to approve/reject requests
- Add routes and navigation items

Tests:
- Add MembershipServiceTest with 13 unit tests
- All 20 tests passing (UserServiceTest + MembershipServiceTest)
2026-07-21 12:42:07 +02:00
838fdb2826 feat(frontend): add responsive design, form validation, toast service and error handling
- Responsive navigation with mobile hamburger menu
- Reactive forms with real-time validation on profile page
- Toast service for success/error/warning messages
- HTTP error interceptor for 401/403/500 handling
- Loading states with spinner animations
2026-07-21 12:08:39 +02:00
52c6641b3a add user profile management
- Add UserController with GET/PUT /me, PUT /me/password, PUT /me/email
- Add UserService with profile update, password change, email change
- Add UserServiceTest with 7 unit tests
- Add IamDtos: UpdateProfileRequest, ChangePasswordRequest, ChangeEmailRequest
- Add Angular profile page with edit profile, change password, change email
- Add Angular UserService for profile API calls
- Add profile route and navigation item
2026-07-21 11:12:20 +02:00
70e05e524b added meteringpoint management 2026-07-05 15:08:01 +02:00
2e9790b3b2 simplified user registration process 2026-07-05 14:36:26 +02:00
59a0b6b9b7 generalized dashboard for member and admin 2026-07-05 10:49:46 +02:00
caf05d3103 implemented delete of energy community 2026-07-01 12:57:01 +02:00
8b57f97d88 fixed Dto mapping in EnergyCommunityAdminController and openapi definition 2026-06-24 08:33:15 +02:00
81ee804ae1 added basic eg managment 2026-06-23 14:34:06 +02:00
ad47f7399e added admin approval list
implemented approval (untested)
implemented eda consent simulation (untested)
2026-06-17 11:08:44 +02:00