feat: 휴가 부여현황 API 추가
- leave_grants 테이블 마이그레이션 추가 - LeaveGrant 모델 생성 (annual/monthly/reward/condolence/other 유형) - LeaveService에 getGrants, storeGrant, destroyGrant 메서드 추가 - LeaveController에 grants, storeGrant, destroyGrant 엔드포인트 추가 - GET/POST/DELETE /api/v1/leaves/grants 라우트 추가 - 연차/월차 부여 시 LeaveBalance total_days 자동 갱신
This commit is contained in:
@@ -154,4 +154,37 @@ public function setBalance(BalanceRequest $request): JsonResponse
|
||||
);
|
||||
}, __('message.updated'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 휴가 부여 이력 목록
|
||||
* GET /v1/leaves/grants
|
||||
*/
|
||||
public function grants(Request $request): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return $this->service->getGrants($request->all());
|
||||
}, __('message.fetched'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 휴가 부여
|
||||
* POST /v1/leaves/grants
|
||||
*/
|
||||
public function storeGrant(Request $request): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return $this->service->storeGrant($request->all());
|
||||
}, __('message.leave.granted'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 휴가 부여 삭제
|
||||
* DELETE /v1/leaves/grants/{id}
|
||||
*/
|
||||
public function destroyGrant(int $id): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
return $this->service->destroyGrant($id);
|
||||
}, __('message.deleted'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user