添加项目文件。

This commit is contained in:
2026-05-09 17:06:30 +08:00
parent c60f5fe117
commit 720ef957d4
378 changed files with 14843 additions and 0 deletions
@@ -0,0 +1,43 @@
using AutoMapper;
using IM.Commons;
using MessageService.Domain.IReposities;
using MessageService.WebApi.Application.Dtos;
namespace MessageService.WebApi.Application.Conversation
{
public class ConversationService
{
private readonly IConversationReposity reposity;
private readonly IMapper mapper;
public ConversationService(IConversationReposity reposity, IMapper mapper)
{
this.reposity = reposity;
this.mapper = mapper;
}
public async Task<Result<List<ConversationResponse>>> GetByOwnerIdAsync(Guid userId)
{
var list = await reposity.FindByUserIdAsync(userId);
return Result.Success(mapper.Map<List<ConversationResponse>>(list.ToList()));
}
public async Task<Result<ConversationResponse>> GetByIdAsync(Guid id, Guid userId)
{
var conversation = await reposity.FindByIdAsync(id);
if (conversation is null || conversation.UserId != userId)
{
return Result.Fail<ConversationResponse>(ResultCode.CONVERSATION_NOT_FOUND);
}
return Result.Success(mapper.Map<ConversationResponse>(conversation));
}
public async Task<Result<List<string>>> GetStreamkeysAsync(Guid userId)
{
var list = await reposity.FindAllStreamKeyAsync(userId);
return Result.Success(list.ToList());
}
}
}