Skip to content

Commit

Permalink
Merge pull request #7881 from ita-social-projects/7422-apiswagger-ui-…
Browse files Browse the repository at this point in the history
…wrong-link-used-in-get-request-events

added custom swagger schema for FilterEventDto
  • Loading branch information
Warded120 authored Dec 6, 2024
2 parents 11b61ca + 9e169fd commit a81cc19
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/java/greencity/controller/EventController.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ public ResponseEntity<EventDto> getEvent(
public ResponseEntity<PageableAdvancedDto<EventDto>> getEvents(
@Parameter(hidden = true) Pageable pageable,
@RequestParam(required = false, name = "user-id") Long userId,
FilterEventDto filterEventDto) {
@Schema(
description = "Filters for events",
name = "FilterEventDto",
type = "object",
example = FilterEventDto.defaultJson) FilterEventDto filterEventDto) {
if (filterEventDto != null && filterEventDto.getStatuses() != null) {
validateStatusesRequireUserId(filterEventDto.getStatuses(), userId);
}
Expand Down
13 changes: 13 additions & 0 deletions service-api/src/main/java/greencity/dto/filter/FilterEventDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,17 @@ public class FilterEventDto {
private EventType type;
private ZonedDateTime from;
private ZonedDateTime to;

public static final String defaultJson = """
{
"time": null,
"cities": [],
"statuses": [],
"tags": [],
"title": null,
"type": null,
"from": null,
"to": null
}
""";
}

0 comments on commit a81cc19

Please sign in to comment.