Skip to content

Commit

Permalink
feat: infoPost의 신고여부 필드 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
kikingki committed Dec 4, 2024
1 parent 63432f9 commit 4b40b77
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ public enum ErrorCode {
IMAGE_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 id의 이미지가 존재하지 않습니다."),
NON_EXISTENT_CATEGORY_ID(HttpStatus.NOT_FOUND, "해당 id의 카테고리가 존재하지 않습니다."),
NON_EXISTENT_INFO_POST_ID(HttpStatus.NOT_FOUND, "해당 id의 공고 게시글이 존재하지 않습니다."),
REPORTED_INFO_POST_ID(HttpStatus.NOT_FOUND, "해당 id의 게시글은 신고 처리되었습니다."),

// 409
ALREADY_REPORTED_POST(HttpStatus.CONFLICT, "이미 신고한 공고입니다."),

// 500
IO_EXCEPTION(HttpStatus.INTERNAL_SERVER_ERROR, "파일 입출력 에러"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.dissonance.itit.global.common.annotation.CurrentUser;
import com.dissonance.itit.global.common.util.ApiResponse;
import com.dissonance.itit.post.dto.response.InfoPostDetailRes;
import com.dissonance.itit.post.dto.response.InfoPostRes;
import com.dissonance.itit.post.service.InfoPostService;
import com.dissonance.itit.post.service.ReportService;
import com.dissonance.itit.user.domain.User;

import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
Expand All @@ -25,7 +21,6 @@
@RequestMapping("/info-posts")
public class InfoPostController {
private final InfoPostService infoPostService;
private final ReportService reportService;

@GetMapping("/{infoPostId}")
@Operation(summary = "공고 게시글 조회", description = "공고 게시글을 상세 조회합니다.")
Expand All @@ -34,13 +29,6 @@ public ApiResponse<InfoPostDetailRes> getInfoPostDetail(@PathVariable Long infoP
return ApiResponse.success(infoPostDetailRes);
}

@PatchMapping("/{infoPostId}/reports")
@Operation(summary = "공고 게시글 신고", description = "공고 게시글을 신고 처리합니다.")
public ApiResponse<String> reportedInfoPost(@PathVariable Long infoPostId, @CurrentUser User loginUser) {
Long resultId = reportService.reportedInfoPost(infoPostId, loginUser);
return ApiResponse.success(resultId + "번 게시글의 신고가 성공적으로 접수되었습니다.");
}

@GetMapping("/categories/{categoryId}/posts")
@Operation(summary = "공고 게시글 목록 조회", description = "카테고리별 공고 게시글 목록을 조회합니다. (정렬: 최신순 - latest, 마감일순 - deadline)")
public ApiResponse<Page<InfoPostRes>> getInfoPostsByCategory(@PathVariable Integer categoryId, Pageable pageable) {
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/com/dissonance/itit/post/domain/InfoPost.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import com.dissonance.itit.global.common.entity.BaseTime;
import com.dissonance.itit.image.domain.Image;
import com.dissonance.itit.user.domain.User;
import com.dissonance.itit.post.dto.request.InfoPostUpdateReq;
import com.dissonance.itit.user.domain.User;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
Expand Down Expand Up @@ -75,9 +75,6 @@ public class InfoPost extends BaseTime {
@Column(name = "organization")
private String organization;

@Column(name = "reported")
private Boolean reported;

@Column(name = "recruitment_closed")
private Boolean recruitmentClosed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public InfoPost toEntity(Image image, User author, Category category) {
.activityStartDate(stringToDate(activityStartDate()))
.activityEndDate(stringToDate(activityEndDate()))
.detailUrl(detailUrl())
.reported(false)
.recruitmentClosed(false)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public static class InfoPostInfo {
private String content;
private String detailUrl;
private Integer viewCount;
private Boolean reported;
private final String imageUrl;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public InfoPostInfo findInfoPostWithDetails(Long infoPostId) {
infoPost.content.as("content"),
infoPost.detailUrl.as("detailUrl"),
infoPost.viewCount.as("viewCount"),
infoPost.reported.as("reported"),
infoPost.image.imageUrl.as("imageUrl")
))
.from(infoPost)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ public InfoPostDetailRes getInfoPostDetailById(Long infoPostId) {
throw new CustomException(ErrorCode.NON_EXISTENT_INFO_POST_ID);
}

if (infoPostInfo.getReported()) {
throw new CustomException(ErrorCode.REPORTED_INFO_POST_ID);
}

List<String> positionInfos = recruitmentPositionService.findPositionInfosByInfoPostId(infoPostId);

return InfoPostDetailRes.of(infoPostInfo, positionInfos);
Expand Down

0 comments on commit 4b40b77

Please sign in to comment.