-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor/66 utc migration #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
4532739
0ed2a52
3f30d8e
af0a519
cb90de4
228c354
241e284
a91684f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| package zim.tave.memory.dto.response; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import zim.tave.memory.domain.Board; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.time.format.DateTimeFormatter; | ||
| import java.time.OffsetDateTime; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
|
|
@@ -24,21 +24,21 @@ public class BoardCreateResponseDto { | |
| @Schema(description = "보λ ν λ§ ID", example = "3") | ||
| private Long boardThemeId; | ||
|
|
||
| @Schema(description = "보λ μμ± μκ°", example = "2025-12-01T14:20:00") | ||
| private String createdAt; | ||
| @Schema(description = "보λ μμ± μκ° (UTC κΈ°μ€, ISO-8601 νμ). νλ‘ νΈμλμμλ μ¬μ©μμ λ‘컬 νμμ‘΄μΌλ‘ λ³ννμ¬ νμν΄μΌ ν©λλ€.", example = "2025-12-01T14:20:00.000Z") | ||
| @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX") | ||
|
||
| private OffsetDateTime createdAt; | ||
|
|
||
| @Schema(description = "보λ μ΅μ’ μμ μκ°", example = "2025-12-01T14:20:00") | ||
| private String updatedAt; | ||
| @Schema(description = "보λ μ΅μ’ μμ μκ° (UTC κΈ°μ€, ISO-8601 νμ). νλ‘ νΈμλμμλ μ¬μ©μμ λ‘컬 νμμ‘΄μΌλ‘ λ³ννμ¬ νμν΄μΌ ν©λλ€.", example = "2025-12-01T14:20:00.000Z") | ||
| @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX") | ||
| private OffsetDateTime updatedAt; | ||
|
|
||
| public static BoardCreateResponseDto from(Board board) { | ||
| DateTimeFormatter fmt = DateTimeFormatter.ISO_LOCAL_DATE_TIME; | ||
|
|
||
| return new BoardCreateResponseDto( | ||
| board.getBoardId(), | ||
| board.getTitle(), | ||
| board.getBoardTheme().getBoardThemeId(), | ||
| board.getCreatedAt().format(fmt), | ||
| board.getUpdatedAt().format(fmt) | ||
| board.getCreatedAt(), | ||
| board.getUpdatedAt() | ||
| ); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OffsetDateTimeμ μ¬μ©νλ λλ©μΈμ 곡ν΅μ μΌλ‘ μ μ©λλ 리뷰μ λλ€.
MySQLμ DATETIME / TIMESTAMPλ offset μ 보λ₯Ό μ μ₯νμ§ μμμ λ²μ μ λ°λΌ
λ±μ λ¬Έμ κ° λ°μν μ μλ€κ³ ν©λλ€.
μ½νμΌλΏμ΄ μλμ κ°μ΄ μ μν΄μ£Όμλλ° OffsetDateTimeAttributeConverter νμΌ μΆκ°λ₯Ό κ³ λ €ν΄λ³΄λ κ²λ μ’μ κ² κ°μμ!
κΆμ₯ μμ (κ°μ₯ μμ ν λ°©λ²)
π JPA AttributeConverter μΆκ° (DB λ³κ²½ μμ΄ ν΄κ²°)
μ νμΌ μΆκ°
src/main/java/zim/tave/memory/config/OffsetDateTimeAttributeConverter.java