From 15c261a49d896afde3f9c9c3d05b60dd4f2319c5 Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Thu, 2 Jul 2026 11:23:18 +0900 Subject: [PATCH] fix(blog): align soft delete with deleted_at --- .../Repositories/BlogPostRepository.cs | 10 ++++---- .../Components/Admin/Layout/MainLayout.razor | 10 -------- TaxBaik.Web/Pages/Index.cshtml | 23 ++++++------------- TaxBaik.Web/wwwroot/css/site.css | 15 ++++++------ .../V031__AddBlogDeletedAtColumn.sql | 6 +++++ 5 files changed, 26 insertions(+), 38 deletions(-) create mode 100644 db/migrations/V031__AddBlogDeletedAtColumn.sql diff --git a/TaxBaik.Infrastructure/Repositories/BlogPostRepository.cs b/TaxBaik.Infrastructure/Repositories/BlogPostRepository.cs index bebf8b6..2fc4779 100644 --- a/TaxBaik.Infrastructure/Repositories/BlogPostRepository.cs +++ b/TaxBaik.Infrastructure/Repositories/BlogPostRepository.cs @@ -12,7 +12,7 @@ public class BlogPostRepository(IDbConnectionFactory connectionFactory) : BaseRe return await conn.QueryFirstOrDefaultAsync( @"SELECT bp.id, bp.title, bp.content, bp.slug, bp.category_id, bp.tags, bp.author_id, bp.published_at, bp.view_count, bp.seo_title, bp.seo_description, bp.thumbnail_url, - bp.is_published, bp.created_at, bp.updated_at, c.name AS category_name + bp.is_published, bp.created_at, bp.updated_at, bp.deleted_at, c.name AS category_name FROM blog_posts bp LEFT JOIN categories c ON bp.category_id = c.id WHERE bp.id = @Id AND bp.deleted_at IS NULL", @@ -25,7 +25,7 @@ public class BlogPostRepository(IDbConnectionFactory connectionFactory) : BaseRe return await conn.QueryFirstOrDefaultAsync( @"SELECT bp.id, bp.title, bp.content, bp.slug, bp.category_id, bp.tags, bp.author_id, bp.published_at, bp.view_count, bp.seo_title, bp.seo_description, bp.thumbnail_url, - bp.is_published, bp.created_at, bp.updated_at, c.name AS category_name + bp.is_published, bp.created_at, bp.updated_at, bp.deleted_at, c.name AS category_name FROM blog_posts bp LEFT JOIN categories c ON bp.category_id = c.id WHERE bp.slug = @Slug AND bp.is_published = TRUE AND bp.deleted_at IS NULL", @@ -41,7 +41,7 @@ public class BlogPostRepository(IDbConnectionFactory connectionFactory) : BaseRe using var reader = await conn.QueryMultipleAsync( @"SELECT bp.id, bp.title, bp.content, bp.slug, bp.category_id, bp.tags, bp.author_id, bp.published_at, bp.view_count, bp.seo_title, bp.seo_description, bp.thumbnail_url, - bp.is_published, bp.created_at, bp.updated_at, c.name AS category_name + bp.is_published, bp.created_at, bp.updated_at, bp.deleted_at, c.name AS category_name FROM blog_posts bp LEFT JOIN categories c ON bp.category_id = c.id WHERE bp.is_published = TRUE AND bp.deleted_at IS NULL AND (@CategoryId::int IS NULL OR bp.category_id = @CategoryId) @@ -64,7 +64,7 @@ public class BlogPostRepository(IDbConnectionFactory connectionFactory) : BaseRe return await conn.QueryAsync( @"SELECT bp.id, bp.title, bp.slug, bp.category_id, bp.tags, bp.published_at, bp.view_count, bp.seo_description, bp.thumbnail_url, - bp.is_published, bp.created_at, bp.updated_at, c.name AS category_name + bp.is_published, bp.created_at, bp.updated_at, bp.deleted_at, c.name AS category_name FROM blog_posts bp LEFT JOIN categories c ON bp.category_id = c.id WHERE bp.is_published = TRUE AND bp.deleted_at IS NULL AND c.slug = @CategorySlug @@ -95,7 +95,7 @@ public class BlogPostRepository(IDbConnectionFactory connectionFactory) : BaseRe using var reader = await conn.QueryMultipleAsync( @"SELECT bp.id, bp.title, bp.content, bp.slug, bp.category_id, bp.tags, bp.author_id, bp.published_at, bp.view_count, bp.seo_title, bp.seo_description, bp.thumbnail_url, - bp.is_published, bp.created_at, bp.updated_at, c.name AS category_name + bp.is_published, bp.created_at, bp.updated_at, bp.deleted_at, c.name AS category_name FROM blog_posts bp LEFT JOIN categories c ON bp.category_id = c.id WHERE bp.deleted_at IS NULL diff --git a/TaxBaik.Web/Components/Admin/Layout/MainLayout.razor b/TaxBaik.Web/Components/Admin/Layout/MainLayout.razor index 34de9e1..bf05980 100644 --- a/TaxBaik.Web/Components/Admin/Layout/MainLayout.razor +++ b/TaxBaik.Web/Components/Admin/Layout/MainLayout.razor @@ -116,16 +116,6 @@ Navigation.LocationChanged += OnLocationChanged; } - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (!firstRender) - return; - - var viewportWidth = await JS.InvokeAsync("taxbaikAdminSession.getViewportWidth"); - drawerOpen = viewportWidth >= 960; - StateHasChanged(); - } - private void OnLocationChanged(object? sender, LocationChangedEventArgs args) { _ = InvokeAsync(() => JS.InvokeVoidAsync("taxbaikAdminSession.hideLoading")); diff --git a/TaxBaik.Web/Pages/Index.cshtml b/TaxBaik.Web/Pages/Index.cshtml index 6f0032a..9ff000f 100644 --- a/TaxBaik.Web/Pages/Index.cshtml +++ b/TaxBaik.Web/Pages/Index.cshtml @@ -330,24 +330,15 @@ else

상담 전 궁금하신 사항을 먼저 확인해 보세요

-
- @for (int i = 0; i < Model.ActiveFaqs.Count; i++) +
+ @foreach (var faqItem in Model.ActiveFaqs) { - var faqItem = Model.ActiveFaqs[i]; - var collapseId = $"faq-{faqItem.Id}"; -
-

- -

-
-
- @faqItem.Answer -
+
+ @faqItem.Question +
+ @faqItem.Answer
-
+ }
diff --git a/TaxBaik.Web/wwwroot/css/site.css b/TaxBaik.Web/wwwroot/css/site.css index 1c131e3..da5831b 100644 --- a/TaxBaik.Web/wwwroot/css/site.css +++ b/TaxBaik.Web/wwwroot/css/site.css @@ -682,21 +682,22 @@ img { border-radius: var(--radius-md) !important; margin-bottom: 0.75rem; overflow: hidden; + background: white; } .faq-question { font-weight: 700; color: var(--color-text); - background: white; font-size: 1rem; padding: 1.1rem 1.5rem; + cursor: pointer; + list-style: none; } -.faq-question:not(.collapsed) { +.faq-question::-webkit-details-marker { + display: none; +} +.faq-item[open] .faq-question { color: var(--color-secondary); - background: white; - box-shadow: none; -} -.faq-question::after { - filter: none; + border-bottom: 1px solid var(--color-border); } .faq-question:focus { box-shadow: 0 0 0 3px rgba(200, 157, 110, 0.2); diff --git a/db/migrations/V031__AddBlogDeletedAtColumn.sql b/db/migrations/V031__AddBlogDeletedAtColumn.sql new file mode 100644 index 0000000..6b0d171 --- /dev/null +++ b/db/migrations/V031__AddBlogDeletedAtColumn.sql @@ -0,0 +1,6 @@ +ALTER TABLE blog_posts + ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ; + +CREATE INDEX IF NOT EXISTS idx_blog_posts_deleted_at + ON blog_posts (deleted_at) + WHERE deleted_at IS NOT NULL;