Skip to content

Commit

Permalink
added custom swagger schema for FilterEventDto
Browse files Browse the repository at this point in the history
  • Loading branch information
Warded120 committed Dec 6, 2024
1 parent c29d5b3 commit 921cd0e
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 921cd0e

Please sign in to comment.