-
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
merge :: Points API #124
merge :: Points API #124
Conversation
import Moya | ||
|
||
public enum PointsAPI { | ||
case fetchPointsList(String) |
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.
type 이거 enum으로 만들어서 쓰는거 어때유
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.
enum을 만들어놓고 안쓰고 있어요
public enum PointsType: String { | ||
case all = "ALL" | ||
case bonus = "BONUS" | ||
case minus = "MINUS" | ||
} |
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.
DataMapping 안에 넣는거 어때요?
import Moya | ||
|
||
public enum PointsAPI { | ||
case fetchPointsList(String) |
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.
enum을 만들어놓고 안쓰고 있어요
public struct SinglePointResponseDTO: Decodable { | ||
public init(id: String, date: Date, type: String, name: String, score: Int) { | ||
self.id = id | ||
self.date = date | ||
self.type = type | ||
self.name = name | ||
self.score = score | ||
} | ||
|
||
public let id: String | ||
public let date: Date | ||
public let type: String | ||
public let name: String | ||
public let score: Int | ||
} |
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.
id가 key 이름이랑 달라요 CodingKeys가 있는거도 아닌데
} | ||
|
||
public let id: String | ||
public let date: 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.
Date타입이 자동으로 Decode될지 모르겠는데 String으로 받고 Entity로 변환할때 String을 Date로 변환하는게 더 좋을거같아요
public init(schoolName: String, | ||
name: String, | ||
gcn: String, | ||
profileImageURL: URL, | ||
bonusPoint: Int, | ||
minusPoint: Int, | ||
phrase: String) { | ||
self.schoolName = schoolName |
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.
혼돈의 init 스타일..
public struct PointEntity: Equatable, Hashable { | ||
public init(id: String, | ||
date: Date, | ||
type: String, | ||
name: String, | ||
score: Int) { | ||
self.id = id | ||
self.date = date | ||
self.type = type | ||
self.name = name | ||
self.score = score | ||
} | ||
|
||
public let id: String | ||
public let date: Date | ||
public let type: String | ||
public let name: String | ||
public let score: Int |
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.
엔티티가 좀 다른거 같기도 하고요..?
import Foundation | ||
|
||
public struct SinglePointResponseDTO: Decodable { | ||
public init(id: String, date: Date, type: String, name: String, score: Int) { |
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.
LINT 지켜주세요
public init(id: String, | ||
date: Date, | ||
type: String, | ||
name: String, | ||
score: Int) { |
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.
이것도 Lint 지켜주세요
|
||
public var task: Moya.Task { | ||
switch self { | ||
case .fetchPointsList(let type): |
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.
스타일 가이드 맞춰주세요!
@@ -4,6 +4,7 @@ public struct FetchMyProfileResponseDTO: Decodable { | |||
public let schoolName: String | |||
public let name: String | |||
public let gcn: String | |||
public let profileImageURL: URL |
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.
url을 decode로 넣으려면 직접 decode를 구현해줘야하는거로 아는데, dto에서 String으로 받고 Entity에서 URL?로 받는방법 어떠신가요?
옵셔널인 이유는 사이드 이펙트를 ViewModel에서 처리하기 위함입니다 🤖
개요
Points API
작업사항
Points API