diff --git a/helm/Chart.yaml b/helm/Chart.yaml
index 59a0e54fa..0a29056bf 100644
--- a/helm/Chart.yaml
+++ b/helm/Chart.yaml
@@ -2,8 +2,8 @@ apiVersion: v2
name: core
description: APIs to manage configuration for CI and PSP of pagoPA
type: application
-version: 0.174.0
-appVersion: 0.59.19
+version: 0.175.0
+appVersion: 0.59.19-1-PPANTT-142-get-all-maintenances
dependencies:
- name: microservice-chart
version: 2.8.0
diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml
index 63074e12e..7e0cd3bb5 100644
--- a/helm/values-dev.yaml
+++ b/helm/values-dev.yaml
@@ -28,7 +28,7 @@ microservice-chart: µservice-chart
envSecret: {}
image:
repository: ghcr.io/pagopa/pagopa-api-config
- tag: "0.59.19"
+ tag: "0.59.19-1-PPANTT-142-get-all-maintenances"
pullPolicy: Always
livenessProbe:
httpGet:
diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml
index 08e2c72d3..62bc3ae92 100644
--- a/helm/values-prod.yaml
+++ b/helm/values-prod.yaml
@@ -28,7 +28,7 @@ microservice-chart: µservice-chart
envSecret: {}
image:
repository: ghcr.io/pagopa/pagopa-api-config
- tag: "0.59.19"
+ tag: "0.59.19-1-PPANTT-142-get-all-maintenances"
pullPolicy: Always
livenessProbe:
httpGet:
diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml
index dc65f1978..8425625b1 100644
--- a/helm/values-uat.yaml
+++ b/helm/values-uat.yaml
@@ -28,7 +28,7 @@ microservice-chart: µservice-chart
envSecret: {}
image:
repository: ghcr.io/pagopa/pagopa-api-config
- tag: "0.59.19"
+ tag: "0.59.19-1-PPANTT-142-get-all-maintenances"
pullPolicy: Always
livenessProbe:
httpGet:
diff --git a/openapi/openapi.json b/openapi/openapi.json
index 419899ff8..69399cf03 100644
--- a/openapi/openapi.json
+++ b/openapi/openapi.json
@@ -4,7 +4,7 @@
"title": "core",
"description": "Spring application exposes APIs to manage configuration for CI/PSP on the Nodo dei Pagamenti",
"termsOfService": "https://www.pagopa.gov.it/",
- "version": "0.59.19"
+ "version": "0.59.19-1-PPANTT-142-get-all-maintenances"
},
"servers": [
{
@@ -684,6 +684,168 @@
}
]
},
+ "/brokers/station-maintenances": {
+ "get": {
+ "tags": [
+ "Creditor Institutions"
+ ],
+ "summary": "Get a list of all stations' maintenance filtered by dates",
+ "operationId": "getAllStationsMaintenances",
+ "parameters": [
+ {
+ "name": "startDateTimeBefore",
+ "in": "query",
+ "description": "Start date of maintenance, used to retrieve all maintenance that start before the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "example": "2024-04-01T10:00:00.000Z"
+ },
+ {
+ "name": "startDateTimeAfter",
+ "in": "query",
+ "description": "Start date of maintenance, used to retrieve all maintenance that start after the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "example": "2024-04-01T10:00:00.000Z"
+ },
+ {
+ "name": "endDateTimeBefore",
+ "in": "query",
+ "description": "End date of maintenance, used to retrieve all maintenance that start before the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "example": "2024-04-01T13:00:00.000Z"
+ },
+ {
+ "name": "endDateTimeAfter",
+ "in": "query",
+ "description": "End date of maintenance, used to retrieve all maintenance that start after the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "example": "2024-04-01T13:00:00.000Z"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "schema": {
+ "type": "string"
+ }
+ }
+ },
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/StationMaintenanceListResource"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "schema": {
+ "type": "string"
+ }
+ }
+ },
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "429": {
+ "description": "Too many requests",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Service unavailable",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "schema": {
+ "type": "string"
+ }
+ }
+ },
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "ApiKey": []
+ },
+ {
+ "Authorization": []
+ }
+ ]
+ },
+ "parameters": [
+ {
+ "name": "X-Request-Id",
+ "in": "header",
+ "description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ]
+ },
"/brokers/{brokercode}": {
"get": {
"tags": [
@@ -18718,15 +18880,15 @@
"description": "Primitive number version",
"format": "int32"
},
+ "flag_standin": {
+ "type": "boolean",
+ "description": "Represents the authorization to use the standin mode with this station"
+ },
"is_payment_options_enabled": {
"type": "boolean"
},
"rest_endpoint": {
"type": "string"
- },
- "flag_standin": {
- "type": "boolean",
- "description": "Represents the authorization to use the standin mode with this station"
}
}
},
@@ -19513,7 +19675,8 @@
"type": "string",
"description": "Code of the broker that owns the station"
}
- }
+ },
+ "description": "List of station's maintenance"
},
"PspChannelCode": {
"required": [
diff --git a/openapi/swagger.json b/openapi/swagger.json
index a3dd410ea..c4eb19531 100644
--- a/openapi/swagger.json
+++ b/openapi/swagger.json
@@ -4,7 +4,7 @@
"description": "Spring application exposes APIs to manage configuration for CI/PSP on the Nodo dei Pagamenti",
"termsOfService": "https://www.pagopa.gov.it/",
"title": "core",
- "version": "0.59.19"
+ "version": "0.59.19-1-PPANTT-142-get-all-maintenances"
},
"host": "localhost:8080",
"basePath": "/",
@@ -501,6 +501,137 @@
"summary": "Create a broker"
}
},
+ "/brokers/station-maintenances": {
+ "parameters": [
+ {
+ "description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
+ "in": "header",
+ "name": "X-Request-Id",
+ "type": "string"
+ }
+ ],
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "description": "Start date of maintenance, used to retrieve all maintenance that start before the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "format": "date-time",
+ "in": "query",
+ "name": "startDateTimeBefore",
+ "required": false,
+ "type": "string",
+ "x-example": "2024-04-01T10:00:00.000Z"
+ },
+ {
+ "description": "Start date of maintenance, used to retrieve all maintenance that start after the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "format": "date-time",
+ "in": "query",
+ "name": "startDateTimeAfter",
+ "required": false,
+ "type": "string",
+ "x-example": "2024-04-01T10:00:00.000Z"
+ },
+ {
+ "description": "End date of maintenance, used to retrieve all maintenance that start before the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "format": "date-time",
+ "in": "query",
+ "name": "endDateTimeBefore",
+ "required": false,
+ "type": "string",
+ "x-example": "2024-04-01T13:00:00.000Z"
+ },
+ {
+ "description": "End date of maintenance, used to retrieve all maintenance that start after the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "format": "date-time",
+ "in": "query",
+ "name": "endDateTimeAfter",
+ "required": false,
+ "type": "string",
+ "x-example": "2024-04-01T13:00:00.000Z"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "type": "string"
+ }
+ },
+ "schema": {
+ "$ref": "#/definitions/StationMaintenanceListResource"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "type": "string"
+ }
+ },
+ "schema": {
+ "$ref": "#/definitions/ProblemJson"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "type": "string"
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "type": "string"
+ }
+ }
+ },
+ "429": {
+ "description": "Too many requests",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "type": "string"
+ }
+ }
+ },
+ "500": {
+ "description": "Service unavailable",
+ "headers": {
+ "X-Request-Id": {
+ "description": "This header identifies the call",
+ "type": "string"
+ }
+ },
+ "schema": {
+ "$ref": "#/definitions/ProblemJson"
+ }
+ }
+ },
+ "security": [
+ {
+ "ApiKey": []
+ },
+ {
+ "Authorization": []
+ }
+ ],
+ "tags": [
+ "Creditor Institutions"
+ ],
+ "operationId": "getAllStationsMaintenances",
+ "summary": "Get a list of all stations' maintenance filtered by dates"
+ }
+ },
"/brokers/{brokercode}": {
"parameters": [
{
@@ -867,40 +998,40 @@
"type": "string"
},
{
- "description": "Start date of maintenance, used to retrieve all maintenance that start before the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "description": "Start date of maintenance, used to retrieve all maintenance that start before the provided date (yyyy-MM-dd'T'HH:mm:ss.SSSXXX)",
"format": "date-time",
"in": "query",
"name": "startDateTimeBefore",
"required": false,
"type": "string",
- "x-example": "2024-04-01T10:00:00.000Z"
+ "x-example": "2024-04-01T10:00:00.000+02:00"
},
{
- "description": "Start date of maintenance, used to retrieve all maintenance that start after the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "description": "Start date of maintenance, used to retrieve all maintenance that start after the provided date (yyyy-MM-dd'T'HH:mm:ss.SSSXXX)",
"format": "date-time",
"in": "query",
"name": "startDateTimeAfter",
"required": false,
"type": "string",
- "x-example": "2024-04-01T10:00:00.000Z"
+ "x-example": "2024-04-01T10:00:00.000+02:00"
},
{
- "description": "End date of maintenance, used to retrieve all maintenance that start before the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "description": "End date of maintenance, used to retrieve all maintenance that start before the provided date (yyyy-MM-dd'T'HH:mm:ss.SSSXXX)",
"format": "date-time",
"in": "query",
"name": "endDateTimeBefore",
"required": false,
"type": "string",
- "x-example": "2024-04-01T13:00:00.000Z"
+ "x-example": "2024-04-01T13:00:00.000+02:00"
},
{
- "description": "End date of maintenance, used to retrieve all maintenance that start after the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')",
+ "description": "End date of maintenance, used to retrieve all maintenance that start after the provided date (yyyy-MM-dd'T'HH:mm:ss.SSSXXX)",
"format": "date-time",
"in": "query",
"name": "endDateTimeAfter",
"required": false,
"type": "string",
- "x-example": "2024-04-01T13:00:00.000Z"
+ "x-example": "2024-04-01T13:00:00.000+02:00"
},
{
"default": 50,
@@ -15259,7 +15390,7 @@
"type": "string"
},
"config_description": {
- "example": " default millisecondi validità token",
+ "example": " default millisecondi validità token",
"type": "string"
},
"config_key": {
@@ -15281,7 +15412,7 @@
"ConfigurationKeyBase": {
"properties": {
"config_description": {
- "example": " default millisecondi validità token",
+ "example": " default millisecondi validità token",
"type": "string"
},
"config_value": {
@@ -15362,7 +15493,7 @@
"properties": {
"end_date_time": {
"description": "The end date time of the station maintenance",
- "example": "2024-04-01T13:00:00Z",
+ "example": "2024-04-01T13:00:00+02:00",
"format": "date-time",
"type": "string"
},
@@ -15372,7 +15503,7 @@
},
"start_date_time": {
"description": "The start date time of the station maintenance",
- "example": "2024-04-01T10:00:00Z",
+ "example": "2024-04-01T10:00:00+02:00",
"format": "date-time",
"type": "string"
},
@@ -16741,6 +16872,9 @@
"description": "Describe the station connection's type, true synchronous, false asynchronous",
"type": "boolean"
},
+ "is_payment_options_enabled": {
+ "type": "boolean"
+ },
"password": {
"type": "string"
},
@@ -16820,6 +16954,9 @@
"redirect_query_string": {
"type": "string"
},
+ "rest_endpoint": {
+ "type": "string"
+ },
"service": {
"type": "string"
},
@@ -16916,6 +17053,7 @@
"type": "object"
},
"StationMaintenanceResource": {
+ "description": "List of station's maintenance",
"properties": {
"broker_code": {
"description": "Code of the broker that owns the station",
@@ -16923,7 +17061,7 @@
},
"end_date_time": {
"description": "The end date time of the station maintenance",
- "example": "2024-04-01T13:00:00Z",
+ "example": "2024-04-01T13:00:00+02:00",
"format": "date-time",
"type": "string"
},
@@ -16938,7 +17076,7 @@
},
"start_date_time": {
"description": "The start date time of the station maintenance",
- "example": "2024-04-01T10:00:00Z",
+ "example": "2024-04-01T10:00:00+02:00",
"format": "date-time",
"type": "string"
},
@@ -16979,7 +17117,7 @@
"properties": {
"end_date_time": {
"description": "The end date time of the station maintenance",
- "example": "2024-04-01T13:00:00Z",
+ "example": "2024-04-01T13:00:00+02:00",
"format": "date-time",
"type": "string"
},
@@ -16989,7 +17127,7 @@
},
"start_date_time": {
"description": "The start date time of the station maintenance",
- "example": "2024-04-01T10:00:00Z",
+ "example": "2024-04-01T10:00:00+02:00",
"format": "date-time",
"type": "string"
}
diff --git a/pom.xml b/pom.xml
index 8dc1fb718..f8c54b620 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
it.gov.pagopa.apiconfig
core
- 0.59.19
+ 0.59.19-1-PPANTT-142-get-all-maintenances
Spring application exposes APIs to manage configuration for CI/PSP on the Nodo dei Pagamenti
diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/controller/StationMaintenanceController.java b/src/main/java/it/gov/pagopa/apiconfig/core/controller/StationMaintenanceController.java
index 0d79b2cb2..b55015d00 100644
--- a/src/main/java/it/gov/pagopa/apiconfig/core/controller/StationMaintenanceController.java
+++ b/src/main/java/it/gov/pagopa/apiconfig/core/controller/StationMaintenanceController.java
@@ -53,6 +53,39 @@ public StationMaintenanceController(StationMaintenanceService stationMaintenance
this.stationMaintenanceService = stationMaintenanceService;
}
+ @Operation(summary = "Get a list of all stations' maintenance filtered by dates",
+ security = {@SecurityRequirement(name = "ApiKey"), @SecurityRequirement(name = "Authorization")})
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "200", description = "OK",
+ content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = StationMaintenanceListResource.class))),
+ @ApiResponse(responseCode = "400", description = "Bad Request",
+ content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ProblemJson.class))),
+ @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema())),
+ @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema())),
+ @ApiResponse(responseCode = "429", description = "Too many requests", content = @Content(schema = @Schema())),
+ @ApiResponse(responseCode = "500", description = "Service unavailable",
+ content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ProblemJson.class)))
+ })
+ @GetMapping(value = "/station-maintenances", produces = {MediaType.APPLICATION_JSON_VALUE})
+ public ResponseEntity getAllStationsMaintenances(
+ @Parameter(description = "Start date of maintenance, used to retrieve all maintenance that start before the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')", example = "2024-04-01T10:00:00.000Z")
+ @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime startDateTimeBefore,
+ @Parameter(description = "Start date of maintenance, used to retrieve all maintenance that start after the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')", example = "2024-04-01T10:00:00.000Z")
+ @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime startDateTimeAfter,
+ @Parameter(description = "End date of maintenance, used to retrieve all maintenance that start before the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')", example = "2024-04-01T13:00:00.000Z")
+ @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime endDateTimeBefore,
+ @Parameter(description = "End date of maintenance, used to retrieve all maintenance that start after the provided date (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')", example = "2024-04-01T13:00:00.000Z")
+ @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime endDateTimeAfter
+ ) {
+ return ResponseEntity.ok(
+ this.stationMaintenanceService.getAllStationsMaintenances(
+ startDateTimeBefore,
+ startDateTimeAfter,
+ endDateTimeBefore,
+ endDateTimeAfter
+ ));
+ }
+
@Operation(summary = "Get a paginated list of station's maintenance for the specified broker",
security = {@SecurityRequirement(name = "ApiKey"), @SecurityRequirement(name = "Authorization")})
@ApiResponses(value = {
diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/repository/ExtendedStationMaintenanceRepository.java b/src/main/java/it/gov/pagopa/apiconfig/core/repository/ExtendedStationMaintenanceRepository.java
index 38fa40c9c..01b0a18f0 100644
--- a/src/main/java/it/gov/pagopa/apiconfig/core/repository/ExtendedStationMaintenanceRepository.java
+++ b/src/main/java/it/gov/pagopa/apiconfig/core/repository/ExtendedStationMaintenanceRepository.java
@@ -26,4 +26,18 @@ List findOverlappingMaintenance(
@Param("startDateTime") OffsetDateTime startDateTime,
@Param("endDateTime") OffsetDateTime endDateTime
);
+
+ @Query(value =
+ "SELECT m " +
+ "FROM StationMaintenance m " +
+ "WHERE (cast(cast(:startDateTimeBefore as text) as timestamp) IS NULL OR m.startDateTime < cast(cast(:startDateTimeBefore as text) as timestamp)) " +
+ "AND (cast(cast(:startDateTimeAfter as text) as timestamp) IS NULL OR m.startDateTime > cast(cast(:startDateTimeAfter as text) as timestamp)) " +
+ "AND (cast(cast(:endDateTimeBefore as text) as timestamp) IS NULL OR m.endDateTime < cast(cast(:endDateTimeBefore as text) as timestamp)) " +
+ "AND (cast(cast(:endDateTimeAfter as text) as timestamp) IS NULL OR m.endDateTime > cast(cast(:endDateTimeAfter as text) as timestamp))")
+ List findAllStationsMaintenances(
+ @Param("startDateTimeBefore") OffsetDateTime startDateTimeBefore,
+ @Param("startDateTimeAfter") OffsetDateTime startDateTimeAfter,
+ @Param("endDateTimeBefore") OffsetDateTime endDateTimeBefore,
+ @Param("endDateTimeAfter") OffsetDateTime endDateTimeAfter
+ );
}
diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/service/StationMaintenanceService.java b/src/main/java/it/gov/pagopa/apiconfig/core/service/StationMaintenanceService.java
index 0406e8e77..8bce2500c 100644
--- a/src/main/java/it/gov/pagopa/apiconfig/core/service/StationMaintenanceService.java
+++ b/src/main/java/it/gov/pagopa/apiconfig/core/service/StationMaintenanceService.java
@@ -199,6 +199,42 @@ public StationMaintenanceListResource getStationMaintenances(
.build();
}
+ /**
+ * Retrieve a list of all stations' maintenances with the provided filters.
+ *
+ * @param startDateTimeBefore used to filter out all maintenance that have the start date time before this date time
+ * @param startDateTimeAfter used to filter out all maintenance that have the start date time after this date time
+ * @param endDateTimeBefore used to filter out all maintenance that have the end date time before this date time
+ * @param endDateTimeAfter used to filter out all maintenance that have the end date time after this date time
+ * @return the requested page of maintenances
+ */
+ public StationMaintenanceListResource getAllStationsMaintenances(
+ OffsetDateTime startDateTimeBefore,
+ OffsetDateTime startDateTimeAfter,
+ OffsetDateTime endDateTimeBefore,
+ OffsetDateTime endDateTimeAfter
+ ) {
+ List response = this.stationMaintenanceRepository.findAllStationsMaintenances(
+ startDateTimeBefore,
+ startDateTimeAfter,
+ endDateTimeBefore,
+ endDateTimeAfter
+ );
+ List maintenanceList = response.parallelStream()
+ .map(maintenance -> this.mapper.map(maintenance, StationMaintenanceResource.class))
+ .toList();
+
+ return StationMaintenanceListResource.builder()
+ .maintenanceList(maintenanceList)
+ .pageInfo(PageInfo.builder()
+ .page(0)
+ .totalItems((long) response.size())
+ .totalPages(1)
+ .itemsFound(response.size())
+ .build())
+ .build();
+ }
+
/**
* Retrieve the maintenance's hours summary of the specified broker for the provided year
*
diff --git a/src/test/java/it/gov/pagopa/apiconfig/core/controller/StationMaintenanceControllerTest.java b/src/test/java/it/gov/pagopa/apiconfig/core/controller/StationMaintenanceControllerTest.java
index 9401fd801..325a434a2 100644
--- a/src/test/java/it/gov/pagopa/apiconfig/core/controller/StationMaintenanceControllerTest.java
+++ b/src/test/java/it/gov/pagopa/apiconfig/core/controller/StationMaintenanceControllerTest.java
@@ -119,6 +119,23 @@ void getStationMaintenancesTest() throws Exception {
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
}
+ @Test
+ void getAllStationsMaintenancesTest() throws Exception {
+ when(stationMaintenanceService.getAllStationsMaintenances(any(), any(), any(), any()))
+ .thenReturn(StationMaintenanceListResource.builder()
+ .maintenanceList(Collections.singletonList(buildMaintenanceResource()))
+ .pageInfo(buildPageInfo())
+ .build());
+
+ mockMvc.perform(get("/station-maintenances")
+ .param("startDateTimeBefore", OffsetDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME))
+ .param("startDateTimeAfter", OffsetDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME))
+ .param("endDateTimeBefore", OffsetDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME))
+ .param("endDateTimeAfter", OffsetDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME))
+ ).andExpect(status().is2xxSuccessful())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON));
+ }
+
@Test
void getBrokerMaintenancesSummaryTest() throws Exception {
when(stationMaintenanceService.getBrokerMaintenancesSummary(anyString(), anyString()))
diff --git a/src/test/java/it/gov/pagopa/apiconfig/core/service/StationMaintenanceServiceTest.java b/src/test/java/it/gov/pagopa/apiconfig/core/service/StationMaintenanceServiceTest.java
index bba5f243d..70f80201c 100644
--- a/src/test/java/it/gov/pagopa/apiconfig/core/service/StationMaintenanceServiceTest.java
+++ b/src/test/java/it/gov/pagopa/apiconfig/core/service/StationMaintenanceServiceTest.java
@@ -650,6 +650,28 @@ void getStationMaintenancesSuccess() {
assertEquals(list.size(), result.getPageInfo().getItemsFound());
}
+ @Test
+ void getAllStationsMaintenancesSuccess() {
+ List list = Collections.singletonList(buildMaintenance());
+ when(stationMaintenanceRepository.findAllStationsMaintenances(
+ any(),
+ any(),
+ any(),
+ any()
+ )).thenReturn(list);
+
+ StationMaintenanceListResource result = assertDoesNotThrow(() ->
+ sut.getAllStationsMaintenances(
+ OffsetDateTime.now(),
+ OffsetDateTime.now(),
+ OffsetDateTime.now(),
+ OffsetDateTime.now()
+ ));
+
+ assertNotNull(result);
+ assertEquals(list.size(), result.getMaintenanceList().size());
+ }
+
@Test
void getBrokerMaintenancesSummarySuccessWithoutExtra() {
StationMaintenanceSummaryView summaryView = StationMaintenanceSummaryView.builder()