Skip to content

Commit

Permalink
[BYOB-224] Note 도메인 API 응답 시 createdAt/updatedAt 누락된 문제 해결 (#71)
Browse files Browse the repository at this point in the history
* fix: Note 도메인 API 응답 시 createdAt/updatedAt 누락된 문제 해결
  • Loading branch information
y-ngm-n authored Oct 24, 2024
1 parent 7826843 commit a8dda44
Showing 4 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -5,13 +5,17 @@
import team_alcoholic.jumo_server.v1.liquor.dto.LiquorRes;
import team_alcoholic.jumo_server.v2.user.dto.UserRes;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Getter @Setter
public abstract class NoteRes {

private Long id;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;

private UserRes user;
private LiquorRes liquor;
private List<NoteImageRes> noteImages = new ArrayList<>();
Original file line number Diff line number Diff line change
@@ -21,18 +21,21 @@ public class PurchaseNoteRes extends NoteRes {

public static PurchaseNoteRes from(PurchaseNote note) {
PurchaseNoteRes purchaseNoteRes = new PurchaseNoteRes();

purchaseNoteRes.setId(note.getId());
purchaseNoteRes.setCreatedAt(note.getCreatedAt());
purchaseNoteRes.setUpdatedAt(note.getUpdatedAt());
purchaseNoteRes.setUser(UserRes.from(note.getUser()));
purchaseNoteRes.setLiquor(LiquorRes.from(note.getLiquor()));
for (NoteImage noteImage : note.getNoteImages()) {
purchaseNoteRes.getNoteImages().add(NoteImageRes.from(noteImage));
}

purchaseNoteRes.setPurchaseAt(note.getPurchaseAt());
purchaseNoteRes.setPlace(note.getPlace());
purchaseNoteRes.setPrice(note.getPrice());
purchaseNoteRes.setVolume(note.getVolume());
purchaseNoteRes.setContent(note.getContent());

return purchaseNoteRes;
}
}
Original file line number Diff line number Diff line change
@@ -30,13 +30,15 @@ public class TastingNoteRes extends NoteRes{

public static TastingNoteRes from(TastingNote note) {
TastingNoteRes tastingNoteRes = new TastingNoteRes();

tastingNoteRes.setId(note.getId());
tastingNoteRes.setCreatedAt(note.getCreatedAt());
tastingNoteRes.setUpdatedAt(note.getUpdatedAt());
tastingNoteRes.setUser(UserRes.from(note.getUser()));
tastingNoteRes.setLiquor(LiquorRes.from(note.getLiquor()));
for (NoteImage noteImage : note.getNoteImages()) {
tastingNoteRes.getNoteImages().add(NoteImageRes.from(noteImage));
}

tastingNoteRes.setTastingAt(note.getTastingAt());
tastingNoteRes.setMethod(note.getMethod());
tastingNoteRes.setPlace(note.getPlace());
@@ -49,6 +51,7 @@ public static TastingNoteRes from(TastingNote note) {
tastingNoteRes.setNose(note.getNose());
tastingNoteRes.setPalate(note.getPalate());
tastingNoteRes.setFinish(note.getFinish());

return tastingNoteRes;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/application-local.properties
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ spring.datasource.password=${DB_PASSWORD}
spring.datasource.driver-class-name=${DB_DRIVER}

# Hibernate settings
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.ddl-auto=none
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect

0 comments on commit a8dda44

Please sign in to comment.