Code Monkey home page Code Monkey logo

nerdery-graphql-backend-test's Introduction

Nerdery GraphQL Take-Home Test Instructions

Objective

Your task is to complete the implementation of three functions in the resolver.ts file. These functions are responsible for fetching and manipulating user data for a GraphQL API.

You will be provided with user data from two different sources (userData1 and userData2). Each source has a different structure for representing user information. Your goal is to merge the data from these two sources and normalize it into a single structure that conforms to the schema defined in the types.ts file.

Instructions

  1. Merge User Data: Implement the getUsers() function in resolver.ts to merge user data from two different sources (userData1 and userData2) and return an array of user objects. Ensure that the merged user data contains information from both sources.

  2. Get User by ID: Implement the getUserById(id: string | number, source: DataSource) function in resolver.ts to find a user by their ID in the appropriate data source (userData1 or userData2). The function should return the user object if found, or null otherwise.

  3. Normalize User: Implement the normalizeUser(user: any) function in resolver.ts to normalize a user object to match the schema structure defined in types.ts. The normalized user object should contain the required fields (id, firstName, lastName, emailAddress, phoneNumber, source). Handle any inconsistencies or variations in the data structures of the two sources during normalization.

Guidelines

  • Use TypeScript for your implementation.
  • Feel free to modify the provided files (resolver.ts) as needed.
  • You are allowed to create additional helper functions or files if necessary.
  • Ensure that your solution is clean, readable, and follows best practices.
  • Test your solution locally before submitting by running npm start and going to the GraphQL playground.

Extra Credit (Optional)

  • Resolver Tests: Write test cases for the resolver functions using a testing framework like Jest. Test-driven development (TDD) is encouraged to demonstrate your understanding of unit testing. You can test this by running: npm test

Submission

Once you have completed the tasks, please zip the entire project directory and email it to [email protected] within the allotted time. Include your name and "GraphQL Take-Home Test" in the email subject.

If you have any questions or encounter any issues during the test, feel free to reach out to us for assistance.

Good luck!

nerdery-graphql-backend-test's People

Contributors

solo-nerdery avatar

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.