Skip to content
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

Api: ✏️ Append LastMessage Field in ChatRoomDetail Response #196

Merged
merged 6 commits into from
Nov 14, 2024

Conversation

psychology50
Copy link
Member

작업 이유

image

  • When client requests ChatRoomDetail, the server must include the lastMessage field.
  • However, this data doesn't need to be highly reliable compared to unreadMessageCount. Since any user in the chatroom can send message simultaneously, even if the server retrieves an earlier message, the client will replace the lastMessage component with the latest message from the the socket server.

작업 사항

{
  "chatRooms": [
    {
      "id": 0,
      "title": "string",
      "description": "string",
      "backgroundImageUrl": "string",
      "isPrivate": true,
      "isAdmin": true,
      "participantCount": 0,
      "createdAt": "2024-11-11T05:29:12.715Z",
      "lastMessage": { // Append this field 
        "chatRoomId": 0,
        "chatId": 0,
        "content": "string",
        "contentType": "TEXT",
        "categoryType": "NORMAL",
        "createdAt": "2024-11-11T05:29:12.715Z",
        "senderId": 0
      },
      "unreadMessageCount": 0
    }
  ]
}
  • if the server can't find the lastMessage, this field will be null
    • I want to replace {}, but this work is so hard...
  • APIs that share this response DTO will also be updated accordingly, but the rule is straightforward.
    • Search Chatroom: The lastMessage field isn't required and is always null
    • Join Chatroom: When the client joins a chatroom, it will enter the chatroom, so this field isn't necessary.

리뷰어가 중점적으로 확인해야 하는 부분

  • I’m not entirely sure why my tests are passing 😂. Plz check this.

발견한 이슈

  • none

@psychology50 psychology50 added the fix 기능 수정 label Nov 11, 2024
@psychology50 psychology50 self-assigned this Nov 11, 2024
@psychology50 psychology50 merged commit 96ef7bb into dev Nov 14, 2024
1 check passed
@psychology50 psychology50 deleted the fix/PW-609-add-last-message-in-chatroom-res branch November 14, 2024 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 기능 수정
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant