feat: harden auth ops and deployment baseline

This commit is contained in:
2026-06-27 10:53:53 +09:00
parent a6ca30eec8
commit 28060b71be
41 changed files with 714 additions and 208 deletions
+10 -12
View File
@@ -1,12 +1,13 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using TaxBaik.Application.Services;
using TaxBaik.Domain.Entities;
using TaxBaik.Web.Services;
namespace TaxBaik.Web.Pages.Blog;
public class BlogIndexModel : PageModel
{
private readonly IApiClient _apiClient;
private readonly BlogService _blogService;
private readonly CategoryService _categoryService;
public List<BlogPost> Posts { get; set; } = [];
public List<Category> Categories { get; set; } = [];
@@ -15,9 +16,10 @@ public class BlogIndexModel : PageModel
public int? SelectedCategoryId { get; set; }
private const int PageSize = 12;
public BlogIndexModel(IApiClient apiClient)
public BlogIndexModel(BlogService blogService, CategoryService categoryService)
{
_apiClient = apiClient;
_blogService = blogService;
_categoryService = categoryService;
}
public async Task OnGetAsync(int page = 1, int? categoryId = null)
@@ -27,15 +29,11 @@ public class BlogIndexModel : PageModel
CurrentPage = page;
SelectedCategoryId = categoryId;
var categories = await _apiClient.GetAsync<List<Category>>("category");
Categories = categories ?? [];
Categories = (await _categoryService.GetAllAsync()).ToList();
var blogsResponse = await _apiClient.GetAsync<BlogApiResponse>($"blog?page={page}&pageSize={PageSize}");
if (blogsResponse != null)
{
Posts = blogsResponse.Data ?? [];
TotalPages = (blogsResponse.Total + PageSize - 1) / PageSize;
}
var (posts, total) = await _blogService.GetPublishedPagedAsync(page, PageSize, categoryId);
Posts = posts.ToList();
TotalPages = (total + PageSize - 1) / PageSize;
}
catch
{
+2
View File
@@ -16,6 +16,8 @@
}
<form method="post">
<div asp-validation-summary="ModelOnly" class="text-danger mb-3"></div>
<div class="mb-3">
<label for="name" class="form-label">이름 <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="name" name="Name" required />
+13 -11
View File
@@ -1,12 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using TaxBaik.Web.Services;
using TaxBaik.Application.Services;
namespace TaxBaik.Web.Pages;
public class ContactModel : PageModel
{
private readonly IApiClient _apiClient;
private readonly InquiryService _inquiryService;
[BindProperty]
public string Name { get; set; } = "";
@@ -26,9 +26,9 @@ public class ContactModel : PageModel
[BindProperty]
public bool Agree { get; set; }
public ContactModel(IApiClient apiClient)
public ContactModel(InquiryService inquiryService)
{
_apiClient = apiClient;
_inquiryService = inquiryService;
}
public async Task<IActionResult> OnPostAsync()
@@ -38,19 +38,21 @@ public class ContactModel : PageModel
try
{
var inquiry = new
{
await _inquiryService.SubmitAsync(
Name,
Phone,
Email,
ServiceType,
Message
};
await _apiClient.PostAsync<object>("inquiry", inquiry);
Message,
Email,
HttpContext.Connection.RemoteIpAddress?.ToString());
TempData["Success"] = "상담 신청이 접수되었습니다. 빠른 시간 내에 연락드리겠습니다.";
return RedirectToPage();
}
catch (ValidationException ex)
{
ModelState.AddModelError("", ex.Message);
return Page();
}
catch
{
ModelState.AddModelError("", "시스템 오류가 발생했습니다. 잠시 후 다시 시도해주세요.");
+6 -15
View File
@@ -1,27 +1,26 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using TaxBaik.Application.Services;
using TaxBaik.Domain.Entities;
using TaxBaik.Web.Services;
namespace TaxBaik.Web.Pages;
public class IndexModel : PageModel
{
private readonly IApiClient _apiClient;
private readonly BlogService _blogService;
public List<BlogPost> RecentPosts { get; set; } = [];
public IndexModel(IApiClient apiClient)
public IndexModel(BlogService blogService)
{
_apiClient = apiClient;
_blogService = blogService;
}
public async Task OnGetAsync()
{
try
{
var response = await _apiClient.GetAsync<BlogApiResponse>("blog?page=1&pageSize=3");
if (response?.Data != null)
RecentPosts = response.Data.ToList();
var (posts, _) = await _blogService.GetPublishedPagedAsync(1, 3);
RecentPosts = posts.ToList();
}
catch
{
@@ -29,11 +28,3 @@ public class IndexModel : PageModel
}
}
}
public class BlogApiResponse
{
public List<BlogPost> Data { get; set; } = [];
public int Total { get; set; }
public int Page { get; set; }
public int PageSize { get; set; }
}