Implemented Telegram bot functionality, including settings management, subscriber tracking, and link generation for user interaction. Updated the backend to support new Telegram-related services and database entities. Enhanced the frontend to display Telegram options and allow users to open a chat with the bot. Localization strings were added for both English and Russian to support the new features. This integration aims to improve user engagement through Telegram notifications and interactions.
20 lines
834 B
C#
20 lines
834 B
C#
using LiteCqrs;
|
|
using TeleWave.Application.Common.Models;
|
|
|
|
namespace TeleWave.Application.Notifications.Settings;
|
|
|
|
public sealed class GetTelegramSettingsQueryHandler(TelegramSettingsService settings)
|
|
: IQueryHandler<GetTelegramSettingsQuery, Result<TelegramSettingsDto>>
|
|
{
|
|
public async Task<Result<TelegramSettingsDto>> Handle(
|
|
GetTelegramSettingsQuery query,
|
|
CancellationToken cancellationToken
|
|
)
|
|
{
|
|
// Читаем без создания строки: GET не должен писать в базу, а умолчания те же самые.
|
|
var stored = await settings.ReadAsync(cancellationToken);
|
|
var current = stored ?? Domain.Notifications.TelegramSettings.CreateDefault();
|
|
return Result.Success(await settings.ToDtoAsync(current, cancellationToken));
|
|
}
|
|
}
|