Code Monkey home page Code Monkey logo

graphql-api's People

Contributors

chukwuemekachm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

allenkardic

graphql-api's Issues

Users should be able to query Publishers/Publications on the platform

Why is this important?

  • This will enable the querying of publishers on the platform along with its relations on the platform.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a query with a pagination limit and offset
  • THEN - A list of paginated publishers should be returned

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a query with a sorting or filter parameters
  • THEN - A list of filtered and sorted publishers should be returned to match the users

Scenario 3

  • GIVEN - A user
  • WHEN - Makes a query with no filter, limit, offset nor sortparameters
  • THEN - A default list of publishers, limited to a value set by the server should be returned

DEV NOTES

  • Create a getPublishers resolver which queries publisher on the API.

Users should be able to create reviews for books

Why is this important?

  • This will enable the creation of reviews on the platform.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information
  • THEN - A publisher should be created on the platform

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a mutation query with invalid information
  • THEN - Descriptive errors should be returned to the user

Scenario 3

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information which already exists
  • THEN - Descriptive errors should be returned to the user

DEV NOTES

  • Create a createReview resolver which creates a book on the API.

Setup prisma on the platform

Why is this important?

  • Prisma is a layer of abstraction over the database which replaces traditional ORMs. It helps the developer to concentrate on the business logic without bothering about the data layer.

DEV NOTES

  • Set up the a prisma demo database on prisma server.
  • Setup the prisma generated files as well.
  • Add prisma object to the context object.

Users should be able to create books on the platform

Why is this important?

  • This will enable the creation of books on the platform.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information
  • THEN - A publisher should be created on the platform

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a mutation query with invalid information
  • THEN - Descriptive errors should be returned to the user

Scenario 3

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information which already exists
  • THEN - Descriptive errors should be returned to the user

DEV NOTES

  • Create a createBook resolver which creates a book on the API.

Modify Prisma datamodel on the platform

Why is this important

  • This will provide a better and readable name for the relationship between types.
  • It will also add directives to control and improve the behaviour of our types and their relations.

DEV NOTES

  • Use the following resources to solve this: issues and docs.

Users should be able to create authors on the platform

Why is this important?

  • This will enable the creation of authors on the platform.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information
  • THEN - A publisher should be created on the platform

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a mutation query with invalid information
  • THEN - Descriptive errors should be returned to the user

Scenario 3

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information which already exists
  • THEN - Descriptive errors should be returned to the user

DEV NOTES

  • Create a createAuthor resolver which creates an author on the API.

Setup the graph relationship

Why is this important?

  • This will set up the graph relationship between the data models on the API.

DEV NOTES

  • Define the graph data model in the schema.graphql file.

All endpoints should be protected except the signup and login endpoints

Why is this important?

  • This will ensure that only authenticated users can use the service.

Acceptance Criteria

Scenario 1

  • GIVEN - An authenticated user
  • WHEN - Makes any type of request to the get resource
  • THEN - Their request should be processed.

Scenario 2

  • GIVEN - A un-authenticated user
  • WHEN - Makes any type of request to the get resource
  • THEN - Their request should not be processed and an authentication error should be returned.

DEV NOTES

  • Use graphql-shield and the middleware concept to secure to all resources except login and signup

Password should be hashed before being saved to the database

Issue

  • Plain users' password are saved to the database.

Expected

  • When users signup, their passwords should be hashed before being saved to the database.

Instructions To Display Bug

  • Set up the server locally
  • Make a signup mutation query to create a user account using the graphql-playground
  • Open your local Postgres database and observe that the user's password is visible.

Add resolvers for relation fields on the type resolver templates

Why is this important?

  • Currently, relation fields on the types don't have resolvers and Prisma doesn't return relations by default.
  • This will make it easy to return relations belonging to a type when that field is queried on that type.

Acceptance Criteria

  • GIVEN - A user
  • WHEN - Queries the relation on a type
  • THEN - Then those relations(types) should be returned to the user

DEV NOTES

  • Add resolvers for relation fields on the type resolver templates

Users should be able to create publishers on the platform

Why is this important?

  • This will enable the creation of publishers on the platform.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information
  • THEN - A publisher should be created on the platform

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a mutation query with invalid information
  • THEN - Descriptive errors should be returned to the user

Scenario 3

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information which already exists
  • THEN - Descriptive errors should be returned to the user

DEV NOTES

  • Create a createPublisher resolver which creates a publisher on the API.

Users should be able to login

Why is this important?

  • This will enable users to get valid authorization tokens to enable them to access protected resources on our service.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information
  • THEN - A valid JWT token should be returned to me

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a mutation query with invalid information
  • THEN - Descriptive errors should be returned to the user

DEV NOTES

  • Create a login resolver which creates a user account on the API.

Users should be able to create ratings for books

Why is this important?

  • This will enable the creation of ratings for books on the platform.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information
  • THEN - A publisher should be created on the platform

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a mutation query with invalid information
  • THEN - Descriptive errors should be returned to the user

Scenario 3

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information which already exists
  • THEN - Descriptive errors should be returned to the user

DEV NOTES

  • Create a createRating resolver which creates a book on the API.

Setup Prettier on the repository

Why is this important?

  • This will ensure that certain coding conventions are enforced on committing new changes.

DEV NOTES

  • Set up prettier and add the following rules
{
  "singleQuote": true,
  "trailingComma": "all",
  "bracketSpacing": true,
  "arrowParens": "avoid",
  "endOfLine": "lf"
}

These changes should be enforced on commit of the changes with hooks.

Users should be able to query reviews on the platform

Why is this important?

  • This will enable the querying of reviews on the platform along with its relations on the platform.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a query with a pagination limit and offset
  • THEN - A list of paginated books should be returned

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a query with a sorting or filter parameters
  • THEN - A list of filtered and sorted reviews should be returned to match the users

Scenario 3

  • GIVEN - A user
  • WHEN - Makes a query with no filter, limit, offset nor sortparameters
  • THEN - A default list of reviews, limited to a value set by the server should be returned

DEV NOTES

  • Create a getReviews resolver which queries publisher on the API.

Users should be able to query books on the platform

Why is this important?

  • This will enable the querying of books on the platform along with its relations on the platform.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a query with a pagination limit and offset
  • THEN - A list of paginated books should be returned

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a query with a sorting or filter parameters
  • THEN - A list of filtered and sorted books should be returned to match the users

Scenario 3

  • GIVEN - A user
  • WHEN - Makes a query with no filter, limit, offset nor sortparameters
  • THEN - A default list of books, limited to a value set by the server should be returned

DEV NOTES

  • Create a getBooks resolver which queries publisher on the API.

Setup server with GraphQL-yoga

Why is this important?

This would get our GraphQL server up and running so we can build our app on it.

DEV NOTES

Use graphql-yoga to setup the server.

Users should be able to signup

Why is this important?

  • This will enable users to create accounts on our API which gives them access to our service.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information
  • THEN - An account should be created on the service for the user

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a mutation query with invalid information
  • THEN - Descriptive errors should be returned to the user

Scenario 3

  • GIVEN - A user
  • WHEN - Makes a mutation query with valid information which already exists
  • THEN - Descriptive errors should be returned to the user

DEV NOTES

  • Create a signup resolver which creates a user account on the API.

Users should be able to query Users/Authors on the platform

Why is this important?

  • This will enable the querying of authors on the platform along with its relations on the platform.

Acceptance Criteria

Scenario 1

  • GIVEN - A user
  • WHEN - Makes a query with a pagination limit and offset
  • THEN - A list of paginated publishers should be returned

Scenario 2

  • GIVEN - A user
  • WHEN - Makes a query with a sorting or filter parameters
  • THEN - A list of filtered and sorted publishers should be returned to match the users

Scenario 3

  • GIVEN - A user
  • WHEN - Makes a query with no filter, limit, offset nor sortparameters
  • THEN - A default list of publishers, limited to a value set by the server should be returned

DEV NOTES

  • Create a getAuthors resolver which queries publisher on the API.

Setup data loader on the platform

Why is this important?

  • GraphQL is a powerful query language which gives the clients the opportunity to query the server and request for what they want. This graph relationship can be very heavy on the server. Hence data loaders help with caching e.t.c to reduce the number of queries run.

DEV NOTES

  • Install a data loader and set it up on the platform.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.