feat: notify telegram on new inquiries
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m33s
TaxBaik Browser E2E / browser-e2e (push) Successful in 2m8s

This commit is contained in:
2026-06-27 15:58:42 +09:00
parent 3e8cfc386c
commit f54cab5562
8 changed files with 102 additions and 4 deletions
@@ -9,6 +9,7 @@ public static class DependencyInjection
{
services.AddScoped<BlogService>();
services.AddScoped<InquiryService>();
services.AddScoped<IInquiryNotificationService, NoopInquiryNotificationService>();
services.AddScoped<CategoryService>();
return services;
}
@@ -0,0 +1,6 @@
namespace TaxBaik.Application.Services;
public interface IInquiryNotificationService
{
Task NotifyCreatedAsync(int inquiryId, string name, string phone, string serviceType, string message, CancellationToken ct = default);
}
@@ -5,7 +5,7 @@ using TaxBaik.Domain.Entities;
using TaxBaik.Domain.Enums;
using TaxBaik.Domain.Interfaces;
public class InquiryService(IInquiryRepository repository)
public class InquiryService(IInquiryRepository repository, IInquiryNotificationService notificationService)
{
private static readonly Regex PhoneRegex = new(@"^01[0-9]-\d{3,4}-\d{4}$");
@@ -34,7 +34,9 @@ public class InquiryService(IInquiryRepository repository)
CreatedAt = DateTime.UtcNow
};
return await repository.CreateAsync(inquiry, ct);
var inquiryId = await repository.CreateAsync(inquiry, ct);
await notificationService.NotifyCreatedAsync(inquiryId, inquiry.Name, inquiry.Phone, inquiry.ServiceType, inquiry.Message, ct);
return inquiryId;
}
public async Task<Inquiry?> GetByIdAsync(int id, CancellationToken ct = default) =>
@@ -0,0 +1,7 @@
namespace TaxBaik.Application.Services;
public sealed class NoopInquiryNotificationService : IInquiryNotificationService
{
public Task NotifyCreatedAsync(int inquiryId, string name, string phone, string serviceType, string message, CancellationToken ct = default)
=> Task.CompletedTask;
}