Skip to content

Commit

Permalink
Merge pull request #850 from peer-42seoul/Fix/remain-only-one-part2
Browse files Browse the repository at this point in the history
[Fix] : 준비됐지 임전윤채 #848
  • Loading branch information
wochae authored Feb 14, 2024
2 parents 669ac73 + ae5cbcb commit e6c0c36
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 159 deletions.
14 changes: 10 additions & 4 deletions src/main/java/peer/backend/controller/board/RecruitController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;
import peer.backend.annotation.AuthorCheck;
import peer.backend.dto.board.recruit.*;
import peer.backend.entity.board.recruit.Recruit;
import peer.backend.entity.board.recruit.enums.RecruitFavoriteEnum;
import peer.backend.entity.user.User;
import peer.backend.exception.NotFoundException;
import peer.backend.repository.board.recruit.RecruitRepository;
import peer.backend.exception.BadRequestException;
import peer.backend.service.board.recruit.RecruitService;

import javax.validation.Valid;
Expand Down Expand Up @@ -66,8 +66,14 @@ public Long updateRecruit(@PathVariable Long recruit_id,

@ApiOperation(value = "", notes = "모집글을 삭제한다.")
@DeleteMapping("/{recruit_id}")
public void deleteRecruit(@PathVariable Long recruit_id) {
recruitService.deleteRecruit(recruit_id);
@AuthorCheck
public ResponseEntity<?> deleteRecruit(@PathVariable Long recruit_id, Authentication auth) {
try {
recruitService.deleteRecruit(recruit_id, User.authenticationToUser(auth));
} catch (BadRequestException e) {
return ResponseEntity.badRequest().body(e);
}
return ResponseEntity.ok().build();
}

@ApiOperation(value = "", notes = "모집에 지원한다.")
Expand Down
Loading

0 comments on commit e6c0c36

Please sign in to comment.