Skip to content
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

font api 리펙토링 #65

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/main/java/com/dearnote/domain/enums/Font.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
package com.dearnote.domain.enums;

import com.dearnote.web.dto.letter.LetterResponseDTO;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum Font {
RIDIBatang, Handletting1, Handletting2, Handletting3, Handletting4, Handletting5
RIDIBatang, Handletting1, Handletting2, Handletting3, Handletting4, Handletting5;

public static LetterResponseDTO.FontResponseDTOList toFontDTOList() {
List<LetterResponseDTO.FontResponseDTO> fontList = Arrays.stream(values())
.map(Font::toFontDTO)
.collect(Collectors.toList());

return LetterResponseDTO.FontResponseDTOList.builder()
.fontList(fontList)
.build();
}

private LetterResponseDTO.FontResponseDTO toFontDTO() {
return LetterResponseDTO.FontResponseDTO.builder()
.name(this.name())
.build();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.dearnote.domain.Letter;
import com.dearnote.domain.LetterBox;
import com.dearnote.domain.Member;
import com.dearnote.domain.enums.Font;
import com.dearnote.domain.enums.LetterPaper;
import com.dearnote.domain.enums.Wax;
import com.dearnote.service.keyword.KeywordQueryService;
Expand Down Expand Up @@ -58,6 +59,15 @@ public ApiResponse<LetterResponseDTO.WaxResponseDTOList> getWaxList() {
return ApiResponse.onSuccess(Wax.toWaxDTOList());
}

@GetMapping("/font")
@Operation(summary = "글씨체 조회 API", description = "글씨체를 조회하는 API입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200", description = "OK, 성공"),
})
public ApiResponse<LetterResponseDTO.FontResponseDTOList> getFontList() {
return ApiResponse.onSuccess(Font.toFontDTOList());
}

@PostMapping("/letters")
@Operation(summary = "편지 전송 api", description = "편지를 전송하는 api입니다.")
@ApiResponses({
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/dearnote/web/dto/letter/LetterResponseDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ public static class WaxResponseDTOList { // 실링 왁스 조회 응답 DTO
private List<LetterResponseDTO.WaxResponseDTO> waxList;
}

@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public static class FontResponseDTO {
private String name;
}

@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public static class FontResponseDTOList { // 글씨체 조회 응답 DTO
private List<LetterResponseDTO.FontResponseDTO> fontList;
}

@Builder
@Getter
@NoArgsConstructor
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spring:
registration:
naver:
client-name: naver
client-id: ${NAVER_CLient_ID} # 네이버 클라이언트 ID
client-id: ${NAVER_CLIENT_ID} # 네이버 클라이언트 ID
client-secret: ${NAVER_SECRET_ID} # 네이버 클라이언트 비밀번호
redirect-uri: http://${PROD_HOST}:8080/login/oauth2/code/naver
authorization-grant-type: authorization_code
Expand Down
Loading