-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into refactor/#127
- Loading branch information
Showing
16 changed files
with
202 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
src/main/java/com/sponus/sponusbe/domain/report/dto/AttachmentResponse.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
src/main/java/com/sponus/sponusbe/domain/report/dto/ReportAttachmentResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.sponus.sponusbe.domain.report.dto; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ReportAttachmentResponse( | ||
Long id, | ||
String name, | ||
String url | ||
) { | ||
} | ||
|
14 changes: 5 additions & 9 deletions
14
...usbe/domain/report/dto/ReportRequest.java → ...omain/report/dto/ReportCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/com/sponus/sponusbe/domain/report/dto/ReportCreateResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.sponus.sponusbe.domain.report.dto; | ||
|
||
import com.sponus.sponusbe.domain.report.entity.Report; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ReportCreateResponse( | ||
Long id, | ||
Long writerId, | ||
String title, | ||
String content | ||
) { | ||
|
||
public static ReportCreateResponse from(Report report) { | ||
return ReportCreateResponse.builder() | ||
.id(report.getId()) | ||
.writerId(report.getWriter().getId()) | ||
.title(report.getTitle()) | ||
.content(report.getContent()) | ||
.build(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/sponus/sponusbe/domain/report/dto/ReportImageResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.sponus.sponusbe.domain.report.dto; | ||
|
||
import com.sponus.sponusbe.domain.report.entity.ReportImage; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ReportImageResponse( | ||
Long id, | ||
String name, | ||
String url | ||
) { | ||
|
||
public static ReportImageResponse from(ReportImage image) { | ||
return ReportImageResponse.builder() | ||
.id(image.getId()) | ||
.name(image.getName()) | ||
.url(image.getUrl()) | ||
.build(); | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
src/main/java/com/sponus/sponusbe/domain/report/dto/ReportResponse.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/com/sponus/sponusbe/domain/report/entity/ReportImage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.sponus.sponusbe.domain.report.entity; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.ConstraintMode; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.ForeignKey; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
@Entity | ||
@Table(name = "report_image") | ||
public class ReportImage { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "image_id") | ||
private Long id; | ||
|
||
@Column(name = "image_name", nullable = false) | ||
private String name; | ||
|
||
@Column(name = "image_url", nullable = false) | ||
private String url; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY, optional = false) | ||
@JoinColumn(name = "report_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) | ||
private Report report; | ||
|
||
public void setReport(Report report) { | ||
if (this.report != null) { | ||
this.report.getReportImages().remove(this); | ||
} | ||
this.report = report; | ||
report.getReportImages().add(this); | ||
} | ||
} |
Oops, something went wrong.