Skip to content

Commit

Permalink
refactor: #7 연차 승인/반려 시 검증 로직 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
dali186 committed Aug 3, 2023
1 parent 56aae84 commit 2d1a20b
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package com.example.kdtbe5_miniproject.admin;

import com.example.kdtbe5_miniproject._core.security.CustomUserDetails;
import com.example.kdtbe5_miniproject._core.util.ApiUtils;
import com.example.kdtbe5_miniproject.dayoff.DayOff;
import com.example.kdtbe5_miniproject.duty.Duty;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
Expand Down Expand Up @@ -44,6 +39,9 @@ public ResponseEntity<?> userDetails(@PathVariable Long userId) {

@PutMapping("/status/dayoff/{dayOffId}")
public ResponseEntity<?> dayOffModify(@PathVariable Long dayOffId, @RequestBody AdminRequest.TreatDayOffDTO request) {
if (adminService.findWaitingDayOffList(dayOffId).get(0) != dayOffId) {
throw new RuntimeException("이미 처리된 요청이거나, 해당 사용자의 이전 요청을 먼저 처리해주세요.");
}
adminService.modifyDayOffStatus(dayOffId, request);

return ResponseEntity.ok().body(ApiUtils.success(request.getStatus() + "되었습니다."));
Expand Down

0 comments on commit 2d1a20b

Please sign in to comment.