Skip to content

nifalconi/fueled-challenge-nestjs

Repository files navigation

Description

Code challenge for Fueled for the position of Backend Engineer.

Getting Started

To install the packages.

yarn

Running the app and database

# development
$ yarn run start

# run postgres database
docker-compose up

Features

The list of features that you can expect from the challenge are the following.

  • Create questionnaires with owner, title, and any number of questions.
  • Create and Update questionnaires, with owner, title, and any number of questions.
  • Delete or re-order any questions in the questionnaire.
  • Implement only question types, assume other may exist.

Due to lack of time I decided not to implement user authentication as it was an isolated resource which Nest offers support. Nevertheless, the user resource is already created. It just lacks authentication.

  • Ability to retrieve an authentication token.
  • A questionnaire can only retrieve and edit by the user that owns it.

Project Structure

src                                                                      
├─ resource                         
│  ├─ tests    // resource's tests                          
│  │  ├─ factories                       
│  ├─ resource.graphql              
│  ├─ resource.module.ts            
│  ├─ resource.resolver.ts          
│  └─ resource.service.ts                                      
test // integration tests

How to use

GraphQl Endpoints

The GraphQL endpoints are the following.

  Questionnaires Queries
  getQuestionnaireFromLink(link: String!): JSONObject
  questionnaires(userId: String!): [Questionnaire]
  questionnaire(id: String!, returnType: String): Questionnaire

  Questionnaires Mutations
  createQuestionnaire(createQuestionnaireInput: CreateQuestionnaireInput!): Questionnaire!
  updateQuestionnaire(updateQuestionnaireInput: UpdateQuestionnaireInput!): Questionnaire!
  removeQuestionnaire(id: String!): Questionnaire

  User Queries
  users: [User]!
  user(id: String!): User

  User Mutations
  createUser(createUserInput: CreateUserInput!): User!
  updateUser(updateUserInput: UpdateUserInput!): User!
  removeUser(id: String!): User

Rest Endpoints

GET questionnaire/{questionnaire_link}: JSON 

Test

Two different kind of tests are shown in this project. Unit tests, that can be found src/questionnaire/tests/questionnaire.resolver.spec.ts, and integration tests on test/integration.spec.ts. Due to lack of time, only those are provided as those are a great example of what is expected from a real project.

# test coverages
$ yarn run test:cov

Tools

Database

  • Prisma
  • Postgres

Framework

  • Nest

API

  • Graphql
  • Rest

Testing

  • Jest
  • Rosie
  • Pactum

License

Nest is MIT licensed.

Author

Nicolás Falconi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published