chore(API): 공정 컨트롤러 및 라우팅 업데이트
- ProcessController: 공정 관리 API 개선 - routes/api.php: API 라우팅 정리 - CURRENT_WORKS.md: 작업 현황 업데이트 - LOGICAL_RELATIONSHIPS.md: 논리적 관계 문서화 - profile-image-upload-api.md: 프로필 이미지 업로드 API 메모 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,10 +21,12 @@ public function __construct(
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$params = $request->only(['page', 'size', 'q', 'status', 'process_type']);
|
||||
$result = $this->processService->index($params);
|
||||
|
||||
return ApiResponse::handle($result, 'message.fetched');
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->processService->index(
|
||||
$request->only(['page', 'size', 'q', 'status', 'process_type'])
|
||||
),
|
||||
'message.fetched'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,9 +34,10 @@ public function index(Request $request): JsonResponse
|
||||
*/
|
||||
public function show(int $id): JsonResponse
|
||||
{
|
||||
$result = $this->processService->show($id);
|
||||
|
||||
return ApiResponse::handle($result, 'message.fetched');
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->processService->show($id),
|
||||
'message.fetched'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,9 +45,10 @@ public function show(int $id): JsonResponse
|
||||
*/
|
||||
public function store(StoreProcessRequest $request): JsonResponse
|
||||
{
|
||||
$result = $this->processService->store($request->validated());
|
||||
|
||||
return ApiResponse::handle($result, 'message.created', 201);
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->processService->store($request->validated()),
|
||||
'message.created'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,9 +56,10 @@ public function store(StoreProcessRequest $request): JsonResponse
|
||||
*/
|
||||
public function update(UpdateProcessRequest $request, int $id): JsonResponse
|
||||
{
|
||||
$result = $this->processService->update($id, $request->validated());
|
||||
|
||||
return ApiResponse::handle($result, 'message.updated');
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->processService->update($id, $request->validated()),
|
||||
'message.updated'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,9 +67,10 @@ public function update(UpdateProcessRequest $request, int $id): JsonResponse
|
||||
*/
|
||||
public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$this->processService->destroy($id);
|
||||
|
||||
return ApiResponse::handle(null, 'message.deleted');
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->processService->destroy($id),
|
||||
'message.deleted'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,10 +78,10 @@ public function destroy(int $id): JsonResponse
|
||||
*/
|
||||
public function destroyMany(Request $request): JsonResponse
|
||||
{
|
||||
$ids = $request->input('ids', []);
|
||||
$count = $this->processService->destroyMany($ids);
|
||||
|
||||
return ApiResponse::handle(['deleted_count' => $count], 'message.deleted');
|
||||
return ApiResponse::handle(
|
||||
fn () => ['deleted_count' => $this->processService->destroyMany($request->input('ids', []))],
|
||||
'message.deleted'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,9 +89,10 @@ public function destroyMany(Request $request): JsonResponse
|
||||
*/
|
||||
public function toggleActive(int $id): JsonResponse
|
||||
{
|
||||
$result = $this->processService->toggleActive($id);
|
||||
|
||||
return ApiResponse::handle($result, 'message.updated');
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->processService->toggleActive($id),
|
||||
'message.updated'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,9 +100,10 @@ public function toggleActive(int $id): JsonResponse
|
||||
*/
|
||||
public function options(): JsonResponse
|
||||
{
|
||||
$result = $this->processService->options();
|
||||
|
||||
return ApiResponse::handle($result, 'message.fetched');
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->processService->options(),
|
||||
'message.fetched'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,8 +111,9 @@ public function options(): JsonResponse
|
||||
*/
|
||||
public function stats(): JsonResponse
|
||||
{
|
||||
$result = $this->processService->getStats();
|
||||
|
||||
return ApiResponse::handle($result, 'message.fetched');
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->processService->getStats(),
|
||||
'message.fetched'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user