Skip to content

#172 - 변경된 쪽지 스펙에 맞게 수정 #173

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 🖤 사랑의 Server Repo 🖤
## Wespot Backend

[](https://github.com/YAPP-Github/24th-App-Team-1-Android/blob/main/README.md#-kpi%EB%A1%9C-%EA%B5%AD%EC%A0%95%EA%B0%90%EC%82%AC-%EA%B0%80%EB%8A%94-%EA%B7%B8%EB%82%A0%EA%B9%8C%EC%A7%80-%EB%82%98%EC%9D%B8%EC%9B%90-bff-android-)
[![](https://private-user-images.githubusercontent.com/77484719/335186351-cfa35f86-a573-4b75-b1db-5ec513035693.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTc4NDIyMTEsIm5iZiI6MTcxNzg0MTkxMSwicGF0aCI6Ii83NzQ4NDcxOS8zMzUxODYzNTEtY2ZhMzVmODYtYTU3My00Yjc1LWIxZGItNWVjNTEzMDM1NjkzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjA4VDEwMTgzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI3OWZiMDViY2MxNTEyNTk4ZWMxODI1ZGVlYTAwMTA5ZDZmOTg0MDcyNmRmNDk4MjljYTQyYWM4OTg4Zjk0OTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.uhNclo97cwju2GMlJHwGuPl8qMnH54XFuMN7x84Wtsc)](https://private-user-images.githubusercontent.com/77484719/335186351-cfa35f86-a573-4b75-b1db-5ec513035693.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTc4NDIyMTEsIm5iZiI6MTcxNzg0MTkxMSwicGF0aCI6Ii83NzQ4NDcxOS8zMzUxODYzNTEtY2ZhMzVmODYtYTU3My00Yjc1LWIxZGItNWVjNTEzMDM1NjkzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjA4VDEwMTgzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI3OWZiMDViY2MxNTEyNTk4ZWMxODI1ZGVlYTAwMTA5ZDZmOTg0MDcyNmRmNDk4MjljYTQyYWM4OTg4Zjk0OTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.uhNclo97cwju2GMlJHwGuPl8qMnH54XFuMN7x84Wtsc)
Expand All @@ -8,10 +8,8 @@
<table>
<tr>
<td align="center"><a href="https://github.com/kpeel5839"><img src="https://avatars.githubusercontent.com/u/89840550?v=4" width="128px;" alt=""/><br /><sub><b>JaeYeon Kim</sub></a><br /><a href="https://github.com/YAPP-Github/24th-App-Team-1-BE/commits/main?author=kpeel5839" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/sectionr0"><img src="https://avatars.githubusercontent.com/u/55054505?v=4" width="128px;" alt=""/><br /><sub><b>Gicheon Joe</b></sub></a><br /><a href="https://github.com/YAPP-Github/24th-App-Team-1-BE/commits/main?author=sectionr0" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><code>🏋️매튜🏋️ </td>
<td align="center"><code>🥭망고🥭</td>
</tr>
</table>
2 changes: 1 addition & 1 deletion app/src/main/resources/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,75 @@ import java.time.LocalDateTime

data class MessageV2OverviewResponse( // TODO : 문서 변경
val id: Long,

val senderProfile: MessageProfileResponse,

val isMeMessageRoomOwner: Boolean,
val thumbnail: String,
val isExistsUnreadMessage: Boolean,
val latestChatTime: LocalDateTime,
val isAnonymous: Boolean,
val name: String,
val schoolName: String?,
val grade: Int?,
val classNumber: Int?,

val receiverProfile: MessageProfileResponse,

val isBookmarked: Boolean,
val isBlocked: Boolean,
val isEver: Boolean
) {

data class MessageProfileResponse(
val iconUrl: String,
val name: String,
val schoolName: String?,
val grade: Int?,
val classNumber: Int?
) {

companion object {
fun of(
iconUrl: String,
name: String,
schoolName: String?,
grade: Int?,
classNumber: Int?
): MessageProfileResponse {
return MessageProfileResponse(
iconUrl = iconUrl,
name = name,
schoolName = schoolName,
grade = grade,
classNumber = classNumber
)
}
}

}

companion object {

fun from(room: MessageRoom): MessageV2OverviewResponse {
return MessageV2OverviewResponse(
id = room.id(),

senderProfile = MessageProfileResponse.of(
iconUrl = room.senderProfileImage(),
name = room.senderName(),
schoolName = room.senderSchoolName(),
grade = room.senderGrade(),
classNumber = room.senderClassNumber()
),

isMeMessageRoomOwner = room.isViewerOwnerOfMessageRoom(),
thumbnail = room.receiverProfileImage(),
isExistsUnreadMessage = room.isExistsUnReadMessage(),
latestChatTime = room.latestChatTime(),
isAnonymous = room.isReceiverUsingAnonymous(),
name = room.receiverName(),
schoolName = room.receiverSchoolName(),
grade = room.receiverGrade(),
classNumber = room.receiverClassNumber(),
receiverProfile = MessageProfileResponse.of(
iconUrl = room.receiverProfileImage(),
name = room.receiverName(),
schoolName = room.receiverSchoolName(),
grade = room.receiverGrade(),
classNumber = room.receiverClassNumber()
),

isBookmarked = room.isBookmarked(),
isBlocked = room.isBlocked(),
isEver = room.isReceiverEver()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.wespot.notification.service

import com.wespot.notification.LatestVersionType
import com.wespot.notification.NotificationType
import com.wespot.notification.PublishNotificationType
import com.wespot.notification.dto.NotificationPublishingRequest
import com.wespot.notification.dto.PublishNotificationTypeResponse
import com.wespot.notification.event.EventPublishNotificationService
import com.wespot.notification.port.`in`.PublishNotificationUseCase
import com.wespot.notification.port.out.LatestVersionPort
import com.wespot.notification.port.out.NotificationPort
import com.wespot.notification.event.EventPublishNotificationService
import com.wespot.user.port.out.UserPort
import com.wespot.user.port.out.UserVersionPort
import org.springframework.stereotype.Component
Expand Down Expand Up @@ -48,7 +47,7 @@ class EventNotificationService(
body = notificationPublishingRequest.body
)

notificationPort.saveAll(notifications)
notificationPort.saveAll(notifications)
notificationHelper.sendNotifications(users, notifications)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ enum class NotificationTypeToUpdateFeatureContent(
),
listOf(
ImageComponent.of(
"https://dw2d2daekmyur.cloudfront.net/%E1%84%89%E1%85%A5%E1%84%87%E1%85%A5%E1%84%83%E1%85%B3%E1%84%85%E1%85%B5%E1%84%87%E1%85%B3%E1%86%AB_%E1%84%8B%E1%85%A5%E1%86%B8%E1%84%83%E1%85%A6%E1%84%8B%E1%85%B5%E1%84%90%E1%85%B3_%E1%84%8B%E1%85%B5%E1%84%86%E1%85%B5%E1%84%8C%E1%85%B5.png",
"https://dw2d2daekmyur.cloudfront.net/%E1%84%91%E1%85%B3%E1%84%85%E1%85%A9%E1%84%91%E1%85%B5%E1%86%AF_%E1%84%8B%E1%85%A5%E1%86%B8%E1%84%83%E1%85%A6%E1%84%8B%E1%85%B5%E1%84%90%E1%85%B3_%E1%84%89%E1%85%A5%E1%84%87%E1%85%A5%E1%84%83%E1%85%B3%E1%84%85%E1%85%B5%E1%84%87%E1%85%B3%E1%86%AB_UPPER.png",
220,
268,
Paddings.of(null, null, 32, null)
),
ImageComponent.of(
"https://dw2d2daekmyur.cloudfront.net/%E1%84%89%E1%85%A5%E1%84%87%E1%85%A5%E1%84%83%E1%85%B3%E1%84%85%E1%85%B5%E1%84%87%E1%85%B3%E1%86%AB_%E1%84%8B%E1%85%A5%E1%86%B8%E1%84%83%E1%85%A6%E1%84%8B%E1%85%B5%E1%84%90%E1%85%B3_%E1%84%8B%E1%85%B5%E1%84%86%E1%85%B5%E1%84%8C%E1%85%B5.png",
"https://dw2d2daekmyur.cloudfront.net/%E1%84%91%E1%85%B3%E1%84%85%E1%85%A9%E1%84%91%E1%85%B5%E1%86%AF_%E1%84%8B%E1%85%A5%E1%86%B8%E1%84%83%E1%85%A6%E1%84%8B%E1%85%B5%E1%84%90%E1%85%B3_%E1%84%89%E1%85%A5%E1%84%87%E1%85%A5%E1%84%83%E1%85%B3%E1%84%85%E1%85%B5%E1%84%87%E1%85%B3%E1%86%AB_LOWER.png",
220,
324,
Paddings.of(null, null, 118, null)
Expand All @@ -73,8 +73,8 @@ enum class NotificationTypeToUpdateFeatureContent(
"#FF48494C",
),
ButtonComponent.ofWithDeepLink(
RichText.of("다음에 하기", "#FFF7F7F8", 16, "Center", "SemiBold"),
"#FF5A5C63",
RichText.of("프로필 설정하기", "#FFF7F7F8", 16, "Center", "SemiBold"),
"#F6FE8B",
"#FF48494C",
DeepLink.PROFILE_IMAGE_UPDATE_URL
)
Expand Down
25 changes: 21 additions & 4 deletions domain/src/main/kotlin/com/wespot/message/v2/MessageRoom.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@ data class MessageRoom(
}

fun isSameUserProfileAndNotAnonymous(viewer: User): Boolean {
if (roomMessage.isSameUserProfileAndNotAnonymous(viewer = viewer)) {
return true
}
return false
return roomMessage.isSameUserProfileAndNotAnonymous(viewer = viewer)
}

fun isSameAnonymousProfile(anonymousProfileId: Long): Boolean {
Expand Down Expand Up @@ -181,4 +178,24 @@ data class MessageRoom(
return messages.readUnreadMessage(viewer = viewer)
}

fun senderProfileImage(): String {
return roomMessage.myProfileImage(viewer = viewer)
}

fun senderName(): String {
return roomMessage.myName(viewer = viewer)
}

fun senderSchoolName(): String? {
return roomMessage.mySchoolName(viewer = viewer)
}

fun senderGrade(): Int? {
return roomMessage.myGrade(viewer = viewer)
}

fun senderClassNumber(): Int? {
return roomMessage.myClassNumber(viewer = viewer)
}

}
70 changes: 70 additions & 0 deletions domain/src/main/kotlin/com/wespot/message/v2/MessageV2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,76 @@ data class MessageV2(
return date == createdAt.toLocalDate()
}

fun myProfileImage(viewer: User): String {
validateRoomMessage()

if (viewer.isMeReceiver(receiverId = receiver.id)) {
return receiver.profile.iconUrl
}

if (isMeAnonymous(viewer)) {
return anonymousProfile!!.imageUrl
}

return sender.profile.iconUrl
}

fun myName(viewer: User): String {
validateRoomMessage()

if (viewer.isMeReceiver(receiverId = receiver.id)) {
return receiver.name
}

if (isMeAnonymous(viewer)) {
return anonymousProfile!!.name
}

return sender.name
}

fun mySchoolName(viewer: User): String? {
validateRoomMessage()

if (viewer.isMeReceiver(receiverId = receiver.id)) {
return receiver.school.name
}

if (isMeAnonymous(viewer)) {
return null
}

return sender.school.name
}

fun myGrade(viewer: User): Int? {
validateRoomMessage()

if (viewer.isMeReceiver(receiverId = receiver.id)) {
return receiver.grade
}

if (isMeAnonymous(viewer)) {
return null
}

return sender.grade
}

fun myClassNumber(viewer: User): Int? {
validateRoomMessage()

if (viewer.isMeReceiver(receiverId = receiver.id)) {
return receiver.classNumber
}

if (isMeAnonymous(viewer)) {
return null
}

return sender.classNumber
Comment on lines +444 to +509
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] These my* methods share the same pattern of branching on receiver, anonymous, or sender; consider extracting a generic helper or using a common accessor to reduce duplication and ease future changes.

Suggested change
if (viewer.isMeReceiver(receiverId = receiver.id)) {
return receiver.profile.iconUrl
}
if (isMeAnonymous(viewer)) {
return anonymousProfile!!.imageUrl
}
return sender.profile.iconUrl
}
fun myName(viewer: User): String {
validateRoomMessage()
if (viewer.isMeReceiver(receiverId = receiver.id)) {
return receiver.name
}
if (isMeAnonymous(viewer)) {
return anonymousProfile!!.name
}
return sender.name
}
fun mySchoolName(viewer: User): String? {
validateRoomMessage()
if (viewer.isMeReceiver(receiverId = receiver.id)) {
return receiver.school.name
}
if (isMeAnonymous(viewer)) {
return null
}
return sender.school.name
}
fun myGrade(viewer: User): Int? {
validateRoomMessage()
if (viewer.isMeReceiver(receiverId = receiver.id)) {
return receiver.grade
}
if (isMeAnonymous(viewer)) {
return null
}
return sender.grade
}
fun myClassNumber(viewer: User): Int? {
validateRoomMessage()
if (viewer.isMeReceiver(receiverId = receiver.id)) {
return receiver.classNumber
}
if (isMeAnonymous(viewer)) {
return null
}
return sender.classNumber
return resolveViewerAttribute(
viewer = viewer,
receiverAttribute = { receiver.profile.iconUrl },
anonymousAttribute = { anonymousProfile!!.imageUrl },
senderAttribute = { sender.profile.iconUrl }
)
}
fun myName(viewer: User): String {
validateRoomMessage()
return resolveViewerAttribute(
viewer = viewer,
receiverAttribute = { receiver.name },
anonymousAttribute = { anonymousProfile!!.name },
senderAttribute = { sender.name }
)
}
fun mySchoolName(viewer: User): String? {
validateRoomMessage()
return resolveViewerAttribute(
viewer = viewer,
receiverAttribute = { receiver.school.name },
anonymousAttribute = { null },
senderAttribute = { sender.school.name }
)
}
fun myGrade(viewer: User): Int? {
validateRoomMessage()
return resolveViewerAttribute(
viewer = viewer,
receiverAttribute = { receiver.grade },
anonymousAttribute = { null },
senderAttribute = { sender.grade }
)
}
fun myClassNumber(viewer: User): Int? {
validateRoomMessage()
return resolveViewerAttribute(
viewer = viewer,
receiverAttribute = { receiver.classNumber },
anonymousAttribute = { null },
senderAttribute = { sender.classNumber }
)

Copilot uses AI. Check for mistakes.

}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is MessageV2) return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data class StringColor(
}

private fun validate(color: String) {
if (color.length != 9 || color[0] != '#') {
if ((color.length != 9 && color.length != 7) || color[0] != '#') {
throw CustomException(HttpStatus.BAD_REQUEST, ExceptionView.TOAST, "color length must be 9")
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception message "color length must be 9" is now inaccurate since 7-character hex codes are allowed; update it to reflect both supported lengths (e.g., "color length must be 7 or 9").

Suggested change
throw CustomException(HttpStatus.BAD_REQUEST, ExceptionView.TOAST, "color length must be 9")
throw CustomException(HttpStatus.BAD_REQUEST, ExceptionView.TOAST, "color length must be 7 or 9")

Copilot uses AI. Check for mistakes.

}

Expand Down
Loading