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
+21 -10
View File
@@ -28,7 +28,7 @@ public class BlogController : ControllerBase
{
var post = await _blogService.GetBySlugAsync(slug);
if (post == null)
return NotFound(new { message = "Post not found" });
return NotFound(new ProblemDetails { Title = "포스트를 찾을 수 없습니다.", Status = StatusCodes.Status404NotFound });
return Ok(post);
}
@@ -44,21 +44,32 @@ public class BlogController : ControllerBase
[Authorize]
public async Task<IActionResult> Create([FromBody] CreateBlogPostDto dto)
{
if (string.IsNullOrWhiteSpace(dto.Title) || string.IsNullOrWhiteSpace(dto.Content))
return BadRequest(new { message = "Title and content are required" });
var result = await _blogService.CreateAsync(dto);
return CreatedAtAction(nameof(GetBySlug), new { slug = result.Slug }, result);
try
{
var result = await _blogService.CreateAsync(dto);
return CreatedAtAction(nameof(GetBySlug), new { slug = result.Slug }, result);
}
catch (ValidationException ex)
{
return BadRequest(new ProblemDetails { Title = ex.Message, Status = StatusCodes.Status400BadRequest });
}
}
[HttpPut("{id}")]
[Authorize]
public async Task<IActionResult> Update(int id, [FromBody] CreateBlogPostDto dto)
{
var result = await _blogService.UpdateAsync(id, dto);
if (result == null)
return NotFound(new { message = "Post not found" });
return Ok(result);
try
{
var result = await _blogService.UpdateAsync(id, dto);
if (result == null)
return NotFound(new ProblemDetails { Title = "포스트를 찾을 수 없습니다.", Status = StatusCodes.Status404NotFound });
return Ok(result);
}
catch (ValidationException ex)
{
return BadRequest(new ProblemDetails { Title = ex.Message, Status = StatusCodes.Status400BadRequest });
}
}
[HttpDelete("{id}")]