Skip to content

Commit

Permalink
[Feat/#7] ContentUseCase 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-seonwoo committed Jun 7, 2024
1 parent 28678a3 commit b267f34
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Tving-Clone/Tving-Clone/Domain/UseCases/ContentUseCase.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// FetchContentUseCase.swift
// Tving-Clone
//
// Created by Seonwoo Kim on 6/7/24.
//

import Foundation

protocol ContentUseCase {
func fetchContent(completion: @escaping (Result<[Content], Error>) -> Void)
func fetchContentDetail(code: String, completion: @escaping (Result<ContentDetail, Error>) -> Void)
}

final class DefaultContentUseCase {

private let repository: ContentRepository

init(repository: ContentRepository) {
self.repository = repository
}
}

extension DefaultContentUseCase: ContentUseCase {
func fetchContent(completion: @escaping (Result<[Content], any Error>) -> Void) {
repository.getMovieInfo(completion: completion)
}

func fetchContentDetail(code: String, completion: @escaping (Result<ContentDetail, any Error>) -> Void) {
repository.getDetailInfo(code: code, completion: completion)
}
}

0 comments on commit b267f34

Please sign in to comment.