오늘 이슈(TodayIssue) 기능 구현

- TodayIssue 모델 및 마이그레이션 추가
- TodayIssueController, TodayIssueService 구현
- TodayIssueObserverService 및 Observer 패턴 적용
- DailyReportService 연동
- Swagger API 문서 업데이트
- 라우트 추가
This commit is contained in:
2026-01-22 09:47:29 +09:00
parent 289fd3744c
commit d186a0c111
21 changed files with 1604 additions and 322 deletions

View File

@@ -2,8 +2,8 @@
namespace App\Http\Controllers\Api\V1;
use App\Http\Controllers\Controller;
use App\Helpers\ApiResponse;
use App\Http\Controllers\Controller;
use App\Services\TodayIssueService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -25,4 +25,53 @@ public function summary(Request $request): JsonResponse
return $this->todayIssueService->summary($limit);
}, __('message.fetched'));
}
}
/**
* 읽지 않은 이슈 목록 조회 (헤더 알림용)
*/
public function unread(Request $request): JsonResponse
{
$limit = (int) $request->input('limit', 10);
return ApiResponse::handle(function () use ($limit) {
return $this->todayIssueService->getUnreadList($limit);
}, __('message.fetched'));
}
/**
* 읽지 않은 이슈 개수 조회 (헤더 알림 뱃지용)
*/
public function unreadCount(): JsonResponse
{
return ApiResponse::handle(function () {
return ['count' => $this->todayIssueService->getUnreadCount()];
}, __('message.fetched'));
}
/**
* 이슈 읽음 처리
*/
public function markAsRead(int $id): JsonResponse
{
return ApiResponse::handle(function () use ($id) {
$result = $this->todayIssueService->markAsRead($id);
if (! $result) {
throw new \App\Exceptions\ApiException(__('error.not_found'), 404);
}
return null;
}, __('message.today_issue.marked_as_read'));
}
/**
* 모든 이슈 읽음 처리
*/
public function markAllAsRead(): JsonResponse
{
return ApiResponse::handle(function () {
$count = $this->todayIssueService->markAllAsRead();
return ['count' => $count];
}, __('message.today_issue.all_marked_as_read'));
}
}