Files
IM_NEW/ContactService.WebApi/Services/ContactintegrationService.cs
2026-05-09 17:06:30 +08:00

36 lines
1.0 KiB
C#

using ContactService.WebApi.Application.Friend;
using Grpc.Core;
using IM.Protocols.Grpc.Contact;
namespace ContactService.WebApi.Services
{
public class ContactintegrationService: ContactInternal.ContactInternalBase
{
private readonly Application.Friend.FriendService friendService;
public ContactintegrationService(FriendService friendService)
{
this.friendService = friendService;
}
public override async Task<CheckFriendshipResponse> CheckFriendship(CheckFriendshipRequest request, ServerCallContext context)
{
var response = new CheckFriendshipResponse();
var res = await friendService.CheckFriendAsync(
Guid.Parse(request.OwnerId),
Guid.Parse(request.TargetId)
);
if(res.Succeeded && res.Data)
{
response.Checked = true;
}
else
{
response.Checked = false;
}
return response;
}
}
}