You have 24 hours to build a simple GraphQL API with a React frontend. The API must be written in Node.js (using express), and you may use the following tools/packages/libraries:
- express (server must be express)
- apollo (both server and client)
- lodash/underscore
- An ORM (i.e. sequelize) or SQL query builder (i.e. knex.js) of your choice
- A node Postgres library (i.e. node-postgres) to connect with your ORM or query builder if you choose to use one
- A client side UI component library (material-ui, bootstrap, etc.)
Note: Do not use any autogeneration libraries/frameworks such as PostGraphile or Hasura. Also, do not fork this repo.
The application consists of users and products.
Each user must have, but is not limited to:
- ID
- First Name
- Last Name
- Email (unique)
Please note:
- These users are the only users that are able to make requests via the API.
- User creation/maintenance is not done through the API (see Database section below).
- Users can own many products
Each product must have, but is not limited to:
- ID
- Name
- Description
- Price
- Image
- Postgres
- All tables in the database must be created programatically
- The user table should be seeded with five (5) users
You must implement an authentication system so that the API knows which of the users is making the request. All requests should ensure that an authorized user is making the request. In the event of an unauthorized user, an error should be thrown.
The following operations should be implemented:
- Add product
- All fields required except ID and image
- Update product
- All fields required except image
- Delete product
- Get product
- Upload product image
- Get list of all products
- Attach product to requesting user
- Remove product from requesting user
- List products attached to requesting user
Display a list of users with pagination. Additionally display the products a user owns in anyway you see fit.
Please note: The frontend does NOT need to be able to create, edit, or delete data. Bonus points for a catchy design.
You should write tests to back up your code. You are free to use any testing tools or frameworks you like.
When you are finished (or out of time) you will push up the application to a git repo. Then please notify Mohammad Farooqi via email (mohammad@pumpjackdataworks.com) with the subject Pumpjack Code Challenge and the link to the github repo. Please include:
- Instructions on how to create and seed database tables
- Instructions on how authentication works
- Anything else you think we should know to run the application (if anything) Mohammad is available for any questions you may have via email at mohammad@pumpjackdataworks.com.
