Skip to content

Commit

Permalink
feat: 레포지토리 구현(#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
sozohoy committed Feb 6, 2024
1 parent 0571ac3 commit 2c58e20
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions SUWIKI/SUWIKI/Data/Repositories/DefaultLectureRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,14 @@ final class DefaultLectureRepository: LectureRepository {
)
return dtoLecture.lecture.map { $0.entity }
}

func fetchDetail(
id: Int
) async throws -> DetailLecture {
let target = APITarget.Lecture.detail(
DTO.DetailLectureRequest(lectureId: id)
)
let dtoDetailLecture = try await APIProvider.request(DTO.DecodingDetailLectureResponse.self, target: target)
return dtoDetailLecture.detailLecture.entity
}
}
4 changes: 4 additions & 0 deletions SUWIKI/SUWIKI/Domain/Repositories/LectureRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ protocol LectureRepository {
page: Int,
major: String?
) async throws -> [Lecture]

func fetchDetail(
id: Int
) async throws -> DetailLecture
}

0 comments on commit 2c58e20

Please sign in to comment.