From 30cebe6f679bb389419dc15df8b1e5ba78207594 Mon Sep 17 00:00:00 2001 From: sozohoy Date: Wed, 2 Oct 2024 23:28:02 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EB=AA=A8=EB=8D=B8=EB=A7=81=20=EC=9E=AC=EC=A0=95=EC=9D=98(#147)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Sources/Model/Feed.swift | 71 +++------------------------- Core/Sources/Model/Follow.swift | 27 +++++++++++ Core/Sources/Model/OverView.swift | 4 ++ Core/Sources/Model/Place.swift | 11 +++-- Core/Sources/Model/PlaceInfo.swift | 22 +++++++++ Core/Sources/Model/PlaceReview.swift | 7 +++ Core/Sources/Model/User.swift | 31 +++++++++--- 7 files changed, 97 insertions(+), 76 deletions(-) diff --git a/Core/Sources/Model/Feed.swift b/Core/Sources/Model/Feed.swift index 24451c1..5f7006b 100644 --- a/Core/Sources/Model/Feed.swift +++ b/Core/Sources/Model/Feed.swift @@ -12,10 +12,11 @@ public struct Feed: Equatable { public let id: Int public let userId: Int public let location: String + public let placeInfo: PlaceInfo public let nickname: String public let description: String - public var bookmarkCount: Int public var isBookmarked: Bool + public var bookmarkCount: Int public let videoLink: String public let thumbnailLink: String public let isMine: Bool @@ -24,10 +25,11 @@ public struct Feed: Equatable { id: Int, userId: Int, location: String, + placeInfo: PlaceInfo, nickname: String, description: String, - bookmarkCount: Int, isBookmarked: Bool, + bookmarkCount: Int, videoLink: String, thumbnailLink: String, isMine: Bool @@ -35,74 +37,13 @@ public struct Feed: Equatable { self.id = id self.userId = userId self.location = location + self.placeInfo = placeInfo self.nickname = nickname self.description = description - self.bookmarkCount = bookmarkCount self.isBookmarked = isBookmarked + self.bookmarkCount = bookmarkCount self.videoLink = videoLink self.thumbnailLink = thumbnailLink self.isMine = isMine } } -// -//extension Feed { -// public static let mockdata: [Feed] = [ -// Feed( -// id: 0, -// location: "서울특별시 강남구", -// nickname: "닉네임", -// description: "0번 영상", -// bookmarkCount: 0, -// isBookmarked: true, -// videoLink: URL(string: "https://recordy-bucket.s3.ap-northeast-2.amazonaws.com/videos/IMG_81.mov")! -// ), -// Feed( -// id: 1, -// location: "서울특별시 강남구", -// nickname: "닉네임", -// description: "1번영상https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4", -// bookmarkCount: 0, -// isBookmarked: false, -// videoLink: URL(string: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/WeAreGoingOnBullrun.mp4")! -// ), -// Feed( -// id: 2, -// location: "서울특별시 강남구", -// nickname: "닉네임", -// description: "2번 영상", -// bookmarkCount: 0, -// isBookmarked: false, -// videoLink: URL(string: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4")! -// )] -// -// public static let mockdata1: [Feed] = [ -// Feed( -// id: 3, -// location: "", -// nickname: "", -// description: "", -// bookmarkCount: 0, -// isBookmarked: false, -// videoLink: URL(string: "https://assets.mixkit.co/videos/preview/mixkit-palm-tree-in-front-of-the-sun-1191-large.mp4")! -// ), -// Feed( -// id: 4, -// location: "", -// nickname: "", -// description: "", -// bookmarkCount: 0, -// isBookmarked: false, -// videoLink: URL(string: "https://assets.mixkit.co/videos/preview/mixkit-red-frog-on-a-log-1487-large.mp4")! -// ), -// Feed( -// id: 5, -// location: "", -// nickname: "", -// description: "", -// bookmarkCount: 0, -// isBookmarked: false, -// videoLink: URL(string: "https://assets.mixkit.co/videos/preview/mixkit-tree-with-yellow-flowers-1173-large.mp4")! -// ) -// ] -// -//} diff --git a/Core/Sources/Model/Follow.swift b/Core/Sources/Model/Follow.swift index e2d657d..d30db10 100644 --- a/Core/Sources/Model/Follow.swift +++ b/Core/Sources/Model/Follow.swift @@ -7,3 +7,30 @@ // import Foundation + +public struct Follow { + public let followState: FollowState + public let userId: String + public let profileImage: String + public let nickname: String + public var isFollowing: Bool + + public init( + followState: FollowState, + userId: String, + profileImage: String, + nickname: String, + isFollowing: Bool + ) { + self.followState = followState + self.userId = userId + self.profileImage = profileImage + self.nickname = nickname + self.isFollowing = isFollowing + } +} + +public enum FollowState { + case following + case follower +} diff --git a/Core/Sources/Model/OverView.swift b/Core/Sources/Model/OverView.swift index 9af6c50..a805444 100644 --- a/Core/Sources/Model/OverView.swift +++ b/Core/Sources/Model/OverView.swift @@ -7,3 +7,7 @@ // import Foundation + +struct Overview { + let places: [Place] +} diff --git a/Core/Sources/Model/Place.swift b/Core/Sources/Model/Place.swift index 9508afb..7009bc0 100644 --- a/Core/Sources/Model/Place.swift +++ b/Core/Sources/Model/Place.swift @@ -1,5 +1,5 @@ // -// Location.swift +// Place.swift // Core // // Created by 한지석 on 9/29/24. @@ -8,8 +8,11 @@ import Foundation -struct Location { - let location +struct Place { + let shortenLocation: String + let detailLocation: String let title: String - + let reviewFeeds: [String] + let placeInfoList: [PlaceInfo] + let placeReview: PlaceReview } diff --git a/Core/Sources/Model/PlaceInfo.swift b/Core/Sources/Model/PlaceInfo.swift index f4772b9..3b5a376 100644 --- a/Core/Sources/Model/PlaceInfo.swift +++ b/Core/Sources/Model/PlaceInfo.swift @@ -7,3 +7,25 @@ // import Foundation + +public struct PlaceInfo: Equatable { + let feature: PlaceFeature + let title: String + let duration: String + + public init( + feature: PlaceFeature, + title: String, + duration: String + ) { + self.feature = feature + self.title = title + self.duration = duration + } +} + +public enum PlaceFeature { + case all + case free + case closingSoon +} diff --git a/Core/Sources/Model/PlaceReview.swift b/Core/Sources/Model/PlaceReview.swift index d9212c5..2df4cc5 100644 --- a/Core/Sources/Model/PlaceReview.swift +++ b/Core/Sources/Model/PlaceReview.swift @@ -7,3 +7,10 @@ // import Foundation + +struct PlaceReview { + let author: String + let content: String + let rating: Double + let createdAt: String +} diff --git a/Core/Sources/Model/User.swift b/Core/Sources/Model/User.swift index 66164f7..9a10c09 100644 --- a/Core/Sources/Model/User.swift +++ b/Core/Sources/Model/User.swift @@ -9,26 +9,43 @@ import Foundation public struct User { + public let isMine: Bool public let id: Int public let nickname: String - public let followerCount: Int - public let followingCount: Int + public let follower: [Follow] + public let following: [Follow]? public var isFollowing: Bool public let profileImage: String + public let feeds: [Feed] + public let bookmarkedFeeds: [Feed]? + public let loginState: LoginState public init( + isMine: Bool, id: Int, nickname: String, - followerCount: Int, - followingCount: Int, + follower: [Follow], + following: [Follow]?, isFollowing: Bool, - profileImage: String + profileImage: String, + feeds: [Feed], + bookmarkedFeeds: [Feed]?, + loginState: LoginState ) { + self.isMine = isMine self.id = id self.nickname = nickname - self.followerCount = followerCount - self.followingCount = followingCount + self.follower = follower + self.following = following self.isFollowing = isFollowing self.profileImage = profileImage + self.feeds = feeds + self.bookmarkedFeeds = bookmarkedFeeds + self.loginState = loginState } } + +public enum LoginState { + case apple + case kakao +}