Skip to content

Commit

Permalink
[Feat] #520 - 이미지 및 썸네일 관련
Browse files Browse the repository at this point in the history
  • Loading branch information
yju0808 committed Apr 18, 2024
1 parent f5195a1 commit 5905422
Show file tree
Hide file tree
Showing 3 changed files with 446 additions and 48 deletions.
4 changes: 3 additions & 1 deletion HappyAnding/HappyAnding/Model/Answer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ struct Answer: Identifiable, Codable, Equatable, Hashable {
var content: String
var isAccepted: Bool
var images: [String]
var thumbnailImages: [String]
var likedBy: [String:Bool]
var likeCount: Int

init(content: String, author: String, postId:String, images: [String] = []) {
init(content: String, author: String, postId:String, images: [String] = [], thumbnailImages: [String] = []) {

self.id = UUID().uuidString
self.createdAt = Date().getDate()
Expand All @@ -30,6 +31,7 @@ struct Answer: Identifiable, Codable, Equatable, Hashable {
self.author = author
self.postId = postId
self.images = images
self.thumbnailImages = thumbnailImages

self.likeCount = 0
self.likedBy = [:]
Expand Down
4 changes: 3 additions & 1 deletion HappyAnding/HappyAnding/Model/Post.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ struct Post: Identifiable, Codable, Equatable, Hashable {
var content: String
var shortcuts: [String]
var images: [String]
var thumbnailImages: [String]
var likedBy: [String:Bool]
var likeCount: Int
var commentCount: Int

init(type: PostType, content: String, author: String, shortcuts: [String] = [], images: [String] = []) {
init(type: PostType, content: String, author: String, shortcuts: [String] = [], images: [String] = [], thumbnailImages: [String] = []) {

self.id = UUID().uuidString
self.createdAt = Date().getDate()
Expand All @@ -31,6 +32,7 @@ struct Post: Identifiable, Codable, Equatable, Hashable {
self.author = author
self.shortcuts = shortcuts
self.images = images
self.thumbnailImages = thumbnailImages

self.likeCount = 0
self.commentCount = 0
Expand Down

0 comments on commit 5905422

Please sign in to comment.