From 6bc466164a647374d4d3353140d4888771a76c44 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 4 Aug 2024 20:49:09 +0900 Subject: [PATCH 1/6] =?UTF-8?q?refactor:=20Notification(Get)=20=EC=8A=A4?= =?UTF-8?q?=ED=8E=99=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/wespot/notification/dto/NotificationResponse.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/kotlin/com/wespot/notification/dto/NotificationResponse.kt b/core/src/main/kotlin/com/wespot/notification/dto/NotificationResponse.kt index a9778e25..7f7a8e36 100644 --- a/core/src/main/kotlin/com/wespot/notification/dto/NotificationResponse.kt +++ b/core/src/main/kotlin/com/wespot/notification/dto/NotificationResponse.kt @@ -5,6 +5,7 @@ import com.wespot.notification.Notification data class NotificationResponse( val id: Long, val type: String, + val date: String, val targetId: Long, val content: String, val isNew: Boolean, @@ -18,6 +19,7 @@ data class NotificationResponse( return NotificationResponse( id = notification.id, type = notification.type.name, + date = notification.date.toString(), targetId = notification.targetId, content = notification.title, isNew = !notification.isRead, From 18a2f76c36117adffb0cece98d8181f9372a70ee Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 4 Aug 2024 20:50:41 +0900 Subject: [PATCH 2/6] =?UTF-8?q?refactor:=20=EB=9E=9C=EB=8D=A4=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9C=A0=EC=A0=80=EB=A5=BC=20=EB=B0=98=ED=99=98?= =?UTF-8?q?=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/src/main/kotlin/com/wespot/vote/Vote.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/src/main/kotlin/com/wespot/vote/Vote.kt b/domain/src/main/kotlin/com/wespot/vote/Vote.kt index 81bed7ae..724ec676 100644 --- a/domain/src/main/kotlin/com/wespot/vote/Vote.kt +++ b/domain/src/main/kotlin/com/wespot/vote/Vote.kt @@ -80,13 +80,13 @@ data class Vote( fun findUsersForVote(classmates: List, user: User): List { - validateClassmate(user) classmates.forEach { validateClassmate(it) } val alreadyVotedByUser: List = ballots.findUserIdsVotedByUser(user.id) return classmates.stream() .filter { !alreadyVotedByUser.contains(it.id) && isNotMe(it, user) } .toList() + .shuffled() .take(NUMBER_OF_VOTE_USERS) } From 8b3e4324537483baffa484ebad3620964163694e Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 4 Aug 2024 21:06:13 +0900 Subject: [PATCH 3/6] =?UTF-8?q?refactor:=20=ED=84=B0=EC=A7=80=EB=8A=94=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/wespot/vote/domain/VoteTest.kt | 19 ++++++++++--------- .../src/main/kotlin/com/wespot/vote/Vote.kt | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/src/test/kotlin/com/wespot/vote/domain/VoteTest.kt b/app/src/test/kotlin/com/wespot/vote/domain/VoteTest.kt index a0ac7bff..b8a4c5a9 100644 --- a/app/src/test/kotlin/com/wespot/vote/domain/VoteTest.kt +++ b/app/src/test/kotlin/com/wespot/vote/domain/VoteTest.kt @@ -14,6 +14,7 @@ import io.kotest.assertions.throwables.shouldNotThrow import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec import io.kotest.matchers.shouldBe +import io.kotest.matchers.shouldNotBe import io.kotest.matchers.throwable.shouldHaveMessage import java.time.LocalDate import java.time.LocalDateTime @@ -139,7 +140,8 @@ class VoteTest() : BehaviorSpec({ given("현재 사용자가 아직 투표하지 인원 중에") { val ballots = listOf( - BallotFixture.createByVoteAndVoteOptionAndSenderAndReceiver(1L, 1L, 1L, 2L) + BallotFixture.createByVoteAndVoteOptionAndSenderAndReceiver(1L, 1L, 1L, 2L), + BallotFixture.createByVoteAndVoteOptionAndSenderAndReceiver(1L, 1L, 2L, 3L) ) `when`("5명 이하의 학생들을") { val users = createUserByCount(5) @@ -148,9 +150,9 @@ class VoteTest() : BehaviorSpec({ val voteUsers = vote.findUsersForVote(users, me) then("정상적으로 반환한다.") { voteUsers.size shouldBe 3 - voteUsers[0].id shouldBe 3 - voteUsers[1].id shouldBe 4 - voteUsers[2].id shouldBe 5 + voteUsers.find { it.id == 3L } shouldNotBe null + voteUsers.find { it.id == 4L } shouldNotBe null + voteUsers.find { it.id == 5L } shouldNotBe null } } @@ -159,13 +161,12 @@ class VoteTest() : BehaviorSpec({ val vote = VoteFixture.createWithVoteNumberAndBallots(0, ballots) val me = users[0] val voteUsers = vote.findUsersForVote(users, me) + val userCounts= voteUsers.map { it.id }.toSet() + val doesNotContainsMe = voteUsers.stream().allMatch { it.id != users[0].id } then("정상적으로 반환한다.") { voteUsers.size shouldBe 5 - voteUsers[0].id shouldBe 3 - voteUsers[1].id shouldBe 4 - voteUsers[2].id shouldBe 5 - voteUsers[3].id shouldBe 6 - voteUsers[4].id shouldBe 7 + userCounts.size shouldBe 5 + doesNotContainsMe shouldBe true } } diff --git a/domain/src/main/kotlin/com/wespot/vote/Vote.kt b/domain/src/main/kotlin/com/wespot/vote/Vote.kt index 724ec676..e1cf98e8 100644 --- a/domain/src/main/kotlin/com/wespot/vote/Vote.kt +++ b/domain/src/main/kotlin/com/wespot/vote/Vote.kt @@ -80,6 +80,7 @@ data class Vote( fun findUsersForVote(classmates: List, user: User): List { + validateClassmate(user) classmates.forEach { validateClassmate(it) } val alreadyVotedByUser: List = ballots.findUserIdsVotedByUser(user.id) From 6dfc293fd3665e315f03e5afd48eba645936b63a Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 4 Aug 2024 21:11:43 +0900 Subject: [PATCH 4/6] =?UTF-8?q?refactor:=20CustomUrlFilter=EC=97=90=20url?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wespot/config/security/CustomUrlFilter.kt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/wespot/config/security/CustomUrlFilter.kt b/app/src/main/kotlin/com/wespot/config/security/CustomUrlFilter.kt index 7d820eef..28ae52f1 100644 --- a/app/src/main/kotlin/com/wespot/config/security/CustomUrlFilter.kt +++ b/app/src/main/kotlin/com/wespot/config/security/CustomUrlFilter.kt @@ -31,19 +31,14 @@ class CustomUrlFilter( "/api/v1/users/backgrounds", "/api/v1/users/characters", "/api/v1/users/search", - "/api/v1/votes/options", - "/api/v1/votes", - "/api/v1/votes/tops", - "/api/v1/votes/sent", - "/api/v1/votes/received", - "/api/v1/votes/sent/options", - "/api/v1/votes/received/options", - "/api/v1/reports/users", "/api/v1/messages", "/api/v1/messages/send", "/api/v1/messages/status/me", "/api/v1/messages/check-profanity", "/api/v1/messages/**", + "/api/v1/votes/**", + "/api/v1/reports/**", + "/api/v1/notifications/**", ) override fun doFilterInternal( From b2c5f5959966f6517feb9b7ebdac3bbeb2cd3c1a Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 4 Aug 2024 21:56:13 +0900 Subject: [PATCH 5/6] =?UTF-8?q?refactor:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20userId=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/kotlin/com/wespot/vote/VoteController.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/kotlin/com/wespot/vote/VoteController.kt b/app/src/main/kotlin/com/wespot/vote/VoteController.kt index 03fbf68e..39b3088e 100644 --- a/app/src/main/kotlin/com/wespot/vote/VoteController.kt +++ b/app/src/main/kotlin/com/wespot/vote/VoteController.kt @@ -75,7 +75,6 @@ class VoteController( @GetMapping("/received/options/{optionId}") fun getReceivedVote( - userId: Long, @PathVariable optionId: Long, @RequestParam date: LocalDate ): ResponseEntity { From 03f1d1f23f5dc8964886a88263afa0405d001086 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Mon, 5 Aug 2024 09:08:13 +0900 Subject: [PATCH 6/6] =?UTF-8?q?chore:=20redis=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/resources/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/resources/config b/app/src/main/resources/config index 72a45c17..f4019da1 160000 --- a/app/src/main/resources/config +++ b/app/src/main/resources/config @@ -1 +1 @@ -Subproject commit 72a45c17b7a901159e2fb3bb1de2f8d0e5b9fc05 +Subproject commit f4019da1cf0cd56cf042ded24237d34a6cdaae81