From 174b461f9ea52042b3933eebc94fab14623cfae1 Mon Sep 17 00:00:00 2001 From: SweetPumpkinCK <80156515+bdrsky2010@users.noreply.github.com> Date: Mon, 18 Mar 2024 21:49:18 +0900 Subject: [PATCH] =?UTF-8?q?[Edit]=20enum=20DrinkJsonType=20case=EB=B3=84?= =?UTF-8?q?=EB=A1=9C=20=EB=A7=9E=EC=A7=80=20=EC=95=8A=EC=9D=80=20return=20?= =?UTF-8?q?=EA=B0=92=EC=9D=84=20=EA=B0=96=EA=B3=A0=20=EC=9E=88=EC=96=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20#161?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JUDA_iOS/JUDA.xcodeproj/project.pbxproj | 40 ++++++++++----- .../xcshareddata/xcschemes/JUDA.xcscheme | 13 +++-- .../JUDA/ViewModel/Auth/AuthViewModel.swift | 2 +- .../Drink/FirestoreDrinkService.swift | 43 +++++++++------- .../DrinkUploadViewModel.swift | 14 ++++-- .../JUDA/ViewModel/Main/MainViewModel.swift | 50 +++++++++---------- .../Posts/FirestorePostService.swift | 43 +++++++++------- .../ViewModel/Record/RecordViewModel.swift | 4 +- 8 files changed, 123 insertions(+), 86 deletions(-) diff --git a/JUDA_iOS/JUDA.xcodeproj/project.pbxproj b/JUDA_iOS/JUDA.xcodeproj/project.pbxproj index 957fb383..7f31e072 100644 --- a/JUDA_iOS/JUDA.xcodeproj/project.pbxproj +++ b/JUDA_iOS/JUDA.xcodeproj/project.pbxproj @@ -73,9 +73,6 @@ 09F869B72B6A47C700A56A4C /* AlarmStoreView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09F869B62B6A47C700A56A4C /* AlarmStoreView.swift */; }; 09F869BB2B6A4A9C00A56A4C /* LikedDrinkList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09F869BA2B6A4A9C00A56A4C /* LikedDrinkList.swift */; }; 09F869BD2B6A4AAE00A56A4C /* LikedPostGrid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09F869BC2B6A4AAE00A56A4C /* LikedPostGrid.swift */; }; - 09FD4F152BA5CAC300959672 /* DrinkLoading.json in Resources */ = {isa = PBXBuildFile; fileRef = 09FD4F142BA5CAC300959672 /* DrinkLoading.json */; }; - 09FD4F182BA5CAD400959672 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 09FD4F162BA5CAD300959672 /* GoogleService-Info.plist */; }; - 09FD4F192BA5CAD400959672 /* APIKEYS.plist in Resources */ = {isa = PBXBuildFile; fileRef = 09FD4F172BA5CAD300959672 /* APIKEYS.plist */; }; 2C2044E82B63B9D600773266 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C2044E72B63B9D600773266 /* ContentView.swift */; }; 2C2AD4FD2B68891C00C681F4 /* SearchTagView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C2AD4FC2B68891C00C681F4 /* SearchTagView.swift */; }; 2C2AD5012B689CA500C681F4 /* SelectedPhotoHorizontalScroll.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C2AD5002B689CA500C681F4 /* SelectedPhotoHorizontalScroll.swift */; }; @@ -93,6 +90,13 @@ 7B0A8BC52B8C163E00740E61 /* Report.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B0A8BC42B8C163E00740E61 /* Report.swift */; }; 7B0A8BCD2B8CA7E900740E61 /* PostSearchList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B0A8BCC2B8CA7E900740E61 /* PostSearchList.swift */; }; 7B0A8BCF2B8CA8C300740E61 /* PostSearchListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B0A8BCE2B8CA8C300740E61 /* PostSearchListCell.swift */; }; + 7B17CF0B2BA80B8000A9C080 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7B17CF092BA80B8000A9C080 /* GoogleService-Info.plist */; }; + 7B17CF0C2BA80B8000A9C080 /* APIKEYS.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7B17CF0A2BA80B8000A9C080 /* APIKEYS.plist */; }; + 7B17CF0E2BA80B9400A9C080 /* DrinkLoading.json in Resources */ = {isa = PBXBuildFile; fileRef = 7B17CF0D2BA80B9400A9C080 /* DrinkLoading.json */; }; + 7B17CF132BA80BAA00A9C080 /* WineTest.json in Resources */ = {isa = PBXBuildFile; fileRef = 7B17CF0F2BA80BAA00A9C080 /* WineTest.json */; }; + 7B17CF142BA80BAA00A9C080 /* WhiskeyTest.json in Resources */ = {isa = PBXBuildFile; fileRef = 7B17CF102BA80BAA00A9C080 /* WhiskeyTest.json */; }; + 7B17CF152BA80BAA00A9C080 /* BeerTest.json in Resources */ = {isa = PBXBuildFile; fileRef = 7B17CF112BA80BAA00A9C080 /* BeerTest.json */; }; + 7B17CF162BA80BAA00A9C080 /* TraditionalTest.json in Resources */ = {isa = PBXBuildFile; fileRef = 7B17CF122BA80BAA00A9C080 /* TraditionalTest.json */; }; 7B5174922B69EAB300915793 /* NavigationPostsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5174912B69EAB300915793 /* NavigationPostsView.swift */; }; 7B56AE172BA66C8200C47F3C /* FirebaseFunctions in Frameworks */ = {isa = PBXBuildFile; productRef = 7B56AE162BA66C8200C47F3C /* FirebaseFunctions */; }; 7B6D76A72B677A8F00601B55 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6D76A62B677A8F00601B55 /* Button.swift */; }; @@ -241,9 +245,6 @@ 09F869B62B6A47C700A56A4C /* AlarmStoreView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlarmStoreView.swift; sourceTree = ""; }; 09F869BA2B6A4A9C00A56A4C /* LikedDrinkList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LikedDrinkList.swift; sourceTree = ""; }; 09F869BC2B6A4AAE00A56A4C /* LikedPostGrid.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LikedPostGrid.swift; sourceTree = ""; }; - 09FD4F142BA5CAC300959672 /* DrinkLoading.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = DrinkLoading.json; path = "../../../../../흐르미/Lottie/DrinkLoading.json"; sourceTree = ""; }; - 09FD4F162BA5CAD300959672 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../흐르미/GoogleService-Info.plist"; sourceTree = ""; }; - 09FD4F172BA5CAD300959672 /* APIKEYS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = APIKEYS.plist; path = "../../../흐르미/APIKEYS.plist"; sourceTree = ""; }; 2C2044E72B63B9D600773266 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 2C2AD4FC2B68891C00C681F4 /* SearchTagView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchTagView.swift; sourceTree = ""; }; 2C2AD5002B689CA500C681F4 /* SelectedPhotoHorizontalScroll.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectedPhotoHorizontalScroll.swift; sourceTree = ""; }; @@ -262,6 +263,13 @@ 7B0A8BC42B8C163E00740E61 /* Report.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Report.swift; sourceTree = ""; }; 7B0A8BCC2B8CA7E900740E61 /* PostSearchList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostSearchList.swift; sourceTree = ""; }; 7B0A8BCE2B8CA8C300740E61 /* PostSearchListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostSearchListCell.swift; sourceTree = ""; }; + 7B17CF092BA80B8000A9C080 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../../../JUDA_file/GoogleService-Info.plist"; sourceTree = ""; }; + 7B17CF0A2BA80B8000A9C080 /* APIKEYS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = APIKEYS.plist; path = ../../../../../../JUDA_file/APIKEYS.plist; sourceTree = ""; }; + 7B17CF0D2BA80B9400A9C080 /* DrinkLoading.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = DrinkLoading.json; path = ../../../../../../../../JUDA_file/Lottie/DrinkLoading.json; sourceTree = ""; }; + 7B17CF0F2BA80BAA00A9C080 /* WineTest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = WineTest.json; path = ../../../../../../../../JUDA_file/TestJsonData/WineTest.json; sourceTree = ""; }; + 7B17CF102BA80BAA00A9C080 /* WhiskeyTest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = WhiskeyTest.json; path = ../../../../../../../../JUDA_file/TestJsonData/WhiskeyTest.json; sourceTree = ""; }; + 7B17CF112BA80BAA00A9C080 /* BeerTest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = BeerTest.json; path = ../../../../../../../../JUDA_file/TestJsonData/BeerTest.json; sourceTree = ""; }; + 7B17CF122BA80BAA00A9C080 /* TraditionalTest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = TraditionalTest.json; path = ../../../../../../../../JUDA_file/TestJsonData/TraditionalTest.json; sourceTree = ""; }; 7B5174912B69EAB300915793 /* NavigationPostsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationPostsView.swift; sourceTree = ""; }; 7B6D76A62B677A8F00601B55 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; 7B6D76AA2B67CE3D00601B55 /* PostDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostDetailView.swift; sourceTree = ""; }; @@ -410,6 +418,10 @@ isa = PBXGroup; children = ( 7BE14B962B84767000C1F6C3 /* DrinkUploadViewModel.swift */, + 7B17CF112BA80BAA00A9C080 /* BeerTest.json */, + 7B17CF122BA80BAA00A9C080 /* TraditionalTest.json */, + 7B17CF102BA80BAA00A9C080 /* WhiskeyTest.json */, + 7B17CF0F2BA80BAA00A9C080 /* WineTest.json */, ); path = JsonUploadFiles; sourceTree = ""; @@ -443,7 +455,7 @@ 09BCC1492B7C7E2900FF4D1B /* Loading.json */, 09BCC14C2B7C7E2900FF4D1B /* Rain.json */, 09BCC14D2B7C7E2900FF4D1B /* Snow.json */, - 09FD4F142BA5CAC300959672 /* DrinkLoading.json */, + 7B17CF0D2BA80B9400A9C080 /* DrinkLoading.json */, 09BCC14B2B7C7E2900FF4D1B /* Sun.json */, 09BCC14A2B7C7E2900FF4D1B /* Thunder.json */, ); @@ -580,8 +592,8 @@ B1B8FE802B5EA9DA00921BBE /* Assets.xcassets */, B1B8FE8C2B5EAAAB00921BBE /* Colors.xcassets */, B121A56F2B5F8DA100667D42 /* Info.plist */, - 09FD4F172BA5CAD300959672 /* APIKEYS.plist */, - 09FD4F162BA5CAD300959672 /* GoogleService-Info.plist */, + 7B17CF0A2BA80B8000A9C080 /* APIKEYS.plist */, + 7B17CF092BA80B8000A9C080 /* GoogleService-Info.plist */, B1B8FE822B5EA9DA00921BBE /* Preview Content */, ); path = JUDA; @@ -887,7 +899,11 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7B17CF142BA80BAA00A9C080 /* WhiskeyTest.json in Resources */, 09BCC1512B7C7E2900FF4D1B /* Sun.json in Resources */, + 7B17CF0E2BA80B9400A9C080 /* DrinkLoading.json in Resources */, + 7B17CF162BA80BAA00A9C080 /* TraditionalTest.json in Resources */, + 7B17CF152BA80BAA00A9C080 /* BeerTest.json in Resources */, 09BCC1502B7C7E2900FF4D1B /* Thunder.json in Resources */, B1B8FE8D2B5EAAAB00921BBE /* Colors.xcassets in Resources */, B121A5732B5F910900667D42 /* Pretendard-Bold.otf in Resources */, @@ -897,14 +913,14 @@ B121A5772B5F911900667D42 /* Pretendard-SemiBold.otf in Resources */, 09BCC1532B7C7E2900FF4D1B /* Snow.json in Resources */, 09BCC1542B7C7E2900FF4D1B /* Clouds.json in Resources */, + 7B17CF132BA80BAA00A9C080 /* WineTest.json in Resources */, B121A5742B5F910B00667D42 /* Pretendard-Light.otf in Resources */, + 7B17CF0B2BA80B8000A9C080 /* GoogleService-Info.plist in Resources */, 09BCC1522B7C7E2900FF4D1B /* Rain.json in Resources */, - 09FD4F182BA5CAD400959672 /* GoogleService-Info.plist in Resources */, + 7B17CF0C2BA80B8000A9C080 /* APIKEYS.plist in Resources */, B121A5762B5F911700667D42 /* Pretendard-Regular.otf in Resources */, B1B8FE812B5EA9DA00921BBE /* Assets.xcassets in Resources */, B121A5752B5F911500667D42 /* Pretendard-Medium.otf in Resources */, - 09FD4F152BA5CAC300959672 /* DrinkLoading.json in Resources */, - 09FD4F192BA5CAD400959672 /* APIKEYS.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/JUDA_iOS/JUDA.xcodeproj/xcshareddata/xcschemes/JUDA.xcscheme b/JUDA_iOS/JUDA.xcodeproj/xcshareddata/xcschemes/JUDA.xcscheme index 982b1bda..f3fdef79 100644 --- a/JUDA_iOS/JUDA.xcodeproj/xcshareddata/xcschemes/JUDA.xcscheme +++ b/JUDA_iOS/JUDA.xcodeproj/xcshareddata/xcschemes/JUDA.xcscheme @@ -39,8 +39,11 @@ debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES"> - + + + - + + + [Drink] { - do { - var result = [Drink]() - // Drink 가져오는 코드 - FirestoreDrinkViewModel - let snapshot = try await collection.getDocuments() - for document in snapshot.documents { - let id = document.documentID - let documentRef = collection.document(id) - let drinkData = try await fetchDrinkDocument(document: documentRef) - result.append(drinkData) - } - return result - } catch let error { - print("error :: fetchDrinkCollection", error.localizedDescription) - throw DrinkError.fetchDrinkCollection - } - } + // Drink 리스트를 가져오는 함수 + // Drink 를 단일로 가져오는 firestoreDrinkViewModel 의 fetchDrinkDocument 을 사용. + func fetchDrinkCollection(collection: CollectionReference, query: Query? = nil) async throws -> [Drink] { + do { + var result = [Drink]() + var snapshot: QuerySnapshot + // Drink 가져오는 코드 - FirestoreDrinkViewModel + if let query = query { + snapshot = try await query.getDocuments() + } else { + snapshot = try await collection.getDocuments() + } + for document in snapshot.documents { + let id = document.documentID + let documentRef = collection.document(id) + let drinkData = try await fetchDrinkDocument(document: documentRef) + result.append(drinkData) + } + return result + } catch let error { + print("error :: fetchDrinkCollection", error.localizedDescription) + throw DrinkError.fetchDrinkCollection + } + } // drinks collection의 document data 불러오는 메서드 // 불러오지 못 할 경우 error를 throw diff --git a/JUDA_iOS/JUDA/ViewModel/JsonUploadFiles/DrinkUploadViewModel.swift b/JUDA_iOS/JUDA/ViewModel/JsonUploadFiles/DrinkUploadViewModel.swift index a6699aea..c913ce13 100644 --- a/JUDA_iOS/JUDA/ViewModel/JsonUploadFiles/DrinkUploadViewModel.swift +++ b/JUDA_iOS/JUDA/ViewModel/JsonUploadFiles/DrinkUploadViewModel.swift @@ -20,6 +20,10 @@ final class DrinkUploadViewModel: ObservableObject { drinks.append(contentsOf: drinkData) } } + print(drinks.filter { $0.category == "위스키" }.count) + print(drinks.filter { $0.category == "우리술" }.count) + print(drinks.filter { $0.category == "맥주" }.count) + print(drinks.filter { $0.category == "와인" }.count) drinkDataUpload(drinkData: drinks) } @@ -118,10 +122,10 @@ final class DrinkUploadViewModel: ObservableObject { group.addTask { do { if let fileName = Formatter.getImageName(category: category, detailedCategory: drink.type) { - let url = try await self.fireStorageService.fetchImageURL(folder: .drink, fileName: "") + let url = try await self.fireStorageService.fetchImageURL(folder: .drink, fileName: fileName) return (index, url) } else { - print("error :: getImageName") + print("error :: getImageName", drink.category, drink.type) return (index, nil) } } catch { @@ -233,11 +237,11 @@ extension DrinkUploadViewModel { switch self { case .beer: return "BeerTest" - case .wine: - return "TraditionalTest" case .traditional: - return "WhiskeyTest" + return "TraditionalTest" case .whiskey: + return "WhiskeyTest" + case .wine: return "WineTest" } } diff --git a/JUDA_iOS/JUDA/ViewModel/Main/MainViewModel.swift b/JUDA_iOS/JUDA/ViewModel/Main/MainViewModel.swift index e0e44682..86e19acd 100644 --- a/JUDA_iOS/JUDA/ViewModel/Main/MainViewModel.swift +++ b/JUDA_iOS/JUDA/ViewModel/Main/MainViewModel.swift @@ -78,31 +78,31 @@ final class MainViewModel: ObservableObject { // MARK: - Fetch extension MainViewModel { - // 인기 있는 drink 가져오기 - func getHottestDrinks() async { - do { - let hottestDrinksRef = firestore.collection(drinkCollection) - .order(by: "rating", descending: true).limit(to: 3) - // Drink 가져오는 함수 사용 - FirestoreDrinkService - let hottestDrinks = try await firestoreDrinkService.fetchDrinkCollection(collection: hottestDrinksRef as! CollectionReference) - drinks = hottestDrinks - } catch { - print("error :: getHottestDrinks", error.localizedDescription) - } - } - - // 인기 있는 post 가져오기 - func getHottestPosts() async { - do { - let hottestPostsRef = firestore.collection(postCollection) - .order(by: "likedCount", descending: true).limit(to: 3) - // Post 가져오는 함수 사용 - FirestorePostService - let hottestPosts = try await firestorePostService.fetchPostCollection(collection: hottestPostsRef as! CollectionReference) - posts = hottestPosts - } catch { - print("error :: getHottestPosts", error.localizedDescription) - } - } + // 인기 있는 drink 가져오기 + func getHottestDrinks() async { + do { + let collectionRef = firestore.collection(drinkCollection) + let hottestDrinksRef = collectionRef.order(by: "rating", descending: true).limit(to: 3) + // Drink 가져오는 함수 사용 - FirestoreDrinkService + let hottestDrinks = try await firestoreDrinkService.fetchDrinkCollection(collection: collectionRef, query: hottestDrinksRef) + drinks = hottestDrinks + } catch { + print("error :: getHottestDrinks", error.localizedDescription) + } + } + + // 인기 있는 post 가져오기 + func getHottestPosts() async { + do { + let collectionRef = firestore.collection(postCollection) + let hottestPostsRef = collectionRef.order(by: "likedCount", descending: true).limit(to: 3) + // Post 가져오는 함수 사용 - FirestorePostService + let hottestPosts = try await firestorePostService.fetchPostCollection(collection: collectionRef, query: hottestPostsRef) + posts = hottestPosts + } catch { + print("error :: getHottestPosts", error.localizedDescription) + } + } // 날씨 & 음식 + 술 받아오기 func getWeatherAndAIResponse(location: CLLocation) async { diff --git a/JUDA_iOS/JUDA/ViewModel/Posts/FirestorePostService.swift b/JUDA_iOS/JUDA/ViewModel/Posts/FirestorePostService.swift index 7cbbc246..474a4fc2 100644 --- a/JUDA_iOS/JUDA/ViewModel/Posts/FirestorePostService.swift +++ b/JUDA_iOS/JUDA/ViewModel/Posts/FirestorePostService.swift @@ -16,25 +16,30 @@ final class FirestorePostService { // MARK: - Firestore post fetch extension FirestorePostService { - // Post 리스트를 가져오는 함수 - // Post 를 단일로 가져오는 firestorePostViewModel 의 fetchPostDocument 을 사용. - func fetchPostCollection(collection: CollectionReference) async throws -> [Post] { - do { - var result = [Post]() - // Post 가져오는 코드 - FirestorePostViewModel - let snapshot = try await collection.getDocuments() - for document in snapshot.documents { - let id = document.documentID - let documentRef = collection.document(id) - let postData = try await fetchPostDocument(document: documentRef) - result.append(postData) - } - return result - } catch let error { - print("error :: fetchPostCollection", error.localizedDescription) - throw PostError.collectionFetch - } - } + // Post 리스트를 가져오는 함수 + // Post 를 단일로 가져오는 firestorePostViewModel 의 fetchPostDocument 을 사용. + func fetchPostCollection(collection: CollectionReference, query: Query? = nil) async throws -> [Post] { + do { + var result = [Post]() + var snapshot: QuerySnapshot + // Post 가져오는 코드 - FirestorePostViewModel + if let query = query { + snapshot = try await query.getDocuments() + } else { + snapshot = try await collection.getDocuments() + } + for document in snapshot.documents { + let id = document.documentID + let documentRef = collection.document(id) + let postData = try await fetchPostDocument(document: documentRef) + result.append(postData) + } + return result + } catch let error { + print("error :: fetchPostCollection", error.localizedDescription) + throw PostError.collectionFetch + } + } // posts collection의 post document data 불러오는 메서드 // 불러오지 못 할 수 경우 error throw diff --git a/JUDA_iOS/JUDA/ViewModel/Record/RecordViewModel.swift b/JUDA_iOS/JUDA/ViewModel/Record/RecordViewModel.swift index 866b5724..347c2527 100644 --- a/JUDA_iOS/JUDA/ViewModel/Record/RecordViewModel.swift +++ b/JUDA_iOS/JUDA/ViewModel/Record/RecordViewModel.swift @@ -177,7 +177,7 @@ final class RecordViewModel: ObservableObject { // MARK: - Firestore drink 업로드 func updateDrinkToFirestore() async { - guard let post = post, let user = writtenUser else { return } + guard let user = writtenUser else { return } do { let drinkRef = db.collection("drinks") for drinkTag in drinkTags { @@ -216,7 +216,7 @@ final class RecordViewModel: ObservableObject { // Drink rating update // TODO: return 값 처리 - let result = await firestoreDrinkService.updateDrinkField(ref: drinkRef, drinkID: drinkID, data: ["rating": rating]) + _ = await firestoreDrinkService.updateDrinkField(ref: drinkRef, drinkID: drinkID, data: ["rating": rating]) } } catch DrinkError.fetchDrinkDocument { print("error :: updateDrinkField() -> update drink data to Firestore failure")