fix(creator): 채널 홈 응답 모델을 맞춘다

This commit is contained in:
Yu Sung
2026-07-02 18:31:05 +09:00
parent cd55b3e2f5
commit 1a7368d2a4
2 changed files with 32 additions and 29 deletions

View File

@@ -33,6 +33,10 @@ final class CreatorChannelViewModel: ObservableObject {
guard let self else { return } guard let self else { return }
do { do {
if let jsonString = String(data: response.data, encoding: .utf8) {
DEBUG_LOG("CreatorChannelHome raw response: \(jsonString)")
}
let jsonDecoder = JSONDecoder() let jsonDecoder = JSONDecoder()
let decoded = try jsonDecoder.decode(ApiResponse<CreatorChannelHomeResponse>.self, from: response.data) let decoded = try jsonDecoder.decode(ApiResponse<CreatorChannelHomeResponse>.self, from: response.data)
@@ -48,6 +52,7 @@ final class CreatorChannelViewModel: ObservableObject {
} }
} catch { } catch {
ERROR_LOG(error.localizedDescription) ERROR_LOG(error.localizedDescription)
print(error)
self.applyApiFailedPlaceholderState() self.applyApiFailedPlaceholderState()
} }

View File

@@ -18,14 +18,14 @@ struct CreatorChannelHomeResponse: Decodable {
struct CreatorChannelCreatorResponse: Decodable, Identifiable { struct CreatorChannelCreatorResponse: Decodable, Identifiable {
let creatorId: Int let creatorId: Int
let nickname: String
let profileImageUrl: String?
let followerCount: Int
let characterId: Int? let characterId: Int?
var isFollow: Bool let nickname: String
var isNotify: Bool let profileImageUrl: String
let followerCount: Int
let isAiChatAvailable: Bool let isAiChatAvailable: Bool
let isDmAvailable: Bool let isDmAvailable: Bool
var isFollow: Bool
var isNotify: Bool
var id: Int { creatorId } var id: Int { creatorId }
} }
@@ -44,43 +44,39 @@ struct CreatorChannelLiveResponse: Decodable, Identifiable {
struct CreatorChannelAudioContentResponse: Decodable, Identifiable { struct CreatorChannelAudioContentResponse: Decodable, Identifiable {
let audioContentId: Int let audioContentId: Int
let title: String let title: String
let duration: Int let duration: String?
let imageUrl: String? let imageUrl: String?
let price: Int let price: Int
let isAdult: Bool let isAdult: Bool
let isPointAvailable: Bool let isPointAvailable: Bool
let isFirstContent: Bool let isFirstContent: Bool
let seriesName: String? let seriesName: String?
let isOriginalSeries: Bool let isOriginalSeries: Bool?
let isOwned: Bool
let isRented: Bool
var id: Int { audioContentId } var id: Int { audioContentId }
} }
struct CreatorChannelDonationResponse: Decodable, Identifiable { struct CreatorChannelDonationResponse: Decodable {
let donationId: Int
let nickname: String let nickname: String
let profileImageUrl: String? let profileImageUrl: String
let can: Int let can: Int
let message: String let message: String
let createdAtUtc: String let createdAtUtc: String
var id: Int { donationId }
} }
struct CreatorChannelScheduleResponse: Decodable, Identifiable { struct CreatorChannelScheduleResponse: Decodable {
let scheduleId: String
let scheduledAtUtc: String let scheduledAtUtc: String
let title: String let title: String
let type: CreatorActivityType let type: CreatorActivityType
let targetId: Int let targetId: Int
var id: String { scheduleId }
} }
struct CreatorChannelSeriesResponse: Decodable, Identifiable { struct CreatorChannelSeriesResponse: Decodable, Identifiable {
let seriesId: Int let seriesId: Int
let title: String let title: String
let coverImageUrl: String? let coverImageUrl: String
let numberOfContent: Int let numberOfContent: Int
let isNew: Bool let isNew: Bool
let isOriginal: Bool let isOriginal: Bool
@@ -92,15 +88,16 @@ struct CreatorChannelCommunityPostResponse: Decodable, Identifiable {
let postId: Int let postId: Int
let creatorId: Int let creatorId: Int
let creatorNickname: String let creatorNickname: String
let creatorProfileImageUrl: String? let creatorProfileUrl: String
let content: String
let imageUrl: String? let imageUrl: String?
let audioUrl: String? let audioUrl: String?
let content: String
let price: Int let price: Int
let dateUtc: String
let existOrdered: Bool let existOrdered: Bool
let likeCount: Int let likeCount: Int
let commentCount: Int let commentCount: Int
let createdAtUtc: String let isLiked: Bool
var id: Int { postId } var id: Int { postId }
} }
@@ -112,18 +109,19 @@ struct CreatorChannelFanTalkSummaryResponse: Decodable {
struct CreatorChannelFanTalkResponse: Decodable, Identifiable { struct CreatorChannelFanTalkResponse: Decodable, Identifiable {
let fanTalkId: Int let fanTalkId: Int
let memberId: Int
let nickname: String let nickname: String
let profileImageUrl: String? let profileImageUrl: String
let content: String let content: String
let languageCode: String let languageCode: String?
let createdAtUtc: String let createdAtUtc: String
var id: Int { fanTalkId } var id: Int { fanTalkId }
} }
struct CreatorChannelActivityResponse: Decodable { struct CreatorChannelActivityResponse: Decodable {
let debutDateUtc: String let debutDateUtc: String?
let dDay: Int let dday: String
let liveCount: Int let liveCount: Int
let liveDurationHours: Int let liveDurationHours: Int
let liveContributorCount: Int let liveContributorCount: Int
@@ -132,9 +130,9 @@ struct CreatorChannelActivityResponse: Decodable {
} }
struct CreatorChannelSnsResponse: Decodable { struct CreatorChannelSnsResponse: Decodable {
let instagramUrl: String? let instagramUrl: String
let youtubeUrl: String? let fancimmUrl: String
let xUrl: String? let xurl: String
let kakaoOpenChatUrl: String? let youtubeUrl: String
let fancimmUrl: String? let kakaoOpenChatUrl: String
} }