Skip to content

Commit

Permalink
Merge pull request #138 from dnd-side-project/feature/#134
Browse files Browse the repository at this point in the history
Add resource and createdAt �to words/{id} return value
  • Loading branch information
miraexhoi authored Sep 19, 2024
2 parents 429dc70 + 82f99c6 commit 7ae7359
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
package com.dnd.spaced.domain.admin.application.dto.request;

import com.dnd.spaced.domain.word.domain.Pronunciation;
import io.swagger.v3.oas.annotations.media.Schema;

public record AdminWordRequestDto(
@Schema(description = "등록할 용어 이름")
String name,

@Schema(description = "등록할 용어 뜻")
String meaning,

@Schema(description = "등록할 용어 발음")
Pronunciation pronunciation,

@Schema(description = "등록할 용어의 카테고리")
String category,
String example

@Schema(description = "등록할 용어 예문")
String example,

@Schema(description = "등록할 용어 출처")
String resource
) {}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public record DetailWordInfoDto(
String example,
boolean isMarked,
LocalDateTime createdAt,
LocalDateTime updatedAt
LocalDateTime updatedAt,
String resource
) {

public static DetailWordInfoDto from(WordInfoWithBookmarkDto dto) {
Expand All @@ -32,7 +33,8 @@ public static DetailWordInfoDto from(WordInfoWithBookmarkDto dto) {
dto.example(),
dto.bookmarkId() != null,
dto.createdAt(),
dto.updatedAt()
dto.updatedAt(),
dto.resource()
);
}

Expand All @@ -49,7 +51,8 @@ public static DetailWordInfoDto from(Word word) {
word.getExample(),
false,
word.getCreatedAt(),
word.getUpdatedAt()
word.getUpdatedAt(),
word.getResource()
);
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/dnd/spaced/domain/word/domain/Word.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class Word extends BaseTimeEntity {

private int commentCount = 0;

private String resource;

@Builder
private Word(
String name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public record WordInfoWithBookmarkDto(
int bookmarkCount,
Long bookmarkId,
LocalDateTime createdAt,
LocalDateTime updatedAt
LocalDateTime updatedAt,
String resource
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.dnd.spaced.domain.word.application.dto.response.DetailWordInfoDto;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDateTime;

public record DetailWordInfoResponse(

@Schema(description = "용어 ID")
Expand Down Expand Up @@ -33,7 +35,14 @@ public record DetailWordInfoResponse(
int bookmarkCount,

@Schema(description = "북마크 여부")
boolean isMarked
boolean isMarked,

@Schema(description = "용어 등록일")
LocalDateTime createdAt,

@Schema(description = "출처")
String resource

) {

private record PronunciationInfoResponse(@Schema(description = "용어 영어 발음 기호") String english) {
Expand All @@ -50,7 +59,9 @@ public static DetailWordInfoResponse from(DetailWordInfoDto dto) {
dto.viewCount(),
dto.commentCount(),
dto.bookmarkCount(),
dto.isMarked()
dto.isMarked(),
dto.createdAt(),
dto.resource()
);
}
}

0 comments on commit 7ae7359

Please sign in to comment.