refactor: rename Api project to Web

- HrynCo.NotificationService.Api -> HrynCo.NotificationService.Web
- HrynCo.NotificationService.Api.IntegrationTests -> HrynCo.NotificationService.Web.IntegrationTests
- Updated slnx, docker-compose, project references, and namespaces
- Project serves both REST API and admin UI

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Anatolii Grynchuk
2026-05-02 01:55:57 +03:00
parent 2cc8b6b7f2
commit ab44ad117c
21 changed files with 21 additions and 21 deletions
@@ -0,0 +1,14 @@
using HrynCo.NotificationService.DAL.Abstract.Providers;
namespace HrynCo.NotificationService.Web.Controllers.EmailChannels;
public sealed record CreateEmailChannelRequest(
string ServiceName,
int Priority,
EmailChannelType ChannelType,
EmailChannelSettings Settings,
int? DailyLimit,
int? MonthlyLimit,
int WarnThresholdPercent,
bool IsActive
);
@@ -0,0 +1,77 @@
using HrynCo.NotificationService.Web.Infrastructure;
using HrynCo.NotificationService.Services.EmailChannels.Create;
using HrynCo.NotificationService.Services.EmailChannels.Delete;
using HrynCo.NotificationService.Services.EmailChannels.Get;
using HrynCo.NotificationService.Services.EmailChannels.GetByService;
using HrynCo.NotificationService.Services.EmailChannels.Update;
using MediatR;
using Microsoft.AspNetCore.Mvc;
namespace HrynCo.NotificationService.Web.Controllers.EmailChannels;
[Route("api/v1/email-channels")]
public sealed class EmailChannelsController : ApiControllerBase
{
public EmailChannelsController(IMediator mediator) : base(mediator) { }
[HttpGet]
public async Task<IActionResult> GetAll([FromQuery] string serviceName, CancellationToken cancellationToken)
{
var result = await Mediator.Send(new GetEmailChannelsQuery(serviceName), cancellationToken);
return FromServiceResult(result);
}
[HttpGet("{id:guid}")]
public async Task<IActionResult> Get(Guid id, CancellationToken cancellationToken)
{
var result = await Mediator.Send(new GetEmailChannelQuery(id), cancellationToken);
return FromServiceResult(result);
}
[HttpPost]
public async Task<IActionResult> Create([FromBody] CreateEmailChannelRequest request, CancellationToken cancellationToken)
{
var command = new CreateEmailChannelCommand(
request.ServiceName,
request.Priority,
request.ChannelType,
request.Settings,
request.DailyLimit,
request.MonthlyLimit,
request.WarnThresholdPercent,
request.IsActive
);
var result = await Mediator.Send(command, cancellationToken);
if (!result.IsSuccess)
return MapServiceError(result.Error!);
return CreatedAtAction(nameof(Get), new { id = result.Result },
new ApiResponse<Guid> { Success = true, Data = result.Result });
}
[HttpPut("{id:guid}")]
public async Task<IActionResult> Update(Guid id, [FromBody] UpdateEmailChannelRequest request, CancellationToken cancellationToken)
{
var command = new UpdateEmailChannelCommand(
id,
request.Priority,
request.Settings,
request.DailyLimit,
request.MonthlyLimit,
request.WarnThresholdPercent,
request.IsActive
);
var result = await Mediator.Send(command, cancellationToken);
return FromServiceResult(result);
}
[HttpDelete("{id:guid}")]
public async Task<IActionResult> Delete(Guid id, CancellationToken cancellationToken)
{
var result = await Mediator.Send(new DeleteEmailChannelCommand(id), cancellationToken);
return FromServiceResult(result);
}
}
@@ -0,0 +1,12 @@
using HrynCo.NotificationService.DAL.Abstract.Providers;
namespace HrynCo.NotificationService.Web.Controllers.EmailChannels;
public sealed record UpdateEmailChannelRequest(
int Priority,
EmailChannelSettings Settings,
int? DailyLimit,
int? MonthlyLimit,
int WarnThresholdPercent,
bool IsActive
);