-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTodoRepositoryImpl.swift
More file actions
36 lines (29 loc) · 1.02 KB
/
TodoRepositoryImpl.swift
File metadata and controls
36 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// TodoRepositoryImpl.swift
// DevLog
//
// Created by 최윤진 on 11/29/25.
//
import Foundation
final class TodoRepositoryImpl: TodoRepository {
private let todoService: TodoService
init(todoService: TodoService) {
self.todoService = todoService
}
func fetchTodos(_ query: TodoQuery, cursor: TodoCursor?) async throws -> TodoPage {
let responseCursor = cursor.map { TodoCursorDTO.fromDomain($0) }
let response = try await todoService.fetchTodos(query, cursor: responseCursor)
return try response.toDomain()
}
func fetchTodo(_ todoID: String) async throws -> Todo {
let response = try await todoService.fetchTodo(todoID: todoID)
return try response.toDomain()
}
func upsertTodo(_ todo: Todo) async throws {
let request = TodoRequest.fromDomain(todo)
try await todoService.upsertTodo(request: request)
}
func deleteTodo(_ todoID: String) async throws {
try await todoService.deleteTodo(todoID: todoID)
}
}