-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing a new EventResponseDTO with field rearrangement #8082
Open
urio999
wants to merge
10
commits into
dev
Choose a base branch
from
feature/7939/update-eventdto
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
78c5422
init commit
urio999 bbd0f2d
Merge remote-tracking branch 'origin/dev' into feature/7939/update-ev…
urio999 927ceb3
updated EventResponseDto, added /v2/{eventId} endpoint
urio999 0ec5cc4
Merge remote-tracking branch 'origin/dev' into feature/7939/update-ev…
urio999 55399d0
Merge remote-tracking branch 'refs/remotes/origin/dev' into feature/7…
urio999 b8e88f2
added tests
urio999 41d6e40
improved test
urio999 c027f8b
Merge remote-tracking branch 'origin/dev' into feature/7939/update-ev…
urio999 1458946
updated test
urio999 88dabc5
fixed issues
urio999 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,11 @@ | |
import greencity.dto.event.AddEventDtoRequest; | ||
import greencity.dto.event.AddressDto; | ||
import greencity.dto.event.EventAuthorDto; | ||
import greencity.dto.event.EventDateInformationDto; | ||
import greencity.dto.event.EventDateLocationDto; | ||
import greencity.dto.event.EventDto; | ||
import greencity.dto.event.EventInformationDto; | ||
import greencity.dto.event.EventResponseDto; | ||
import greencity.dto.event.UpdateEventDateLocationDto; | ||
import greencity.dto.event.UpdateEventRequestDto; | ||
import greencity.dto.favoriteplace.FavoritePlaceDto; | ||
|
@@ -39,6 +42,7 @@ | |
import greencity.dto.location.LocationDto; | ||
import greencity.dto.location.MapBoundsDto; | ||
import greencity.dto.place.PlaceByBoundsDto; | ||
import greencity.dto.tag.TagDto; | ||
import greencity.dto.todolistitem.CustomToDoListItemResponseDto; | ||
import greencity.dto.todolistitem.ToDoListItemPostDto; | ||
import greencity.dto.todolistitem.ToDoListItemRequestDto; | ||
|
@@ -59,15 +63,19 @@ | |
import greencity.enums.ArticleType; | ||
import greencity.enums.CommentStatus; | ||
import greencity.enums.EventStatus; | ||
import greencity.enums.EventType; | ||
import greencity.enums.Role; | ||
import greencity.enums.ToDoListItemStatus; | ||
import greencity.enums.TagType; | ||
import greencity.enums.UserStatus; | ||
import java.security.Principal; | ||
import java.sql.Date; | ||
import java.time.Instant; | ||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
import java.time.OffsetDateTime; | ||
import java.time.ZoneId; | ||
import java.time.ZoneOffset; | ||
import java.time.ZonedDateTime; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
@@ -588,4 +596,55 @@ public static List<PlaceByBoundsDto> getPlaceByBoundsDto() { | |
.location(new LocationDto()) | ||
.build()); | ||
} | ||
} | ||
|
||
public static EventResponseDto getEventResponseDto() { | ||
return EventResponseDto.builder() | ||
.id(1L) | ||
.eventInformation(EventInformationDto.builder() | ||
.title("Test Event") | ||
.description("New Test Event") | ||
.tags(List.of(TagUaEnDto.builder() | ||
.id(2L) | ||
.nameUa("Соціальний") | ||
.nameEn("Social") | ||
.build())) | ||
.build()) | ||
.organizer(EventAuthorDto.builder().id(1L).name("Test").email("[email protected]").build()) | ||
.creationDate(LocalDate.of(2025, 1, 10)) | ||
.isOpen(true) | ||
.dates(List.of( | ||
EventDateInformationDto.builder() | ||
.startDate(ZonedDateTime.of(2025, 12, 26, 12, 30, 0, 0, ZoneOffset.UTC)) | ||
.finishDate(ZonedDateTime.of(2025, 12, 26, 21, 59, 0, 0, ZoneOffset.UTC)) | ||
.onlineLink("www.testlink.com") | ||
.coordinates(AddressDto.builder() | ||
.latitude(50.44628775288652) | ||
.longitude(30.49364829378446) | ||
.streetEn("Halytska Square") | ||
.streetUa("Галицька площа") | ||
.houseNumber("1") | ||
.cityEn("Kyiv") | ||
.cityUa("Київ") | ||
.regionEn("Kyiv") | ||
.regionUa("місто Київ") | ||
.countryEn("Ukraine") | ||
.countryUa("Україна") | ||
.formattedAddressEn("Halytska Sq, 1, Kyiv, Ukraine, 02000") | ||
.formattedAddressUa("Галицька пл., 1, Київ, Україна, 02000") | ||
.build()) | ||
.build())) | ||
.titleImage("https://test.png") | ||
.additionalImages(List.of("https://test1.png", "https://test2.png")) | ||
.type(EventType.OFFLINE) | ||
.isRelevant(true) | ||
.likes(3) | ||
.dislikes(1) | ||
.countComments(1) | ||
.eventRate(20.0) | ||
.currentUserGrade(50) | ||
.isSubscribed(false) | ||
.isFavorite(false) | ||
.isOrganizedByFriend(false) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
service-api/src/main/java/greencity/dto/event/EventDateInformationDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package greencity.dto.event; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@SuperBuilder | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
@EqualsAndHashCode(callSuper = true) | ||
public class EventDateInformationDto extends AbstractEventDateLocationDto { | ||
private Long id; | ||
private EventResponseDto event; | ||
private AddressDto coordinates; | ||
} |
20 changes: 20 additions & 0 deletions
20
service-api/src/main/java/greencity/dto/event/EventInformationDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package greencity.dto.event; | ||
|
||
import greencity.dto.tag.TagUaEnDto; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import java.util.List; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Data | ||
public class EventInformationDto { | ||
private String title; | ||
private String description; | ||
@NotEmpty | ||
private List<TagUaEnDto> tags; | ||
} | ||
57 changes: 57 additions & 0 deletions
57
service-api/src/main/java/greencity/dto/event/EventResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package greencity.dto.event; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import greencity.enums.EventType; | ||
import jakarta.validation.constraints.Max; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import org.springframework.lang.Nullable; | ||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
public class EventResponseDto { | ||
private Long id; | ||
|
||
private EventInformationDto eventInformation; | ||
|
||
private EventAuthorDto organizer; | ||
|
||
private LocalDate creationDate; | ||
|
||
private Boolean isOpen; | ||
|
||
@Max(7) | ||
private List<EventDateInformationDto> dates; | ||
|
||
@Nullable | ||
private String titleImage; | ||
|
||
@Nullable | ||
@Max(4) | ||
private List<String> additionalImages; | ||
|
||
private EventType type; | ||
|
||
@JsonProperty("isSubscribed") | ||
private boolean isSubscribed; | ||
|
||
@JsonProperty("isFavorite") | ||
private boolean isFavorite; | ||
|
||
private Boolean isRelevant; | ||
|
||
private Integer likes; | ||
|
||
private Integer dislikes; | ||
|
||
private Integer countComments; | ||
|
||
@JsonProperty("isOrganizedByFriend") | ||
private boolean isOrganizedByFriend; | ||
|
||
private Double eventRate; | ||
|
||
private Integer currentUserGrade; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add validation constraints to prevent potential security issues.
The
title
anddescription
fields should have appropriate validation constraints to prevent security issues and ensure data quality:This ensures:
📝 Committable suggestion