phoenix-interview-task
phoenix-interview-task copied to clipboard
Interview task for assessing candidates applying for software engineer role at materiias d.o.o
Task
You are building a simple apollo graphql server that exposes a single query getUser and a mutation updateUser as well as setting up a background service that on an interval of 1 minute updates a field from the user object to a scheduled value for message that is prefixed by automated -
Initially upon the server running make a single request to https://random-data-api.com/api/v2/users to retrieve the user object and store the user details in memory database for later usage, note that we are not interested in all the data provided by the API end-point thus store only the properties that are needed by your user object
// The user object
interface User {
id: number
uid: string
first_name: string
last_name: string
username: string
email: string
message: string
}
Notes
- You can use any packages to achieve the task as long as you comment your reasoning behind it
- The server you are building should be scalable and adheres with latest best practices
- The mutation
updateUsershould only accept astringvalue, anything else should throw an error
Requirements
- Use TypeScript to build the server application
- Set up a background service that runs every 1 min and updates the
userobject that is stored in memory propertymessageto a value ofautomated - [DateNow] - When calling the
getUserquery you should be able to retrieve the currentuserdetails in memory - When calling the
updateUsermutation you should be able to update themessageproperty of the currentuserdetails in memory with a value ofmanual - [Message]were the[Message]is whatever the value sent by the mutation - Implement error handling to gracefully handle any issues that may arise
Examples
- When calling the
getUserquery and requesting all the user object properties a response similar to the one below should be retrieved:{ "id": 3108, "uid": "c60f4629-14e8-4bcf-bfc8-00e92222ddb2", "first_name": "Chauncey", "last_name": "Mann", "username": "chauncey.mann", "email": "[email protected]", "message": "[some-message]" } - When calling the
updateUsermutation with a given message such thatmessage: "Hello world!"the user object in the servers memory database should update themessageproperty with a value ofmanual - Hello world! - Whenever a minute passes your background service should update the
userobjectmessageproperty with a value ofautomated - [DateNow]where[DateNow]is the current time in UTC format
Assessment Criteria
- Code quality and maintainability
- Understanding of TypeScript, Node.js, Background services and Apollo GraphQL
- Integration skills with third-party APIs
- Error handling and unit testing
- Understanding of schedule-based tasks and implementation