Skip to content

gprelatto/graphql-api-pizza

Repository files navigation

Installation and Usage

  1. Run docker compose command:

     docker-compose up -d
  2. It will generate one containers with two instances inside:

    1. graphql: NodeJS app using TypeScript/TypeORM for GraphQL and API Rest Endpoints with Express
    2. postgres: Database instance, generated with "pizza_db" schema containing pre-seeded data from migrations
  3. Links: For any of the available endpoints, we should send parameter on the body for filtering (being PizzaType optional):

    • date_from
    • date_to
    • pizza_type
    1. GraphQL (Apollo): http://localhost:8090/graphql
    2. Api Endpoints: http://localhost:8090/api
      1. http://localhost:8090/api/sales/by-date/
      2. http://localhost:8090/api/sales/by-date/by-week/
      3. http://localhost:8090/api/ingredients/by-date/
      4. http://localhost:8090/api/ingredients/by-date/by-week/
  4. Inside apollo, we can find 4 pre-built queries aligned to the requisites:

    You need to create a graphQL API that will return data with these filters:
    
    time: (period start date, end date) or per selected calendar month
    selected pizza(s) or all pizza
    
    You should be able to query the following information through the above filters.
    
    Number of unit sold
    Number of ingredients used
    Cost of ingredients
    Sales
  5. In order to have a better data management and storage, I normalized the model from the assumptions:

    Into the following tables:

    • Ingredient: List of ingredients with their unit and cost.
    • Order: List of orders per day and pizza type
    • Pizza_Type: List of available pizza types with their respective "price"
    • Recipe: List of ingredients per pizza type with their necessary quantity.
    • Unit: List of available units

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published