Skip to content

Commit

Permalink
fixed: turned content into url and follwing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mirageoasis committed Jan 5, 2024
1 parent 4372a26 commit e06df75
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Retrospect extends BaseEntity {

@NotBlank private String title;

@NotBlank private String content;
@NotBlank private String url;

@NotBlank private String writer;

Expand All @@ -41,17 +41,17 @@ public class Retrospect extends BaseEntity {
private Part part;

@Builder
public Retrospect(String title, String content, String writer, Integer generation, Part part) {
public Retrospect(String title, String url, String writer, Integer generation, Part part) {
this.title = title;
this.content = content;
this.url = url;
this.writer = writer;
this.generation = generation;
this.part = part;
}

public void update(CreateRetrospectRequest createRetrospectRequest) {
title = createRetrospectRequest.getTitle();
content = createRetrospectRequest.getContent();
url = createRetrospectRequest.getUrl();
writer = createRetrospectRequest.getWriter();
generation = createRetrospectRequest.getGeneration();
part = createRetrospectRequest.getPart();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public class CreateRetrospectRequest {
@Schema(type = "string", description = "회고 제목")
private String title;

@NotBlank(message = "회고 내용을 입력해주세요")
@NotBlank(message = "회고 내용이 담긴 url을 입력해주세요")
@Schema(type = "string", description = "회고 내용")
private String content;
private String url;

@NotBlank(message = "작성자를 입력해주세요")
@Schema(type = "string", description = "회고 제목")
Expand All @@ -35,7 +35,7 @@ public class CreateRetrospectRequest {
public Retrospect toEntity() {
return Retrospect.builder()
.title(title)
.content(content)
.url(url)
.writer(writer)
.generation(generation)
.part(part)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public class UpdateRetrospectRequest {
@Schema(type = "string", description = "회고 제목")
private String title;

@NotBlank(message = "회고 내용을 입력해주세요")
@NotBlank(message = "회고 내용이 담긴 url을 입력해주세요")
@Schema(type = "string", description = "회고 내용")
private String content;
private String url;

@NotBlank(message = "작성자를 입력해주세요")
@Schema(type = "string", description = "회고 제목")
Expand All @@ -33,7 +33,7 @@ public class UpdateRetrospectRequest {
public Retrospect toEntity() {
return Retrospect.builder()
.title(title)
.content(content)
.url(url)
.writer(writer)
.generation(generation)
.part(part)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
public class GetRetrospectResponse {
private Long id;
private String title;
private String content;
private String url;
private String writer;

public static GetRetrospectResponse fromEntity(Retrospect retrospect) {
GetRetrospectResponse getRetrospectResponse = new GetRetrospectResponse();

getRetrospectResponse.setId(retrospect.getId());
getRetrospectResponse.setTitle(retrospect.getTitle());
getRetrospectResponse.setContent(retrospect.getContent());
getRetrospectResponse.setUrl(retrospect.getUrl());
getRetrospectResponse.setWriter(retrospect.getWriter());

return getRetrospectResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
public class GetRetrospectsElement {
private Long id;
private String title;
private String url;
private String writer;
private Integer generation;

public static GetRetrospectsElement fromEntity(Retrospect retrospect) {
return new GetRetrospectsElement(
retrospect.getId(),
retrospect.getTitle(),
retrospect.getUrl(),
retrospect.getWriter(),
retrospect.getGeneration());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public GetRetrospectsResponse getRetrospects(Integer pageNum, Integer limit) {
public GetRetrospectResponse updateRetrospect(
Long id, CreateRetrospectRequest createRetrospectRequest) {
Retrospect retrospect =
retrospectRepository.findById(id).orElseThrow(() -> new RetrospectNotFound());
retrospectRepository.findById(id).orElseThrow(RetrospectNotFound::new);

retrospect.update(createRetrospectRequest);

Expand All @@ -52,7 +52,7 @@ public GetRetrospectResponse updateRetrospect(
@Transactional
public void deleteRetrospect(Long id) {
Retrospect retrospect =
retrospectRepository.findById(id).orElseThrow(() -> new RetrospectNotFound());
retrospectRepository.findById(id).orElseThrow(RetrospectNotFound::new);

retrospectRepository.delete(retrospect);
}
Expand All @@ -61,7 +61,7 @@ public void deleteRetrospect(Long id) {
@Transactional(readOnly = true)
public GetRetrospectResponse getRetrospect(Long id) {
Retrospect retrospect =
retrospectRepository.findById(id).orElseThrow(() -> new RetrospectNotFound());
retrospectRepository.findById(id).orElseThrow(RetrospectNotFound::new);

return GetRetrospectResponse.fromEntity(retrospect);
}
Expand Down

0 comments on commit e06df75

Please sign in to comment.