Created
July 5, 2021 15:18
-
-
Save renaudmathieu/e2bd271b781dc05e50b97a23204234e8 to your computer and use it in GitHub Desktop.
ktor_part3_TodoRepositoryImpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TodoRepositoryImpl: TodoRepository { | |
override suspend fun create(todo: Todo): Todo = newSuspendedTransaction{ | |
TodoModel.new{ | |
subject = todo.subject | |
done = todo.done | |
}.toEntity() | |
} | |
override suspend fun getAll(): List<Todo> = newSuspendedTransaction{ | |
TodoModel.all().map(TodoModel::toEntity) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment