Skip to content

Commit

Permalink
refactor: 데이터 모델링 재정의(#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
sozohoy committed Oct 3, 2024
1 parent 4571b85 commit 30cebe6
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 76 deletions.
71 changes: 6 additions & 65 deletions Core/Sources/Model/Feed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,85 +25,25 @@ 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
) {
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")!
// )
// ]
//
//}
27 changes: 27 additions & 0 deletions Core/Sources/Model/Follow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 4 additions & 0 deletions Core/Sources/Model/OverView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
//

import Foundation

struct Overview {
let places: [Place]
}
11 changes: 7 additions & 4 deletions Core/Sources/Model/Place.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Location.swift
// Place.swift
// Core
//
// Created by 한지석 on 9/29/24.
Expand All @@ -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
}
22 changes: 22 additions & 0 deletions Core/Sources/Model/PlaceInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 7 additions & 0 deletions Core/Sources/Model/PlaceReview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@
//

import Foundation

struct PlaceReview {
let author: String
let content: String
let rating: Double
let createdAt: String
}
31 changes: 24 additions & 7 deletions Core/Sources/Model/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 30cebe6

Please sign in to comment.