- Create mutations to create a book and an author in the database.
- Implement a request to get a list of books with authors. It is important to limit yourself to two queries to the database for one graphql query. For author use fieldResolver.
- Tests:
- Creating an author
- Book creation
- Receive books without authors
- Receiving books with authors Graphql schema types:
type Book {
bookId: number;
name: string;
pageCount: number;
authorId: number;
author: Author;
}
type Author {
authorId: number;
name: string;
}
An example of a query to graphql:
query {
books () {
name
author {
name
}
}
}
To run JS - npm run start
To run TS - npm run startts