Skip to content

Latest commit

 

History

History
81 lines (63 loc) · 1.3 KB

README.md

File metadata and controls

81 lines (63 loc) · 1.3 KB

nestjs-graphql-tolkien

NestJS GraphQL with TypeORM and MariaDB (MySQL)

Screenshot-Fellowship-of-the-Ring

Graphql-Fellowship-of-the-Ring.mp4

Database Migration

Check or change the database name, user and password in .env file

  1. Create database
  2. Create database user
  3. Make changes in .env file
  4. Run migrate command:
npm run migrate
  1. To generate migration file, if needed (it is already generated, so this step can be skipped):
npm run migration:gen

Database seeding

To seed the database run:

npm run seed:run

Sample Query

{
  cultures(
    options: {
      take: 100
      skip: 0
      sort: { name: ASC }
      filter: { name: { search: "Fellowship" } }
    }
  ) {
    totalItems
    items {
      id
      name
      characters(
        options: {
          take: 10
          skip: 0
          sort: { name: ASC }
          filter: { name: { search: "Gandalf" } }
        }
      ){
        totalItems
        items{
          id
          name
        }
      }
    }
  }
}

Entities

Characters

Locations

Cultures

Races

Artefacts

Battles

Quotes