diff --git a/src/main/java/the_monitor/application/serviceImpl/ReportServiceImpl.java b/src/main/java/the_monitor/application/serviceImpl/ReportServiceImpl.java index cbcfd06..2ce4873 100644 --- a/src/main/java/the_monitor/application/serviceImpl/ReportServiceImpl.java +++ b/src/main/java/the_monitor/application/serviceImpl/ReportServiceImpl.java @@ -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 "보고서 기사 추가 완료"; @@ -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(); + } + } diff --git a/src/main/java/the_monitor/domain/model/ReportCategory.java b/src/main/java/the_monitor/domain/model/ReportCategory.java index 2852555..7011bc7 100644 --- a/src/main/java/the_monitor/domain/model/ReportCategory.java +++ b/src/main/java/the_monitor/domain/model/ReportCategory.java @@ -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; @@ -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; }