From 95ee927f4490286f29295b10ab1367baebe0a24f Mon Sep 17 00:00:00 2001 From: BaeRoNuI Date: Mon, 5 Dec 2022 22:30:47 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20DiaryPostEndPoint=20method=EA=B0=80?= =?UTF-8?q?=20get=EC=9D=B8=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Segno/Segno/Data/Network/Endpoints/DiaryPostEndpoint.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Segno/Segno/Data/Network/Endpoints/DiaryPostEndpoint.swift b/Segno/Segno/Data/Network/Endpoints/DiaryPostEndpoint.swift index ed4bd91..15cc2ce 100644 --- a/Segno/Segno/Data/Network/Endpoints/DiaryPostEndpoint.swift +++ b/Segno/Segno/Data/Network/Endpoints/DiaryPostEndpoint.swift @@ -15,7 +15,7 @@ enum DiaryPostEndpoint: Endpoint { } var httpMethod: HTTPMethod { - return .GET + return .POST } var path: String { From 8e2e31dd18c274199f47cae3ba1f6dfd6cb65d6d Mon Sep 17 00:00:00 2001 From: BaeRoNuI Date: Mon, 5 Dec 2022 22:44:08 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20Diary=20=EC=82=AD=EC=A0=9C=EB=A5=BC?= =?UTF-8?q?=20=EC=9C=84=ED=95=9C=20Endpoint=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Endpoints/DiaryDeleteEndpoint.swift | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Segno/Segno/Data/Network/Endpoints/DiaryDeleteEndpoint.swift diff --git a/Segno/Segno/Data/Network/Endpoints/DiaryDeleteEndpoint.swift b/Segno/Segno/Data/Network/Endpoints/DiaryDeleteEndpoint.swift new file mode 100644 index 0000000..2b5ca7a --- /dev/null +++ b/Segno/Segno/Data/Network/Endpoints/DiaryDeleteEndpoint.swift @@ -0,0 +1,31 @@ +// +// DiaryDeleteEndpoint.swift +// Segno +// +// Created by TaehoYoo on 2022/12/05. +// + +import Foundation + +enum DiaryDeleteEndpoint: Endpoint { + case item(token: String, diaryId: String) + + var baseURL: URL? { + return URL(string: BaseURL.urlString) + } + + var httpMethod: HTTPMethod { + return .DELETE + } + + var path: String { + return "diary" + } + + var parameters: HTTPRequestParameter? { + switch self { + case .item(let token, let diaryId): + return HTTPRequestParameter.body(["token": token, "diaryId": diaryId]) + } + } +} From 317924e23efcfff04d994a355615073b5ddd8df8 Mon Sep 17 00:00:00 2001 From: BaeRoNuI Date: Mon, 5 Dec 2022 22:44:27 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20DiaryRepository=EC=97=90=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=EB=A5=BC=20=EC=9C=84=ED=95=9C=20method=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Segno/Segno/Data/Repository/DiaryRepository.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Segno/Segno/Data/Repository/DiaryRepository.swift b/Segno/Segno/Data/Repository/DiaryRepository.swift index 5e5e97f..972bd5c 100644 --- a/Segno/Segno/Data/Repository/DiaryRepository.swift +++ b/Segno/Segno/Data/Repository/DiaryRepository.swift @@ -13,6 +13,7 @@ protocol DiaryRepository { func getDiaryListItem() -> Single func getDiary(id: String) -> Single func postDiary(_ diary: DiaryDetail, image: Data) -> Single + func deleteDiary(id: String) -> Single } final class DiaryRepositoryImpl: DiaryRepository { @@ -79,4 +80,18 @@ final class DiaryRepositoryImpl: DiaryRepository { return single } + + func deleteDiary(id: String) -> RxSwift.Single { + //TODO: - Token 받아오기 + let token = "0KjV78s0YPKbrlVP3QeAwUJcjohs2h2ysdWDLWg" + + let diaryDeleteEndpoint = DiaryDeleteEndpoint.item(token: token, diaryId: id) + + let single = NetworkManager.shared.call(diaryDeleteEndpoint) + .map { _ in + return true + } + + return single + } } From 1197dcc16d1b8f31aacc097311abf5315f308a2a Mon Sep 17 00:00:00 2001 From: BaeRoNuI Date: Mon, 5 Dec 2022 22:44:53 +0900 Subject: [PATCH 4/4] =?UTF-8?q?chore:=20=ED=8C=8C=EC=9D=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=EC=97=90=20=EB=94=B0=EB=A5=B8=20proj=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Segno/Segno.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Segno/Segno.xcodeproj/project.pbxproj b/Segno/Segno.xcodeproj/project.pbxproj index 7e740cc..419e42d 100644 --- a/Segno/Segno.xcodeproj/project.pbxproj +++ b/Segno/Segno.xcodeproj/project.pbxproj @@ -66,6 +66,7 @@ 7940FB2F292E063100276EFC /* DiaryDetailDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7940FB2E292E063100276EFC /* DiaryDetailDTO.swift */; }; 7940FB31292E065100276EFC /* DiaryDetailEndpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7940FB30292E065100276EFC /* DiaryDetailEndpoint.swift */; }; 7940FB33292E065F00276EFC /* DiaryDetailUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7940FB32292E065F00276EFC /* DiaryDetailUseCase.swift */; }; + 79767E64293E2A1200E489DD /* DiaryDeleteEndpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79767E63293E2A1200E489DD /* DiaryDeleteEndpoint.swift */; }; 9825F41B29377875005F2163 /* ChangeNicknameUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9825F41A29377875005F2163 /* ChangeNicknameUseCase.swift */; }; 9825F41D29377ACF005F2163 /* SettingsRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9825F41C29377ACF005F2163 /* SettingsRepository.swift */; }; 982A2A472924AE74006F6ACD /* UserDefaultsKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 982A2A462924AE74006F6ACD /* UserDefaultsKey.swift */; }; @@ -151,6 +152,7 @@ 7940FB2E292E063100276EFC /* DiaryDetailDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiaryDetailDTO.swift; sourceTree = ""; }; 7940FB30292E065100276EFC /* DiaryDetailEndpoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiaryDetailEndpoint.swift; sourceTree = ""; }; 7940FB32292E065F00276EFC /* DiaryDetailUseCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiaryDetailUseCase.swift; sourceTree = ""; }; + 79767E63293E2A1200E489DD /* DiaryDeleteEndpoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiaryDeleteEndpoint.swift; sourceTree = ""; }; 9825F41A29377875005F2163 /* ChangeNicknameUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeNicknameUseCase.swift; sourceTree = ""; }; 9825F41C29377ACF005F2163 /* SettingsRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsRepository.swift; sourceTree = ""; }; 982A2A462924AE74006F6ACD /* UserDefaultsKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsKey.swift; sourceTree = ""; }; @@ -425,6 +427,7 @@ 4FA3242A2923646F00DB04D5 /* DiaryListItemEndpoint.swift */, 7940FB30292E065100276EFC /* DiaryDetailEndpoint.swift */, 791529DF293344E8005A8DDB /* DiaryPostEndpoint.swift */, + 79767E63293E2A1200E489DD /* DiaryDeleteEndpoint.swift */, 4F4E0D7529252236005ABA8F /* LoginEndpoint.swift */, 66A8CF6C29379A9900C17F84 /* UserDetailEndpoint.swift */, 791529DD29333D40005A8DDB /* ImageEndpoint.swift */, @@ -562,6 +565,7 @@ 983AE9D82935CEE2006547BD /* SettingsViewModel.swift in Sources */, 9825F41D29377ACF005F2163 /* SettingsRepository.swift in Sources */, 66F0D7EE2925FF8B0074872E /* DiaryCell.swift in Sources */, + 79767E64293E2A1200E489DD /* DiaryDeleteEndpoint.swift in Sources */, 4F9A00202922337F007D9057 /* LoginViewController.swift in Sources */, 982A2A472924AE74006F6ACD /* UserDefaultsKey.swift in Sources */, 66A8CF6B2937947A00C17F84 /* UserDetailDTO.swift in Sources */,