From ee9cb685e70d95d83a6d45d7c136fdc9f4e2c54e Mon Sep 17 00:00:00 2001 From: InhyeKang Date: Sun, 2 Apr 2023 22:24:18 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor=20::=20=EC=9E=90=EC=8A=B5=EC=8B=A4?= =?UTF-8?q?=20=EC=9E=90=EB=A6=AC=20=EC=A2=85=EB=A5=98=20=EB=B3=B4=EA=B8=B0?= =?UTF-8?q?=20API=EC=97=90=20QueryString=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyPageFeature/Sources/MyPage/MyPageView.swift | 3 ++- .../StudyRoomDetail/StudyRoomDetailViewModel.swift | 2 +- Projects/Services/APIKit/Sources/StudyRoomsAPI.swift | 9 ++++++++- .../Repositories/Impl/StudyRoomsRepositoryImpl.swift | 4 ++-- .../UseCases/Impl/FetchSeatTypesUseCaseImpl.swift | 4 ++-- .../StudyRooms/Repository/StudyRoomsRepository.swift | 2 +- .../StudyRooms/UseCases/FetchSeatTypesUseCase.swift | 2 +- .../Remote/Impl/RemoteStudyRoomsDataSourceImpl.swift | 4 ++-- .../StudyRooms/Remote/RemoteStudyRoomsDataSource.swift | 2 +- 9 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Projects/Features/MyPageFeature/Sources/MyPage/MyPageView.swift b/Projects/Features/MyPageFeature/Sources/MyPage/MyPageView.swift index f428feff..f4680517 100644 --- a/Projects/Features/MyPageFeature/Sources/MyPage/MyPageView.swift +++ b/Projects/Features/MyPageFeature/Sources/MyPage/MyPageView.swift @@ -141,7 +141,8 @@ struct MyPageView: View { } label: { myPageOptionRowCardView(title: "비밀번호 변경") .dmsFont(.body(.body2), color: .GrayScale.gray6) - .cornerRadius(10, corners: [ appState.features.pointService ? [.bottomLeft, .bottomRight] : .allCorners ]) + .cornerRadius(10, corners: appState.features.pointService + ? [.bottomLeft, .bottomRight] : .allCorners) } } diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyRoomDetail/StudyRoomDetailViewModel.swift b/Projects/Features/StudyRoomFeature/Sources/StudyRoomDetail/StudyRoomDetailViewModel.swift index bf7b0669..dcf1f150 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyRoomDetail/StudyRoomDetailViewModel.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyRoomDetail/StudyRoomDetailViewModel.swift @@ -49,7 +49,7 @@ final class StudyRoomDetailViewModel: BaseViewModel { func fetchSeatType() { addCancellable( - fetchSeatTypesUseCase.execute() + fetchSeatTypesUseCase.execute(studyroomID: studyRoomEntity.id) ) { [weak self] seatTypes in self?.seatTypes = seatTypes } diff --git a/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift b/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift index b3071147..3c348335 100644 --- a/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift +++ b/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift @@ -5,7 +5,7 @@ import Moya public enum StudyRoomsAPI { case fetchStudyAvailableTime - case fetchSeatTypes + case fetchSeatTypes(studyroomID: String) case fetchStudyRoomList(timeSlot: String?) case fetchDetailStudyRoom(roomID: String, timeSlot: String) case fetchMyStudyRoomApplicationItems @@ -64,6 +64,13 @@ extension StudyRoomsAPI: DmsAPI { public var task: Moya.Task { switch self { + case let .fetchSeatTypes(studyroomID): + return .requestParameters( + parameters: [ + "study_room_id": studyroomID + ], + encoding: URLEncoding.queryString + ) case let .fetchStudyRoomList(timeSlot): return .requestParameters( parameters: [ diff --git a/Projects/Services/DataModule/Sources/StudyRooms/Repositories/Impl/StudyRoomsRepositoryImpl.swift b/Projects/Services/DataModule/Sources/StudyRooms/Repositories/Impl/StudyRoomsRepositoryImpl.swift index 068bacd1..775c9fbe 100644 --- a/Projects/Services/DataModule/Sources/StudyRooms/Repositories/Impl/StudyRoomsRepositoryImpl.swift +++ b/Projects/Services/DataModule/Sources/StudyRooms/Repositories/Impl/StudyRoomsRepositoryImpl.swift @@ -15,8 +15,8 @@ public struct StudyRoomsRepositoryImpl: StudyRoomsRepository { remoteStudyRoomsDataSource.fetchStudyAvailableTime() } - public func fetchSeatTypes() -> AnyPublisher<[SeatTypeEntity], DmsError> { - remoteStudyRoomsDataSource.fetchSeatTypes() + public func fetchSeatTypes(studyroomID: String) -> AnyPublisher<[SeatTypeEntity], DmsError> { + remoteStudyRoomsDataSource.fetchSeatTypes(studyroomID: studyroomID) } public func fetchStudyRoomList(timeSlot: String?) -> AnyPublisher<[StudyRoomEntity], DmsError> { diff --git a/Projects/Services/DataModule/Sources/StudyRooms/UseCases/Impl/FetchSeatTypesUseCaseImpl.swift b/Projects/Services/DataModule/Sources/StudyRooms/UseCases/Impl/FetchSeatTypesUseCaseImpl.swift index 9d313f6d..dc182361 100644 --- a/Projects/Services/DataModule/Sources/StudyRooms/UseCases/Impl/FetchSeatTypesUseCaseImpl.swift +++ b/Projects/Services/DataModule/Sources/StudyRooms/UseCases/Impl/FetchSeatTypesUseCaseImpl.swift @@ -10,7 +10,7 @@ public struct FetchSeatTypesUseCaseImpl: FetchSeatTypesUseCase { self.studyRoomsRepository = studyRoomsRepository } - public func execute() -> AnyPublisher<[SeatTypeEntity], DmsError> { - studyRoomsRepository.fetchSeatTypes() + public func execute(studyroomID: String) -> AnyPublisher<[SeatTypeEntity], DmsError> { + studyRoomsRepository.fetchSeatTypes(studyroomID: studyroomID) } } diff --git a/Projects/Services/DomainModule/Sources/StudyRooms/Repository/StudyRoomsRepository.swift b/Projects/Services/DomainModule/Sources/StudyRooms/Repository/StudyRoomsRepository.swift index d3a6131d..cb97dab5 100644 --- a/Projects/Services/DomainModule/Sources/StudyRooms/Repository/StudyRoomsRepository.swift +++ b/Projects/Services/DomainModule/Sources/StudyRooms/Repository/StudyRoomsRepository.swift @@ -4,7 +4,7 @@ import ErrorModule public protocol StudyRoomsRepository { func fetchStudyAvailableTime() -> AnyPublisher - func fetchSeatTypes() -> AnyPublisher<[SeatTypeEntity], DmsError> + func fetchSeatTypes(studyroomID: String) -> AnyPublisher<[SeatTypeEntity], DmsError> func fetchStudyRoomList(timeSlot: String?) -> AnyPublisher<[StudyRoomEntity], DmsError> func fetchDetailStudyRoom(roomID: String, timeSlot: String) -> AnyPublisher func applyStudyRoomSeat(seatID: String, timeSlot: String) -> AnyPublisher diff --git a/Projects/Services/DomainModule/Sources/StudyRooms/UseCases/FetchSeatTypesUseCase.swift b/Projects/Services/DomainModule/Sources/StudyRooms/UseCases/FetchSeatTypesUseCase.swift index dbb1600b..2b328c08 100644 --- a/Projects/Services/DomainModule/Sources/StudyRooms/UseCases/FetchSeatTypesUseCase.swift +++ b/Projects/Services/DomainModule/Sources/StudyRooms/UseCases/FetchSeatTypesUseCase.swift @@ -3,5 +3,5 @@ import DataMappingModule import ErrorModule public protocol FetchSeatTypesUseCase { - func execute() -> AnyPublisher<[SeatTypeEntity], DmsError> + func execute(studyroomID: String) -> AnyPublisher<[SeatTypeEntity], DmsError> } diff --git a/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/RemoteStudyRoomsDataSourceImpl.swift b/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/RemoteStudyRoomsDataSourceImpl.swift index 79eb5c15..cf4e3939 100644 --- a/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/RemoteStudyRoomsDataSourceImpl.swift +++ b/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/RemoteStudyRoomsDataSourceImpl.swift @@ -23,8 +23,8 @@ public final class RemoteStudyRoomsDataSourceImpl: BaseRemoteDataSource AnyPublisher<[SeatTypeEntity], DmsError> { - request(.fetchSeatTypes, dto: FetchSeatTypesResponseDTO.self) + public func fetchSeatTypes(studyroomID: String) -> AnyPublisher<[SeatTypeEntity], DmsError> { + request(.fetchSeatTypes(studyroomID: studyroomID), dto: FetchSeatTypesResponseDTO.self) .map { $0.toDomain() } .eraseToAnyPublisher() } diff --git a/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/RemoteStudyRoomsDataSource.swift b/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/RemoteStudyRoomsDataSource.swift index d1481242..a7b01ba5 100644 --- a/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/RemoteStudyRoomsDataSource.swift +++ b/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/RemoteStudyRoomsDataSource.swift @@ -7,7 +7,7 @@ import Foundation public protocol RemoteStudyRoomsDataSource { func fetchStudyAvailableTime() -> AnyPublisher - func fetchSeatTypes() -> AnyPublisher<[SeatTypeEntity], DmsError> + func fetchSeatTypes(studyroomID: String) -> AnyPublisher<[SeatTypeEntity], DmsError> func fetchStudyRoomList(timeSlot: String?) -> AnyPublisher<[StudyRoomEntity], DmsError> func fetchDetailStudyRoom(roomID: String, timeSlot: String) -> AnyPublisher func applyStudyRoomSeat(seatID: String, timeSlot: String) -> AnyPublisher From d32a5aa045d7dfd41afb5a1fe3e7c7804cd81945 Mon Sep 17 00:00:00 2001 From: InhyeKang Date: Sun, 2 Apr 2023 22:36:41 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor=20::=20=EC=A4=84=EB=B0=94=EA=BF=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/Services/APIKit/Sources/StudyRoomsAPI.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift b/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift index 3c348335..38ca4e01 100644 --- a/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift +++ b/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift @@ -71,6 +71,7 @@ extension StudyRoomsAPI: DmsAPI { ], encoding: URLEncoding.queryString ) + case let .fetchStudyRoomList(timeSlot): return .requestParameters( parameters: [