feat(admin): stabilize blog and admin patterns
TaxBaik CI/CD / build-and-deploy (push) Has been cancelled
TaxBaik CI/CD / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -12,3 +12,21 @@ public class CreateBlogPostDto
|
||||
public bool IsPublished { get; set; }
|
||||
public int? AuthorId { get; set; }
|
||||
}
|
||||
|
||||
public class BlogPostResponseDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public int? CategoryId { get; set; }
|
||||
public string? Tags { get; set; }
|
||||
public string? SeoTitle { get; set; }
|
||||
public string? SeoDescription { get; set; }
|
||||
public string? ThumbnailUrl { get; set; }
|
||||
public bool IsPublished { get; set; }
|
||||
public int? AuthorId { get; set; }
|
||||
public int ViewCount { get; set; }
|
||||
public string Slug { get; set; } = string.Empty;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? PublishedAt { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace TaxBaik.Application.DTOs;
|
||||
|
||||
public class SubmitInquiryDto
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string? Email { get; set; }
|
||||
public string ServiceType { get; set; } = string.Empty;
|
||||
public string Message { get; set; } = string.Empty;
|
||||
public bool SuppressNotification { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace TaxBaik.Application.DTOs;
|
||||
|
||||
public class UpdateInquiryDto
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string? Email { get; set; }
|
||||
public string ServiceType { get; set; } = string.Empty;
|
||||
public string Message { get; set; } = string.Empty;
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public string? AdminMemo { get; set; }
|
||||
}
|
||||
@@ -110,6 +110,12 @@ public class BlogService(IBlogPostRepository repository, IMemoryCache memoryCach
|
||||
memoryCache.Remove(AdminDashboardService.CacheKey);
|
||||
}
|
||||
|
||||
public async Task ArchiveAsync(int id, CancellationToken ct = default)
|
||||
{
|
||||
await repository.ArchiveAsync(id, ct);
|
||||
memoryCache.Remove(AdminDashboardService.CacheKey);
|
||||
}
|
||||
|
||||
public async Task IncrementViewCountAsync(int id, CancellationToken ct = default) =>
|
||||
await repository.IncrementViewCountAsync(id, ct);
|
||||
|
||||
|
||||
@@ -6,15 +6,6 @@ using TaxBaik.Domain.Interfaces;
|
||||
|
||||
public class ClientService(IClientRepository repository)
|
||||
{
|
||||
public static readonly string[] ServiceTypes =
|
||||
["기장", "부동산", "증여·상속", "종합소득세", "법인세", "부가가치세", "기타"];
|
||||
|
||||
public static readonly string[] TaxTypes =
|
||||
["개인사업자", "법인사업자", "면세사업자", "근로소득자", "기타"];
|
||||
|
||||
public static readonly string[] Sources =
|
||||
["홈페이지 문의", "소개", "직접 방문", "카카오 채널", "블로그", "기타"];
|
||||
|
||||
public async Task<(IEnumerable<Client> Items, int Total)> GetPagedAsync(
|
||||
int page, int pageSize, string? status = null, string? search = null, CancellationToken ct = default) =>
|
||||
await repository.GetPagedAsync(Math.Max(1, page), Math.Clamp(pageSize, 1, 100), status, search, ct);
|
||||
@@ -81,7 +72,7 @@ public class ClientService(IClientRepository repository)
|
||||
Phone = phone?.Trim(),
|
||||
ServiceType = serviceType,
|
||||
Status = "active",
|
||||
Source = "홈페이지 문의"
|
||||
Source = "홈페이지문의"
|
||||
};
|
||||
return await repository.CreateAsync(client, ct);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using TaxBaik.Domain.Interfaces;
|
||||
public class FaqService(IFaqRepository repository)
|
||||
{
|
||||
public static readonly string[] Categories =
|
||||
["기장·세금신고", "부동산", "증여·상속", "기타"];
|
||||
["기장세금신고", "부동산", "증여상속", "기타"];
|
||||
|
||||
public async Task<IEnumerable<Faq>> GetActiveAsync(CancellationToken ct = default) =>
|
||||
await repository.GetActiveAsync(ct);
|
||||
|
||||
@@ -2,6 +2,7 @@ namespace TaxBaik.Application.Services;
|
||||
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using TaxBaik.Application.DTOs;
|
||||
using TaxBaik.Domain.Entities;
|
||||
using TaxBaik.Domain.Enums;
|
||||
using TaxBaik.Domain.Interfaces;
|
||||
@@ -72,6 +73,37 @@ public class InquiryService(
|
||||
public async Task UpdateAdminMemoAsync(int id, string? adminMemo, CancellationToken ct = default) =>
|
||||
await repository.UpdateAdminMemoAsync(id, adminMemo, ct);
|
||||
|
||||
public async Task<Inquiry?> UpdateAsync(int id, UpdateInquiryDto dto, CancellationToken ct = default)
|
||||
{
|
||||
var inquiry = await repository.GetByIdAsync(id, ct);
|
||||
if (inquiry == null)
|
||||
return null;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(dto.Name))
|
||||
throw new ValidationException("이름을 입력하세요.");
|
||||
|
||||
if (!PhoneRegex.IsMatch(dto.Phone))
|
||||
throw new ValidationException("올바른 전화번호를 입력하세요. (예: 010-1234-5678)");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(dto.Message))
|
||||
throw new ValidationException("문의 내용을 입력하세요.");
|
||||
|
||||
if (!InquiryStatusMapper.TryParse(dto.Status, out var parsedStatus))
|
||||
throw new ValidationException("지원하지 않는 문의 상태입니다.");
|
||||
|
||||
inquiry.Name = dto.Name.Trim();
|
||||
inquiry.Phone = dto.Phone.Trim();
|
||||
inquiry.Email = string.IsNullOrWhiteSpace(dto.Email) ? null : dto.Email.Trim();
|
||||
inquiry.ServiceType = string.IsNullOrWhiteSpace(dto.ServiceType) ? "기타" : dto.ServiceType.Trim();
|
||||
inquiry.Message = dto.Message.Trim();
|
||||
inquiry.Status = InquiryStatusMapper.ToStorageValue(parsedStatus);
|
||||
inquiry.AdminMemo = dto.AdminMemo;
|
||||
|
||||
await repository.UpdateAsync(inquiry, ct);
|
||||
memoryCache.Remove(AdminDashboardService.CacheKey);
|
||||
return inquiry;
|
||||
}
|
||||
|
||||
public async Task LinkClientAsync(int inquiryId, int clientId, CancellationToken ct = default) =>
|
||||
await repository.LinkClientAsync(inquiryId, clientId, ct);
|
||||
|
||||
|
||||
@@ -5,9 +5,6 @@ using TaxBaik.Domain.Interfaces;
|
||||
|
||||
public class TaxFilingService(ITaxFilingRepository repository)
|
||||
{
|
||||
public static readonly string[] FilingTypes =
|
||||
["부가가치세", "종합소득세", "법인세", "원천징수", "종합부동산세", "증여세", "상속세", "기타"];
|
||||
|
||||
public static readonly string[] Statuses =
|
||||
["pending", "filed", "overdue"];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user