Media Controller Tests and other

This commit is contained in:
Artemy
2025-07-21 16:18:04 +07:00
parent c0d02e0fa1
commit c434ca447c
8 changed files with 286 additions and 22 deletions
@@ -15,7 +15,7 @@ public record Media(Guid UploaderId,
string FileName,
byte[] Data,
MediaType Type,
string MineType,
string MimeType,
string EncryptedKey);
public record MediaUploadResult(Guid? MediaId, string Url);
@@ -15,7 +15,7 @@ public interface IMessageCommandService
// Task<Result> MarkMessageAsReadAsync(Guid userId, Guid messageId);
}
// Define specific result types for clarity, including original message for notifications if needed
public record SendMessageResult(bool IsSuccess, Exception? Exception, Message Message)
: Result(IsSuccess, Exception, Message?.Id ?? Guid.Empty);
@@ -23,7 +23,7 @@ public record SendMessageResult(bool IsSuccess, Exception? Exception, Message Me
public record EditMessageResult(bool IsSuccess, Exception? Exception, Message? OriginalMessage)
: Result(IsSuccess, Exception, OriginalMessage?.Id ?? Guid.Empty)
{
// OriginalMessage can be useful for the Hub to know details like RecipientType, RecipientId for notifications
}
public record DeleteMessageResult(bool IsSuccess, Exception? Exception, Message? OriginalMessage)
@@ -34,7 +34,7 @@ public class MediaService : IMediaService
UploaderId = file.UploaderId,
DateCreated = file.UploadedOn,
MediaType = file.Type,
MineType = file.MineType,
MineType = file.MimeType,
Url = url
});
@@ -15,10 +15,10 @@ namespace Govor.Application.Services.Messages;
public class MessageCommandService : IMessageCommandService
{
private readonly IMessagesRepository _messagesRepository;
private readonly IUsersRepository _usersRepository; // For validating user recipients
private readonly IGroupsRepository _groupsRepository; // For validating group recipients and fetching members
private readonly IUsersRepository _usersRepository;
private readonly IGroupsRepository _groupsRepository;
private readonly IPrivateChatsRepository _privateChats;
private readonly IVerifyFriendship _verifyFriendship; // For private messages
private readonly IVerifyFriendship _verifyFriendship;
private readonly ILogger<MessageCommandService> _logger;
public MessageCommandService(