charlires / everyio-challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CHALLENGE

https://github.com/every-io/engineering-interivew-be

Project setup

To setup this project you have a multiple of options

Using Docker (most convenient)

Install Docker in your computer
https://docs.docker.com/get-docker/

Use this command

docker-compose up

Using NodeJS CLI

To run this project you need to have nodejs18 installed and mongodb running in your local computer

npm i
npm run build
MONGODB_HOST=YOUR_MONGODB_HOST npm start

Run tests

npm test

Run using Devcontainer (if you are a maintainer)

Run project as devcontainer, this option requires Docker and VSCode to be installed in your computer

https://code.visualstudio.com/download
https://docs.docker.com/get-docker/

In vscode open your command palette and run Dev Containers: Reopen in Container and wait for it to finish

npm i

Go to VScode RUN (shift+cmd+d) and run it

reference: https://code.visualstudio.com/docs/devcontainers/containers

General Notes

GraphQL

You can find the graphql scheme here

Unit tests

For time contrains only unittest for the busines logic have been inplemented you can find them here

Authentication

For simplicity in this challenge authentication and jwt token validation was omited When the docker-compose runs 3 users are created with the following email and role

These users are created when the mongodb container runs for the first time see: mongo-init.js

To make a request authenticated with a user you just dend a http header Authorization: user@every.io you can use any of the above or create you own straight in mongodb.

There is graphql resolver to manage users.

TODOs, Improvements, Most have:

  • add integration tests
  • add cors headers
  • add graphql mapper to return dates as rfc3999
  • add jwt token validation
  • add user resolver

About


Languages

Language:TypeScript 92.1%Language:Dockerfile 6.3%Language:JavaScript 1.6%