Skip to content

Commit

Permalink
added dead-letter exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
marcussss1 committed Jun 1, 2023
1 parent db19c50 commit febe05a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
4 changes: 0 additions & 4 deletions internal/microservices/chat/delivery/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ func (u chatHandler) GetCurrentUserChatsHandler(ctx echo.Context) error {
return err
}

for idx, listUserChat := range listUserChats {
listUserChats[idx] = httpUtils.SanitizeStruct(listUserChat).(model.ChatInListUser)
}

return ctx.JSON(http.StatusOK, model.Chats{Chats: listUserChats})
}

Expand Down
11 changes: 5 additions & 6 deletions internal/microservices/chat/usecase/usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package usecase

import (
"context"
log "github.com/sirupsen/logrus"
"project/internal/config"
"project/internal/microservices/chat"
"project/internal/microservices/messages"
Expand Down Expand Up @@ -257,7 +256,7 @@ func (u usecase) DeleteChatById(ctx context.Context, chatID uint64) error {
func (u usecase) GetListUserChats(ctx context.Context, userID uint64) ([]model.ChatInListUser, error) {
var chatsInListUser []model.ChatInListUser
userChats, err := u.chatRepo.GetChatsByUserId(ctx, userID)
log.Info(1)

if err != nil {
return nil, err
}
Expand All @@ -267,7 +266,7 @@ func (u usecase) GetListUserChats(ctx context.Context, userID uint64) ([]model.C
if err != nil {
return nil, err
}
log.Info(2)

chatMembers, err := u.chatRepo.GetChatMembersByChatId(ctx, chat.Id)
if err != nil {
return nil, err
Expand All @@ -282,20 +281,20 @@ func (u usecase) GetListUserChats(ctx context.Context, userID uint64) ([]model.C

members = append(members, model_conversion.FromAuthorizedUserToUser(user))
}
log.Info(3)

lastMessage, err := u.messagesRepo.GetLastChatMessage(ctx, chat.Id)
if err != nil {
return nil, err
}
log.Info(4)

var lastMessageAuthor model.AuthorizedUser
if lastMessage.AuthorId != 0 {
lastMessageAuthor, err = u.userRepo.GetUserById(ctx, lastMessage.AuthorId)
if err != nil {
return nil, err
}
}
log.Info(5)

chatsInListUser = append(chatsInListUser, model.ChatInListUser{
Id: chat.Id,
Type: chat.Type,
Expand Down

0 comments on commit febe05a

Please sign in to comment.