diff --git a/pkg/services/accounts.go b/pkg/services/accounts.go index 048254d..2db5c87 100644 --- a/pkg/services/accounts.go +++ b/pkg/services/accounts.go @@ -2,6 +2,7 @@ package services import ( "context" + "git.solsynth.dev/hydrogen/messaging/pkg/database" "time" "git.solsynth.dev/hydrogen/identity/pkg/grpc/proto" @@ -11,12 +12,21 @@ import ( ) func GetAccountFriend(userId, relatedId uint, status int) (*proto.FriendshipResponse, error) { + var user models.Account + if err := database.C.Where("id = ?", userId).First(&user).Error; err != nil { + return nil, err + } + var related models.Account + if err := database.C.Where("id = ?", relatedId).First(&related).Error; err != nil { + return nil, err + } + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) defer cancel() return grpc.Friendships.GetFriendship(ctx, &proto.FriendshipTwoSideLookupRequest{ - AccountId: uint64(userId), - RelatedId: uint64(relatedId), + AccountId: uint64(user.ExternalID), + RelatedId: uint64(related.ExternalID), Status: uint32(status), }) }