-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge :: 잔류 신청 API 연동
- Loading branch information
Showing
33 changed files
with
605 additions
and
83 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
Projects/App/Sources/Application/DI/Remains/AppComponent+Remains.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import NeedleFoundation | ||
import NetworkModule | ||
import DomainModule | ||
import DataModule | ||
|
||
public extension AppComponent { | ||
var remoteRemainsDataSource: any RemoteRemainsDataSource { | ||
shared { | ||
RemoteRemainsDataSourceImpl(keychain: keychain) | ||
} | ||
} | ||
|
||
var remainsRepository: any RemainsRepository { | ||
shared { | ||
RemainsRepositoryImpl(remoteRemainsDataSource: remoteRemainsDataSource) | ||
} | ||
} | ||
|
||
var remainingApplicationsChangesUseCase: any RemainingApplicationsChangesUseCase { | ||
shared { | ||
RemainingApplicationsChangesUseCaselmpl(remainsRepository: remainsRepository) | ||
} | ||
} | ||
|
||
var fetchMyRemainApplicationItemsUseCase: any FetchMyRemainApplicationItemsUseCase { | ||
shared { | ||
FetchMyRemainApplicationItemsUseCaselmpl(remainsRepository: remainsRepository) | ||
} | ||
} | ||
|
||
var fetchRemainApplicationListUseCase: any FetchRemainApplicationListUseCase { | ||
shared { | ||
FetchRemainAppListUseCaselmpl(remainsRepository: remainsRepository) | ||
} | ||
} | ||
|
||
var fetchRemainsAvailableTimeUseCase: any FetchRemainsAvailableTimeUseCase { | ||
shared { | ||
FetchRemainsAvailableTimeUseCaselmpl(remainsRepository: remainsRepository) | ||
} | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ let project = Project.makeModule( | |
dependencies: [ | ||
.Project.Features.BaseFeature | ||
] | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import Moya | ||
import DataMappingModule | ||
import ErrorModule | ||
import Foundation | ||
|
||
public enum RemainsAPI { | ||
case remainingApplicationsChanges(id: String) | ||
case fetchMyRemainApplicationItems | ||
case fetchRemainsAvailableTime | ||
case fetchRemainApplicationList | ||
} | ||
|
||
extension RemainsAPI: DmsAPI { | ||
public var domain: DmsDomain { | ||
.remains | ||
} | ||
|
||
public var urlPath: String { | ||
switch self { | ||
case let .remainingApplicationsChanges(id): | ||
return "/\(id)" | ||
|
||
case .fetchMyRemainApplicationItems: | ||
return "/my" | ||
|
||
case .fetchRemainsAvailableTime: | ||
return "/available-time" | ||
|
||
case .fetchRemainApplicationList: | ||
return "/options" | ||
} | ||
} | ||
|
||
public var method: Moya.Method { | ||
switch self { | ||
case .remainingApplicationsChanges: | ||
return .put | ||
|
||
case .fetchMyRemainApplicationItems, .fetchRemainsAvailableTime, .fetchRemainApplicationList: | ||
return .get | ||
} | ||
} | ||
|
||
public var task: Moya.Task { | ||
.requestPlain | ||
} | ||
|
||
public var jwtTokenType: JwtTokenType { | ||
.accessToken | ||
} | ||
|
||
public var errorMap: [Int: DmsError] { | ||
switch self { | ||
case .remainingApplicationsChanges: | ||
return [ | ||
400: .badRequest, | ||
401: .tokenExpired, | ||
403: .forbiddenRemainPeriod, | ||
404: .notFoundRemain, | ||
409: .conflictRemain, | ||
429: .tooManyRequest, | ||
500: .internalServerError | ||
] | ||
|
||
case .fetchMyRemainApplicationItems: | ||
return [ | ||
400: .badRequest, | ||
401: .tokenExpired, | ||
403: .forbiddenRemainPeriod, | ||
404: .notFoundRemain, | ||
429: .tooManyRequest, | ||
500: .internalServerError | ||
] | ||
|
||
case .fetchRemainsAvailableTime: | ||
return [ | ||
400: .badRequest, | ||
401: .tokenExpired, | ||
403: .forbiddenRemainPeriod, | ||
404: .notFoundRemain, | ||
429: .tooManyRequest, | ||
500: .internalServerError | ||
] | ||
|
||
case .fetchRemainApplicationList: | ||
return [ | ||
400: .badRequest, | ||
401: .tokenExpired, | ||
404: .notFoundRemain, | ||
429: .tooManyRequest, | ||
500: .internalServerError | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Projects/Services/DataMappingModule/Sources/Enum/WeekType.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Foundation | ||
|
||
public enum WeekType: String, Decodable { | ||
case monday = "MONDAY" | ||
case tuesday = "TUESDAY" | ||
case wednesday = "WEDNESDAY" | ||
case thursday = "THURSDAY" | ||
case friday = "FRIDAY" | ||
case satuday = "SATURDAY" | ||
case sunday = "SUNDAY" | ||
} |
19 changes: 19 additions & 0 deletions
19
...taMappingModule/Sources/Remains/Response/FetchListRemainApplicationItemsResponseDTO.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Foundation | ||
|
||
public struct FetchRemainAppListResponseDTO: Decodable { | ||
public init( | ||
selectedOption: String, | ||
remainOptions: [RemainOptionResponseDTO] | ||
) { | ||
self.selectedOption = selectedOption | ||
self.remainOptions = remainOptions | ||
} | ||
|
||
public let selectedOption: String | ||
public let remainOptions: [RemainOptionResponseDTO] | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case selectedOption = "selected_option" | ||
case remainOptions = "remain_options" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...DataMappingModule/Sources/Remains/Response/FetchMyRemainApplicationItemsResponseDTO.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Foundation | ||
|
||
public struct FetchMyRemainApplicationItemsResponseDTO: Decodable { | ||
public init( | ||
title: String | ||
) { | ||
self.title = title | ||
} | ||
|
||
public let title: String | ||
} |
27 changes: 27 additions & 0 deletions
27
...ces/DataMappingModule/Sources/Remains/Response/FetchRemainsAvailableTimeResponseDTO.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Foundation | ||
|
||
public struct FetchRemainsAvailableTimeResponseDTO: Decodable { | ||
public init( | ||
startDayOfWeek: WeekType, | ||
startAt: String, | ||
endDayOfWeek: WeekType, | ||
endAt: String | ||
) { | ||
self.startDayOfWeek = startDayOfWeek | ||
self.startAt = startAt | ||
self.endDayOfWeek = endDayOfWeek | ||
self.endAt = endAt | ||
} | ||
|
||
public let startDayOfWeek: WeekType | ||
public let startAt: String | ||
public let endDayOfWeek: WeekType | ||
public let endAt: String | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case startDayOfWeek = "start_day_of_week" | ||
case startAt = "start_at" | ||
case endDayOfWeek = "end_day_of_week" | ||
case endAt = "end_at" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Projects/Services/DataMappingModule/Sources/Remains/Response/RemainOptionResponseDTO.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Foundation | ||
|
||
public struct RemainOptionResponseDTO: Decodable { | ||
public init( | ||
id: String, | ||
title: String, | ||
description: String | ||
) { | ||
self.id = id | ||
self.title = title | ||
self.description = description | ||
} | ||
|
||
public let id: String | ||
public let title: String | ||
public let description: String | ||
} |
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
Projects/Services/DataModule/Sources/Remains/Repositories/lmpl/RemainsRepositoryImpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Combine | ||
import DataMappingModule | ||
import DomainModule | ||
import ErrorModule | ||
import NetworkModule | ||
|
||
public struct RemainsRepositoryImpl: RemainsRepository { | ||
private let remoteRemainsDataSource: any RemoteRemainsDataSource | ||
|
||
public init(remoteRemainsDataSource: any RemoteRemainsDataSource) { | ||
self.remoteRemainsDataSource = remoteRemainsDataSource | ||
} | ||
|
||
public func remainingApplicationsChanges(id: String) -> AnyPublisher<Void, DmsError> { | ||
remoteRemainsDataSource.remainingApplicationsChanges(id: id) | ||
} | ||
|
||
public func fetchMyRemainApplicationItems() -> | ||
AnyPublisher<MyRemainApplicationItemsEntity, DmsError> { | ||
remoteRemainsDataSource.fetchMyRemainApplicationItems() | ||
} | ||
|
||
public func fetchRemainsAvailableTime() -> | ||
AnyPublisher<RemainsAvailableTimeEntity, DmsError> { | ||
remoteRemainsDataSource.fetchRemainsAvailableTime() | ||
} | ||
|
||
public func fetchRemainApplicationList() -> | ||
AnyPublisher<RemainApplicationListEntity, DmsError> { | ||
remoteRemainsDataSource.fetchRemainApplicationList() | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.../DataModule/Sources/Remains/UserCases/lmpl/FetchMyRemainApplicationItemsUseCaselmpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Combine | ||
import DataMappingModule | ||
import DomainModule | ||
import ErrorModule | ||
|
||
public struct FetchMyRemainApplicationItemsUseCaselmpl: FetchMyRemainApplicationItemsUseCase { | ||
private let remainsRepository: any RemainsRepository | ||
|
||
public init(remainsRepository: any RemainsRepository) { | ||
self.remainsRepository = remainsRepository | ||
} | ||
|
||
public func execute() -> AnyPublisher<MyRemainApplicationItemsEntity, DmsError> { | ||
remainsRepository.fetchMyRemainApplicationItems() | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ts/Services/DataModule/Sources/Remains/UserCases/lmpl/FetchRemainAppListUseCaselmpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Combine | ||
import DataMappingModule | ||
import DomainModule | ||
import ErrorModule | ||
|
||
public struct FetchRemainAppListUseCaselmpl: FetchRemainApplicationListUseCase { | ||
private let remainsRepository: any RemainsRepository | ||
|
||
public init(remainsRepository: any RemainsRepository) { | ||
self.remainsRepository = remainsRepository | ||
} | ||
|
||
public func execute() -> AnyPublisher<RemainApplicationListEntity, DmsError> { | ||
remainsRepository.fetchRemainApplicationList() | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ices/DataModule/Sources/Remains/UserCases/lmpl/FetchRemainsAvailableTimeUseCaselmpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Combine | ||
import DataMappingModule | ||
import DomainModule | ||
import ErrorModule | ||
|
||
public struct FetchRemainsAvailableTimeUseCaselmpl: FetchRemainsAvailableTimeUseCase { | ||
private let remainsRepository: any RemainsRepository | ||
|
||
public init(remainsRepository: any RemainsRepository) { | ||
self.remainsRepository = remainsRepository | ||
} | ||
|
||
public func execute() -> AnyPublisher<RemainsAvailableTimeEntity, DmsError> { | ||
remainsRepository.fetchRemainsAvailableTime() | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...s/DataModule/Sources/Remains/UserCases/lmpl/RemainingApplicationsChangesUseCaselmpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Combine | ||
import DataMappingModule | ||
import DomainModule | ||
import ErrorModule | ||
|
||
public struct RemainingApplicationsChangesUseCaselmpl: RemainingApplicationsChangesUseCase { | ||
private let remainsRepository: any RemainsRepository | ||
|
||
public init(remainsRepository: any RemainsRepository) { | ||
self.remainsRepository = remainsRepository | ||
} | ||
|
||
public func execute(id: String) -> AnyPublisher<Void, ErrorModule.DmsError> { | ||
remainsRepository.remainingApplicationsChanges(id: id) | ||
} | ||
} |
Oops, something went wrong.