Commit Graph

12 Commits

Author SHA1 Message Date
Anatolii Grynchuk 5003ab8764 fix: move ManagePackageVersionsCentrally to Directory.Packages.props
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 14:23:17 +03:00
Anatolii Grynchuk b0996833bc feat: add RabbitMQ worker, contracts, usage UI in channels screen
- Add HrynCo.NotificationService.Contracts project with SendEmailMessage and NotificationResultMessage
- Add SendEmailConsumer (RabbitMQ worker) with reply-to pattern via CorrelationContext.ReplyTo
- Add SendEmailHandler owning SMTP send + usage increment as business logic
- Add GetChannelUsageSummaryHandler with single DB query via navigation property
- Merge usage stats inline into channels list (daily/monthly with progress bars)
- Refactor AdminChannelsController.Index to use GetChannelUsageSummaryQuery
- Add RabbitMQ service to docker-compose files
- Remove dead AdminChannelUsageController, ChannelUsageViewModel, ChannelUsageSummary

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 14:00:58 +03:00
Anatolii Grynchuk 395f5573a1 refactor: replace mailkit with system.net.mail for smtp test
MailKit/MimeKit are unnecessary third-party dependencies with known
vulnerabilities. .NET's built-in System.Net.Mail.SmtpClient handles
the same test send without any additional packages.

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 03:48:36 +03:00
Anatolii Grynchuk c9f776de80 feat: add razor runtime compilation for development
Views are now recompiled on request without needing a full rebuild.
This makes .cshtml changes take effect immediately during development.

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 03:41:03 +03:00
Anatolii Grynchuk 5f09f7f4fe chore: fix nuget package resolution for local windows builds
- Add NuGet.Config with explicit globalPackagesFolder using %USERPROFILE%
  to prevent Docker-generated obj/ files (with /root/.nuget/packages/)
  from breaking Rider/local dotnet builds
- Restore Microsoft.AspNetCore.OpenApi to Directory.Packages.props
  (was accidentally removed; required by Web project)

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 03:20:53 +03:00
Anatolii Grynchuk 61ccf9c777 feat: add test channel feature in admin UI
- POST /admin/channels/{id}/test — direct SMTP send via MailKit
- Test button shown only on existing channels (not create)
- Bootstrap modal with recipient email input and spinner
- Inline success/error result inside the modal

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 02:57:36 +03:00
Anatolii Grynchuk 2cc8b6b7f2 feat: add Scalar API reference UI
- Scalar.AspNetCore 2.14.9
- Available in Development at /scalar/v1
- Theme: DeepSpace

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 01:39:50 +03:00
Anatolii Grynchuk 92be035f51 feat: replace manual Stopwatch with IProfiler in TransactionBehavior
- Add HrynCo.Common to Services project
- TransactionBehavior now uses IProfiler.MeasureExecutionAsync:
  MeasureExecutionAsync -> ExecuteInTransactionAsync -> next() -> SaveChangesAsync
- Profiler logs Start/End with duration + memory delta via Serilog PerformanceLog context
- Register IProfiler as singleton in ServiceCollectionExtensions (uses Log.Logger)

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 01:15:10 +03:00
Anatolii Grynchuk a9bea183c1 feat: add SerilogRegistrar and ContextualSerilogLogger
- IContextualSerilogLogger<T> / ContextualSerilogLogger<T> in Services/Logging
  (handlers get a ForContext<T>-scoped logger via DI, consistent with ItemTracker)
- SerilogRegistrar extension on WebApplicationBuilder (Api)
- SerilogRegistrar extension on HostApplicationBuilder (Worker)
- Both registrars: set Log.Logger, wire Logging + Host/Services, register ILogger singleton
- ServiceCollectionExtensions: register IContextualSerilogLogger<> as transient
- Program.cs in both apps simplified to single builder.AddSerilog() call

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 00:38:32 +03:00
Anatolii Grynchuk 5cf5f888eb feat: wire up Program.cs, DI extensions, Serilog, and appsettings
- ServiceCollectionExtensions in DAL.EF: AddNotificationDataAccess (DbContext, UoW, repositories)
- ServiceCollectionExtensions in Services: AddNotificationServices (MediatR + TransactionBehavior)
- Api/Program.cs: Serilog, OpenAPI, controllers, DI wiring
- Worker/Program.cs: Serilog, DI wiring
- appsettings.json: Serilog config with Console + Seq sinks, connection string
- appsettings.Development.json: Debug log level overrides

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 00:24:54 +03:00
Anatolii Grynchuk 101bb908bd feat: add Serilog with Console and Seq sinks, log TransactionBehavior
- Add Serilog.AspNetCore + Sinks.Console + Sinks.Seq to Api
- Add Serilog.Extensions.Hosting + Sinks.Console + Sinks.Seq to Worker
- Add Microsoft.Extensions.Logging.Abstractions to Services
- TransactionBehavior logs handler name, elapsed time, and errors

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 00:21:25 +03:00
Anatolii Grynchuk 26b29d169e feat: add EF Core layer with entities, configurations and DbContext
- Directory.Packages.props and Directory.Build.props for central package management
- TemplateEntity, ProviderEntity, ProviderUsageEntity (internal to DAL.EF)
- TemplateEntityConfiguration: composite unique index (service_name, key, language_code), Variables as JSON column
- ProviderEntityConfiguration: settings stored as jsonb, index on (service_name, priority)
- ProviderUsageEntityConfiguration: composite unique index (provider_id, date)
- All entities map Id column explicitly as 'id' (snake_case)
- NotificationDbContext with ApplyConfigurationsFromAssembly

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-01 19:50:33 +03:00