- SystemBoardController: 시스템 게시판 목록/상세/필드 조회
- SystemPostController: 시스템 게시글 CRUD + 댓글 CRUD
- BoardService: getSystemBoardByCode(), getTenantBoardByCode() 추가
- PostService: 시스템/테넌트 게시판 전용 메서드 추가
- routes/api.php: /system-boards/* 엔드포인트 12개 추가
- SystemBoardApi.php: Swagger 문서
시스템 게시판 (is_system=true, tenant_id=null)과
테넌트 게시판 (is_system=false, tenant_id={current})의
board_code 중복 가능성으로 인해 별도 엔드포인트로 분리
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
67 lines
1.7 KiB
PHP
67 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\V1;
|
|
|
|
use App\Helpers\ApiResponse;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Boards\BoardService;
|
|
|
|
/**
|
|
* 시스템 게시판 API 컨트롤러
|
|
*
|
|
* 시스템 게시판 (is_system=true, tenant_id=null):
|
|
* - 본사에서 생성/관리하는 게시판
|
|
* - 모든 테넌트에서 읽기 가능
|
|
* - URL: /api/v1/system-boards/{code}
|
|
*/
|
|
class SystemBoardController extends Controller
|
|
{
|
|
public function __construct(
|
|
protected BoardService $boardService
|
|
) {}
|
|
|
|
/**
|
|
* 시스템 게시판 목록 조회
|
|
*/
|
|
public function index()
|
|
{
|
|
return ApiResponse::handle(function () {
|
|
$filters = request()->only(['board_type', 'search']);
|
|
|
|
return $this->boardService->getSystemBoards($filters);
|
|
}, __('message.fetched'));
|
|
}
|
|
|
|
/**
|
|
* 시스템 게시판 상세 조회 (code 기반)
|
|
*/
|
|
public function show(string $code)
|
|
{
|
|
return ApiResponse::handle(function () use ($code) {
|
|
$board = $this->boardService->getSystemBoardByCode($code);
|
|
|
|
if (! $board) {
|
|
abort(404, __('error.board.not_found'));
|
|
}
|
|
|
|
return $board->load('customFields');
|
|
}, __('message.fetched'));
|
|
}
|
|
|
|
/**
|
|
* 시스템 게시판 필드 목록 조회
|
|
*/
|
|
public function fields(string $code)
|
|
{
|
|
return ApiResponse::handle(function () use ($code) {
|
|
$board = $this->boardService->getSystemBoardByCode($code);
|
|
|
|
if (! $board) {
|
|
abort(404, __('error.board.not_found'));
|
|
}
|
|
|
|
return $this->boardService->getBoardFields($board->id);
|
|
}, __('message.fetched'));
|
|
}
|
|
}
|