-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
330 additions
and
42 deletions.
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
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
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package greencity.utils; | ||
|
||
import greencity.entity.event.EventDateLocation; | ||
import greencity.entity.event.EventGrade; | ||
import java.time.ZonedDateTime; | ||
import java.util.List; | ||
|
||
public class EventUtils { | ||
public static boolean isRelevant(List<EventDateLocation> dates) { | ||
if (dates == null || dates.isEmpty()) { | ||
return false; | ||
} | ||
return dates.getLast().getFinishDate().isAfter(ZonedDateTime.now()) | ||
|| dates.getLast().getFinishDate().isEqual(ZonedDateTime.now()); | ||
} | ||
|
||
public static double calculateEventRate(List<EventGrade> eventGrades) { | ||
return eventGrades.stream() | ||
.mapToInt(EventGrade::getGrade) | ||
.average() | ||
.orElse(0.0); | ||
} | ||
} |
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.