Code challenge for Fueled for the position of Backend Engineer.
To install the packages.
yarn
# development
$ yarn run start
# run postgres database
docker-compose up
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.
src
├─ resource
│ ├─ tests // resource's tests
│ │ ├─ factories
│ ├─ resource.graphql
│ ├─ resource.module.ts
│ ├─ resource.resolver.ts
│ └─ resource.service.ts
test // integration tests
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
GET questionnaire/{questionnaire_link}: JSON
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
Database
- Prisma
- Postgres
Framework
- Nest
API
- Graphql
- Rest
Testing
- Jest
- Rosie
- Pactum
Nest is MIT licensed.
Nicolás Falconi