Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
L-U-Ready committed Nov 26, 2024
2 parents 354ae95 + 4a5dda9 commit 902ef84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public String updateReportArticle(Long clientId, Long reportId, ReportArticleUpd
Report report = findByClientIdAndReportId(clientId, reportId);
validIsAccountAuthorizedForReport(getAccountFromId(getAccountId()), report);

// ReportCategory reportCategory = findReportCategoryById(reportId, request.getReportCategoryId());
ReportCategory reportCategory = setDefaultCategory(report);

// reportArticleRepository.save(request.toEntity(reportCategory));
reportArticleRepository.save(request.toEntity(reportCategory));

return "보고서 기사 추가 완료";

Expand Down Expand Up @@ -391,4 +391,14 @@ private ReportCategoryListResponse buildCategoryListResponse(ReportCategory cate
.build();
}

private ReportCategory setDefaultCategory(Report report) {
return ReportCategory.builder()
.categoryType(CategoryType.SELF)
.name("default")
.description("기본 카테고리입니다.")
.report(report)
.isDefault(true)
.build();
}

}
7 changes: 6 additions & 1 deletion src/main/java/the_monitor/domain/model/ReportCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class ReportCategory extends BaseTimeEntity {
@Column(name = "report_category_description", nullable = true)
private String description;

@Column(name = "report_category_is_default")
private boolean isDefault;

@ManyToOne
@JoinColumn(name = "report_id", nullable = false)
private Report report;
Expand All @@ -43,13 +46,15 @@ public ReportCategory(CategoryType categoryType,
String name,
String description,
Report report,
List<ReportArticle> reportArticles) {
List<ReportArticle> reportArticles,
boolean isDefault) {

this.categoryType = categoryType;
this.name = name;
this.description = description;
this.report = report;
this.reportArticles = reportArticles;
this.isDefault = isDefault;

}

Expand Down

0 comments on commit 902ef84

Please sign in to comment.