feat: [mock-migration] Phase J-4 게시판 관리 API 수정

- BoardController: show 메서드 ID 기반 조회로 변경
- BoardStoreRequest: extra_settings.target/target_id/target_name 검증 추가
- BoardUpdateRequest: extra_settings.target/target_id/target_name 검증 추가
- routes/api.php: 게시판 상세 라우트 {code} → {id} 변경

테넌트 게시판 정책:
- 테넌트는 자신의 게시판만 CRUD 가능
- 시스템 게시판은 mng에서만 관리
- board_code는 시스템/테넌트 간 중복 허용

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-27 18:27:19 +09:00
parent 71a33d79cc
commit c694c65467
4 changed files with 27 additions and 8 deletions

View File

@@ -35,18 +35,18 @@ public function index()
}
/**
* 게시판 상세 조회 (코드 기반)
* 게시판 상세 조회 (ID 기반)
*/
public function show(string $code)
public function show(int $id)
{
return ApiResponse::handle(function () use ($code) {
$board = $this->boardService->getBoardByCode($code);
return ApiResponse::handle(function () use ($id) {
$board = $this->boardService->getBoardDetail($id);
if (! $board) {
abort(404, __('error.board.not_found'));
}
return $board->load('customFields');
return $board;
}, __('message.fetched'));
}

View File

@@ -3,6 +3,7 @@
namespace App\Http\Requests\Boards;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class BoardStoreRequest extends FormRequest
{
@@ -13,8 +14,16 @@ public function authorize(): bool
public function rules(): array
{
$tenantId = auth()->user()?->current_tenant_id;
return [
'board_code' => 'required|string|max:50|unique:boards,board_code',
'board_code' => [
'required',
'string',
'max:50',
// 테넌트 게시판 내에서만 중복 체크 (시스템 게시판과는 중복 허용)
Rule::unique('boards', 'board_code')->where('tenant_id', $tenantId),
],
'board_type' => 'nullable|string|max:50',
'name' => 'required|string|max:100',
'description' => 'nullable|string|max:500',
@@ -23,6 +32,9 @@ public function rules(): array
'max_file_count' => 'sometimes|integer|min:0|max:20',
'max_file_size' => 'sometimes|integer|min:0|max:102400',
'extra_settings' => 'nullable|array',
'extra_settings.target' => 'nullable|string|in:all,department',
'extra_settings.target_id' => 'nullable|integer',
'extra_settings.target_name' => 'nullable|string|max:100',
'extra_settings.permissions' => 'nullable|array',
'extra_settings.permissions.read' => 'nullable|array',
'extra_settings.permissions.write' => 'nullable|array',

View File

@@ -15,13 +15,17 @@ public function authorize(): bool
public function rules(): array
{
$boardId = $this->route('id');
$tenantId = auth()->user()?->current_tenant_id;
return [
'board_code' => [
'sometimes',
'string',
'max:50',
Rule::unique('boards', 'board_code')->ignore($boardId),
// 테넌트 게시판 내에서만 중복 체크 (시스템 게시판과는 중복 허용)
Rule::unique('boards', 'board_code')
->ignore($boardId)
->where('tenant_id', $tenantId),
],
'board_type' => 'nullable|string|max:50',
'name' => 'sometimes|string|max:100',
@@ -31,6 +35,9 @@ public function rules(): array
'max_file_count' => 'sometimes|integer|min:0|max:20',
'max_file_size' => 'sometimes|integer|min:0|max:102400',
'extra_settings' => 'nullable|array',
'extra_settings.target' => 'nullable|string|in:all,department',
'extra_settings.target_id' => 'nullable|integer',
'extra_settings.target_name' => 'nullable|string|max:100',
'extra_settings.permissions' => 'nullable|array',
'extra_settings.permissions.read' => 'nullable|array',
'extra_settings.permissions.write' => 'nullable|array',