-
Notifications
You must be signed in to change notification settings - Fork 0
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
피드리스트를 받기 위한 UseCase, Entities,Repository를 정의했습니다. #4
Changes from 1 commit
a99e1b0
52c981f
5fcb880
e9d4af2
56c5ae6
8afc27b
d86703c
628e0b7
a7e58be
bf60bc6
84df58b
506be99
8acf4c6
66312f1
e9763e8
b7981cc
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// RecipeDTO.swift | ||
// HomeCafeRecipes | ||
// | ||
// Created by 김건호 on 6/10/24. | ||
// | ||
|
||
import Foundation | ||
|
||
struct RecipesResponseDTO: Decodable { | ||
let statusCode: Int | ||
let message: String | ||
let data: [RecipeDTO] | ||
} | ||
|
||
struct RecipeDTO: Decodable { | ||
let recipeId: Int | ||
let recipeType: String | ||
let recipeName: String | ||
let recipeDescription: String | ||
let recipeLikesCnt: Int | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 단순 의견) 전부 prefix로 recipe가 붙어있네요. Recipe DTO라서 불필요하지 않을까 싶은데 검토 부탁드릴게요. 필수) Id는 ID 로 작성 부탁드려요. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 56c5ae6 |
||
let createdAt: String | ||
let writer: UserDTO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. userDTO는 따로 파일을 분리하는게 어떠신가요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. userDTO는 따로 분리 시켜 두었습니다! |
||
let recipeImgUrls: [RecipeImageDTO] | ||
} | ||
|
||
struct RecipeImageDTO: Decodable { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이미지DTO도 따로 분리되면 다른 곳에서 image를 내려 받을 때 재사용할 수 있을 것 같아요. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 56c5ae6 |
||
let recipeImgId: Int | ||
let recipeImgUrl: String | ||
} | ||
|
||
extension RecipeDTO { | ||
func toDomain() -> Recipe { | ||
return Recipe( | ||
id: recipeId, | ||
type: RecipeType(rawValue: recipeType) ?? .dessert, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. type의 기본값이 dessert인가요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 56c5ae6 |
||
name: recipeName, | ||
description: recipeDescription, | ||
writer: writer.toDomain(), | ||
imageUrls: recipeImgUrls.map { $0.recipeImgUrl }, | ||
isLiked: false, | ||
likeCount: recipeLikesCnt, | ||
createdAt: DateFormatter.iso8601.date(from: createdAt) ?? Date() | ||
) | ||
} | ||
} | ||
|
||
|
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.
이건 공통적으로 네트워킹에 사용하는 DTO 인 것 같은데, 네트워크 레이어에서 따로 관리하는건 어때요?
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.
8afc27b
따로 분리 시켜두었습니다