Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ public class ProblemSet extends BaseEntity {

@Embedded
private Title title;
@Column(nullable = false)
private boolean isDeleted;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private ProblemSetConfirmStatus confirmStatus;

@ElementCollection
@CollectionTable(name = "problem_set_problems", joinColumns = @JoinColumn(name = "problem_set_id"))
@Column(name = "problem_id")
@OrderColumn(name = "sequence")
@Column(name = "problem_id", nullable = false)
private List<Long> problemIds = new ArrayList<>();

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
@Getter
@NoArgsConstructor
public class ProblemThumbnailResponse {
private String problemTitle;
private String problemMemo;
private String mainProblemImageUrl;

public ProblemThumbnailResponse(String mainProblemImageUrl) {
public ProblemThumbnailResponse(String problemTitle, String problemMemo, String mainProblemImageUrl) {
this.problemTitle = problemTitle;
this.problemMemo = problemMemo;
this.mainProblemImageUrl = mainProblemImageUrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public List<ProblemSetSearchGetResponse> search(String problemSetTitle, String p
publish.publishedDate, // 발행되지 않은 경우 null 반환
GroupBy.list(
Projections.constructor(ProblemThumbnailResponse.class,
problem.title.title,
problem.memo,
problem.mainProblemImageUrl
)
)
Expand Down Expand Up @@ -70,6 +72,8 @@ public List<ProblemSetSearchGetResponse> confirmSearch(String problemSetTitle, S
publish.publishedDate, // 발행되지 않은 경우 null 반환
GroupBy.list(
Projections.constructor(ProblemThumbnailResponse.class,
problem.title.title,
problem.memo,
problem.mainProblemImageUrl
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.moplus.moplus_server.domain.publish.service.PublishSaveService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -40,7 +41,7 @@ public ResponseEntity<List<PublishMonthGetResponse>> getPublishMonth(
@PostMapping("")
@Operation(summary = "발행 생성하기", description = "특정 날짜에 문항세트를 발행합니다.")
public ResponseEntity<Long> postPublish(
@RequestBody PublishPostRequest request
@Valid @RequestBody PublishPostRequest request
) {
return ResponseEntity.ok(publishSaveService.createPublish(request));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.moplus.moplus_server.domain.publish.dto.request;

import com.moplus.moplus_server.domain.publish.domain.Publish;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;

public record PublishPostRequest(
@NotNull
LocalDate publishedDate,
@NotNull
Long problemSetId
) {
public Publish toEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ public class ProblemSetSearchRepositoryCustomTest {
List<ProblemThumbnailResponse> problems = response.getProblemThumbnailResponses();
assertThat(problems).hasSize(2);

// ✅ 문항의 이미지 URL이 올바르게 매핑되었는지 확인
// ✅ 문항의 타이틀, 메모, 이미지 URL이 올바르게 매핑되었는지 확인
assertThat(problems.get(0).getProblemTitle()).isEqualTo("제목1");
assertThat(problems.get(0).getProblemMemo()).isEqualTo("기존 문제 설명 1");
assertThat(problems.get(0).getMainProblemImageUrl()).isEqualTo("mainProblem.png1");

assertThat(problems.get(1).getProblemTitle()).isEqualTo("제목2");
assertThat(problems.get(1).getProblemMemo()).isEqualTo("기존 문제 설명 2");
assertThat(problems.get(1).getMainProblemImageUrl()).isEqualTo("mainProblem.png2");
}

Expand Down