Skip to content

Commit

Permalink
[Feat] sopt-makers#153- Repository, Repository Interface 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
devxsby committed Apr 15, 2023
1 parent b4f8e49 commit 21ff201
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,24 @@ import Network

public class ShowAttendanceRepository {

private let networkService: AttendanceService
private let attendanceService: AttendanceService
private let cancelBag = CancelBag()

public init(service: AttendanceService) {
self.networkService = service
self.attendanceService = service
}
}

extension ShowAttendanceRepository: ShowAttendanceRepositoryInterface {
public func fetchAttendanceScheduleModel() -> AnyPublisher<AttendanceScheduleModel, Error> {
return self.attendanceService.fetchAttendanceSchedule()
.map { $0.toDomain() }
.eraseToAnyPublisher()
}

public func fetchAttendanceScoreModel() -> AnyPublisher<Domain.AttendanceScoreModel, Error> {
return self.attendanceService.fetchAttendanceScore()
.map { $0.toDomain() }
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
import Combine

public protocol ShowAttendanceRepositoryInterface {

func fetchAttendanceScheduleModel() -> AnyPublisher<AttendanceScheduleModel, Error>
func fetchAttendanceScoreModel() -> AnyPublisher<AttendanceScoreModel, Error>
}

0 comments on commit 21ff201

Please sign in to comment.