添加项目文件。

This commit is contained in:
2026-04-30 21:08:28 +08:00
parent c60f5fe117
commit cc017b6495
327 changed files with 12860 additions and 0 deletions
@@ -0,0 +1,28 @@
using ContactService.Domain.Entities;
using ContactService.Domain.ValueObjects;
using IM.Commons;
namespace ContactService.Domain
{
public class FriendDomainService
{
private readonly IFriendReposity reposity;
public FriendDomainService(IFriendReposity reposity)
{
this.reposity = reposity;
}
public async Task<Result<Friend?>> CreateAsync(UserProfile owner, UserProfile target, string? remarkName)
{
var isExist = await reposity.CheckOwnerIdAndTargetIdAsync(owner.Id, target.Id);
if (isExist)
{
return Result<Friend?>.Fail(ResultCode.ALREADY_FRIENDS);
}
var friend = new Friend(owner, target, remarkName);
var res = await reposity.CreateAsync(friend);
return Result<Friend?>.Success(res);
}
}
}