feat-common-regenerate-openapi-spec

This commit is contained in:
Bernhard Müller 2026-07-23 14:16:35 +02:00
parent cf59de80bc
commit 2261ffbbd3
3 changed files with 102 additions and 1 deletions

View File

@ -0,0 +1,38 @@
package at.mueller.eeg.backend;
import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import static org.junit.jupiter.api.Assertions.assertTrue;
class OpenApiSpecValidationTest {
private static final Path OPENAPI_PATH = Paths.get("../eeg_frontend/openapi.yaml");
@Test
void openApiSpecContainsAllMembershipsEndpoint() throws Exception {
String yaml = Files.readString(OPENAPI_PATH, StandardCharsets.UTF_8);
// Must contain the exact "all memberships" path (not just /pending or /{id}/approve)
assertTrue(yaml.contains("/api/community/admin/memberships:\n"),
"OpenAPI-Spec muss den Endpoint /api/community/admin/memberships enthalten");
}
@Test
void openApiSpecContainsAllUsersEndpoint() throws Exception {
String yaml = Files.readString(OPENAPI_PATH, StandardCharsets.UTF_8);
// Must contain the exact root GET /api/admin/users path (not just /pending or /{userId}/approve)
assertTrue(yaml.contains("/api/admin/users:\n"),
"OpenAPI-Spec muss den Endpoint /api/admin/users (Root) enthalten");
}
@Test
void openApiSpecPendingMembershipResponseHasValidFromAndTo() throws Exception {
String yaml = Files.readString(OPENAPI_PATH, StandardCharsets.UTF_8);
assertTrue(yaml.contains("validFrom"), "PendingMembershipResponse muss validFrom enthalten");
assertTrue(yaml.contains("validTo"), "PendingMembershipResponse muss validTo enthalten");
}
}

View File

@ -432,6 +432,31 @@ paths:
'*/*':
schema:
$ref: "#/components/schemas/MeteringDataUploadResponse"
/api/community/metering-data/preview/xlsx:
post:
tags:
- metering-data-controller
operationId: previewXlsx
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
required:
- file
responses:
"200":
description: OK
content:
'*/*':
schema:
type: array
items:
$ref: "#/components/schemas/MeteringDataRecordDto"
/api/community/memberships/request:
post:
tags:
@ -866,6 +891,21 @@ paths:
'*/*':
schema:
$ref: "#/components/schemas/ConsumptionDashboardResponse"
/api/community/admin/memberships:
get:
tags:
- membership-controller
summary: Alle Mitgliedschaften abrufen
operationId: getAllMemberships
responses:
"200":
description: Liste aller Mitgliedschaften
content:
'*/*':
schema:
type: array
items:
$ref: "#/components/schemas/PendingMembershipResponse"
/api/community/admin/memberships/pending:
get:
tags:
@ -894,6 +934,23 @@ paths:
responses:
"200":
description: OK
/api/admin/users:
get:
tags:
- Admin IAM
summary: Lädt alle User
description: Zeigt alle registrierten Benutzer sortiert nach Erstellungsdatum
(neueste zuerst).
operationId: getAllUsers
responses:
"200":
description: Liste aller Benutzer erfolgreich geladen
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/UserProfileResponse"
/api/admin/users/pending:
get:
tags:
@ -1619,3 +1676,9 @@ components:
format: int32
status:
type: string
validFrom:
type: string
format: date
validTo:
type: string
format: date

View File

@ -187,7 +187,7 @@ export class UserTariffComponent implements OnInit, OnDestroy {
onDelete(tariff: UserTariffResponse) {
if (!confirm('Möchtest du diesen Tarif wirklich löschen?')) return;
this.userTariffService.deleteUserTariff(tariff.id!, tariff.sourceMeteringPointId!).subscribe({
this.userTariffService.deleteUserTariff(tariff.id!).subscribe({
next: () => {
this.toastService.success('Tarif erfolgreich gelöscht.');
this.loadUserTariffs(this.selectedCommunityId());