Skip to content

Conversation

@leebs0521
Copy link
Collaborator

resolved:

📌 과제 설명

  • 봉사 모집글 생성 기능 컨트롤러 작업
  • 봉사 모집글 수정 기능 컨트롤러 작업
  • 봉사 모집글 삭제 기능 컨트롤러 작업

👩‍💻 요구 사항과 구현 내용

    @PreAuthorize("hasRole('CENTER')")
    @Operation(summary = "봉사 활동 모집글 삭제", description = "봉사 활동 모집글을 삭제합니다.")
    @DeleteMapping(value = "/recruit-board/{id}")
    public ApiResponse<?> deleteRecruitBoard(
            @AuthenticationPrincipal String userId,
            @PathVariable Long id
    ) {
        deleteRecruitBoardUseCase.deleteRecruitBoard(getCenterId(), id);
        return ApiResponse.ok("봉사 활동 모집글 삭제 성공");
    }


    private static UUID getCenterId() {
        return UUID.fromString(SecurityContextHolder.getContext().getAuthentication().getName());
    }

원래는 아래처럼 @AuthenticationPrincipal String userId에 담긴 userId로 기관 아이디 넘겨줄려고 했는데

UUID centerId = UUID.fromString(userId)
deleteRecruitBoardUseCase.deleteRecruitBoard(centerId , id);

테스트 단에서는 받아오질 못해서 임시로 위 코드로 기관 아이디 받아왔습니다. 나중에 실제로 잘 받아와지면 바로 위 코드로 바꿀 예정입니다.

  1. 추가로 기존에 ImageUploadUseCase 는 이미지 파일이 비어있으면 에러를 던졌는데 이를 환경변수로 정의한 기본 이미지 링크로 바꾸는 작업 진행했습니다.

  2. 봉사 모집글 생성시, 수정시 multi-part로 이미지와 dto를 받아야 하는데 에러가 발생해서 컨버터 클래스 추가했습니다.

✅ PR 포인트 & 궁금한 점


default:
image:
url: ${DEFAULT_IMG_URL}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

환경변수 공유 부탁드립니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

디스코드에 남겨드리겠습니다

@sonarqubecloud
Copy link

@leebs0521 leebs0521 force-pushed the feature/81-add-recurit-board-cud-controller branch from e5b3405 to e50c176 Compare November 30, 2024 10:44
@github-actions github-actions bot changed the title Feature/81 봉사 모집글 생성, 수정, 삭제 컨트롤러 생성 [BUILD FAIL] Feature/81 봉사 모집글 생성, 수정, 삭제 컨트롤러 생성 Nov 30, 2024
@github-actions github-actions bot closed this Nov 30, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

빌드에 실패했습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] 봉사 모집글 생성, 수정, 삭제 컨트롤러 생성

3 participants