-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTodoRepositoryImpl.swift
More file actions
44 lines (35 loc) · 1.29 KB
/
TodoRepositoryImpl.swift
File metadata and controls
44 lines (35 loc) · 1.29 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
37
38
39
40
41
42
43
44
//
// 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 fetchReferenceItems(_ numbers: [Int]) async throws -> [Int: TodoReferenceItem] {
try await todoService.fetchReferenceItems(numbers)
}
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)
}
func undoDeleteTodo(_ todoId: String) async throws {
try await todoService.undoDeleteTodo(todoId: todoId)
}
}