feat(blog): add archived post restore workflow
TaxBaik CI/CD / build-and-deploy (push) Failing after 5m38s

This commit is contained in:
2026-07-02 11:08:39 +09:00
parent ad55bd1884
commit b06c0f99fb
7 changed files with 105 additions and 3 deletions
@@ -6,10 +6,12 @@ using TaxBaik.Application.DTOs;
public interface IBlogBrowserClient
{
Task<(IEnumerable<BlogPostResponseDto> Items, int Total)> GetAdminPagedAsync(int page = 1, int pageSize = 20, CancellationToken ct = default);
Task<(IEnumerable<BlogPostResponseDto> Items, int Total)> GetArchivedPagedAsync(int page = 1, int pageSize = 20, CancellationToken ct = default);
Task<BlogPostResponseDto?> GetByIdAsync(int id, CancellationToken ct = default);
Task<BlogPostResponseDto?> CreateAsync(CreateBlogPostDto dto, CancellationToken ct = default);
Task<BlogPostResponseDto?> UpdateAsync(int id, CreateBlogPostDto dto, CancellationToken ct = default);
Task<bool> DeleteAsync(int id, CancellationToken ct = default);
Task<bool> RestoreAsync(int id, CancellationToken ct = default);
Task<bool> TogglePublishAsync(int id, CreateBlogPostDto dto, CancellationToken ct = default);
}
@@ -41,6 +43,13 @@ public class BlogBrowserClient : IBlogBrowserClient
return result != null ? (result.Data, result.Total) : ([], 0);
}
public async Task<(IEnumerable<BlogPostResponseDto> Items, int Total)> GetArchivedPagedAsync(int page = 1, int pageSize = 20, CancellationToken ct = default)
{
EnsureAuthHeader();
var result = await _http.GetFromJsonAsync<PagedResponse>($"blog/admin/archived?page={page}&pageSize={pageSize}", ct);
return result != null ? (result.Data, result.Total) : ([], 0);
}
public async Task<BlogPostResponseDto?> GetByIdAsync(int id, CancellationToken ct = default)
{
EnsureAuthHeader();
@@ -74,6 +83,13 @@ public class BlogBrowserClient : IBlogBrowserClient
return response.IsSuccessStatusCode;
}
public async Task<bool> RestoreAsync(int id, CancellationToken ct = default)
{
EnsureAuthHeader();
var response = await _http.PostAsync($"blog/{id}/restore", null, ct);
return response.IsSuccessStatusCode;
}
public async Task<bool> TogglePublishAsync(int id, CreateBlogPostDto dto, CancellationToken ct = default)
{
var result = await UpdateAsync(id, dto, ct);