Skip to content

Commit

Permalink
Merge pull request #124 from Kos-Kita/addfotochat
Browse files Browse the repository at this point in the history
add foto sender id chat
  • Loading branch information
lendral3n authored Feb 15, 2024
2 parents 221dad7 + 81c0f74 commit 125727a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
6 changes: 5 additions & 1 deletion features/chat/data/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ func (m Chat) ModelToCoreRoom(userIdLogin uint) chat.Core {

return chat.Core{
RoomID: m.RoomID,
User: user.Core{UserName: name},
SenderID: m.SenderID,
User: user.Core{
UserName: name,
PhotoProfile: m.UserReceiver.PhotoProfile,
},
}
}
18 changes: 12 additions & 6 deletions features/chat/handler/response.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package handler

import ("KosKita/features/user/handler"
"KosKita/features/chat")
import (
"KosKita/features/chat"
"KosKita/features/user/handler"
)

type RoomRes struct {
ID string `json:"room_id"`
}

type GetRoomRespon struct {
ID string `json:"room_id"`
Name string `json:"name"`
ID string `json:"room_id"`
SenderID uint `json:"sender_id"`
Name string `json:"name"`
PhotoProfile string `json:"photo_profile"`
}

type ChatRes struct {
Expand Down Expand Up @@ -44,7 +48,9 @@ func CoreToGetChats(chats []chat.Core) []ChatRes {
func CoreToGetUser(room chat.Core) GetRoomRespon {
user := handler.CoreToResponse(&room.User)
return GetRoomRespon{
ID: room.RoomID,
Name: user.UserName,
ID: room.RoomID,
SenderID: room.SenderID,
Name: user.UserName,
PhotoProfile: user.PhotoProfile,
}
}

0 comments on commit 125727a

Please sign in to comment.