Реализовать лабораторную работу 5

This commit is contained in:
Никита
2026-11-10 10:57:36 +03:00
parent 276dbdad8a
commit 8c87c60621
124 changed files with 15887 additions and 27 deletions
@@ -0,0 +1,13 @@
using Messenger.Api.Contracts;
using Messenger.Api.Data;
namespace Messenger.Api.Services;
public sealed class MessageService(AppDatabase database)
{
public async Task<MessageDto?> CreateAsync(Guid chatId, Guid senderId, string text, string key, Guid[] attachmentIds) =>
(await database.CreateMessageOnceAsync(chatId, senderId, text, key, attachmentIds))?.ToDto();
public async Task<List<MessageDto>> ListAsync(Guid chatId, DateTime? cursorTime, Guid? cursorId, int count, bool newestFirst = false) =>
(await database.ListMessagesAsync(chatId, cursorTime, cursorId, count, newestFirst)).Select(message => message.ToDto()).ToList();
}