From the course: Planning a Versioned RESTful API with GitHub Copilot

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Implementing repository pattern on book

Implementing repository pattern on book

- [Instructor] Now we are onto the next layer, that is the repository layer. And for that, I need to create the directory first, called repositories. And we are specifically writing book repositories, so I'm going to name this as book_repository.py and leave this file as empty. Now, in order to fill this file, there are a few things that I need. I need to look into my current book model, I need to provide context around what libraries we are using. And that's pretty much about it. I don't even need book schema because this was already used in the previous video to generate model code. So I'm going to delete that. And I'm going to come here and give Open Editors in the context, and now I'm going to add my prompt that says create "BookRepository" and add methods to create, update, soft-delete, we do not want to permanently erase data, we want to just have it in a way so that it's not searchable, get_all_books, get_one_book, and this is so that when we create and connect APIs, we have…

Contents