Example 3 - "Bookstore” application

Schema

We are going to use this schema as the sample schema for the examples that follow - This is the Gravity Bookstore sample database from DatabaseStar.

This schema contains the following tables:

  • book: a list of all books available in the store.

  • book_author: stores the authors for each book, which is a many-to-many relationship.

  • author: a list of all authors.

  • book_language: a list of possible languages of books.

  • publisher: a list of publishers for books.

  • customer: a list of the customers of the Gravity Bookstore.

  • customer_address: a list of addresses for customers, as a customer can have more than one address, and an address has more than one customer.

  • address_status: a list of statuses for an address, because addresses can be current or old.

  • address: a list of addresses in the system.

  • country: a list of countries that addresses are in.

  • cust_order: a list of orders placed by customers.

  • order_line: a list of books that are a part of each order.

  • shipping_method: the possible shipping methods for an order.

  • order_history: the history of an order, such as ordered, cancelled, delivered.

  • order_status: the possible statuses of an order.

Here is the ERD of this sample bookstore database:

  • This is the schema in the Neurelo Schema Language JSON Specification format

JSON Schema

GET endpoint examples

  • Get one author by id 19283

  • Select first 10 publisher and books ordered by publisher name

  • Select customer scalars and their orders. Filter by email containing "cdbaby.com"

  • Select book_id and the number of books sold where sales > 8

  • Get list of customer order with order_history and scalars. Filter by status is Order Received

  • Get list of books not translated to "English” (.English. - includes “English”, “British English”, “United States English”), or “Spanish

POST endpoint examples

  • Create a new book with author

  • Create many authors

  • Create a new author with many books

  • Create a customer with address and address status

PATCH endpoint examples

  • Update a single address

  • Update multiple addresses based on filter

  • Update book title where title and language

DELETE endpoint examples

  • Delete publishers that have forbidden books published

Last updated