|
| 1 | +# Sherpa° Coding Challenge |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +Hi! If you're reading this then it's because you're in the interview process with us at sherpa° and have been invited to |
| 6 | +complete the coding challenge. Congratulations! |
| 7 | + |
| 8 | +This coding challenge is designed to assess your ability while giving you the freedom to express yourself and show off |
| 9 | +what you consider to be best practices. |
| 10 | + |
| 11 | +## Setup |
| 12 | + |
| 13 | +This repo contains the skeleton of an express app in typescript, to which you will add functionality. The code here was |
| 14 | +built for node version 14. |
| 15 | + |
| 16 | +The first step is to run `npm i` to install the required dependencies. |
| 17 | + |
| 18 | +A handful of scripts are provided, `npm run build` will build the application, `npm run start` will start the |
| 19 | +application, `npm run test` will run the tests. |
| 20 | + |
| 21 | +The last script `generateData` should be executed in order to populate a json file at `data/data.json` this is required |
| 22 | +because it is necessary that the data have dates that are in the near future. |
| 23 | + |
| 24 | +## The scenario |
| 25 | + |
| 26 | +You are a developer at a consulting company to work on a brand-new project, requirement is to build an application to |
| 27 | +service an events management company. |
| 28 | + |
| 29 | +Currently, everything is being managed by hand and this is proving unwieldy. The first step of the first iteration of |
| 30 | +the solution is to build a REST api to perform CRUD operations on events. |
| 31 | + |
| 32 | +### Requirements |
| 33 | + |
| 34 | +#### The Data |
| 35 | + |
| 36 | +Determine how to model the data. The clients have provided a sample of their data in `data/data.json`. Your project |
| 37 | +manager has told you that they have events, events have a location, a name, and an organizer, who is a member of staff |
| 38 | +responsible for the event. You also know that the're will be a need to associate a list of invitees with events, along |
| 39 | +with their rsvp status. |
| 40 | + |
| 41 | +**Derive a data model for this relation of entities. Create the tables in the sqlite database, you may want to think |
| 42 | +about maintainability and documentation, an ERD might be useful, as might a migration process, you may want to think |
| 43 | +about using an ORM.** |
| 44 | + |
| 45 | +The data given to you by the clients is a sample of the data as you expect to receive it. When the time comes they will |
| 46 | +provide a large json file to import into the db. |
| 47 | + |
| 48 | +**Import the sample data into the database, write a script to do this and bear in mind it must operate at scale. You |
| 49 | +should think about data integrity, these clients are not tech savvy and we dont know how this json is being generated** |
| 50 | + |
| 51 | +#### The api |
| 52 | + |
| 53 | +`GET /events` |
| 54 | + |
| 55 | +Retrieve upcoming events, the endpoint must accept the following query parameters: |
| 56 | + |
| 57 | +- `from`: optional, number representing of milliseconds elapsed since January 1, 1970, defaults to `Date.now()` only |
| 58 | + return events after this |
| 59 | +- `until`: optional, number representing of milliseconds elapsed since January 1, 1970, if omitted assume all upcoming |
| 60 | + events are included |
| 61 | +- `limit`: optional, maximum number of results to return |
| 62 | +- `offset`: optional, number of results to offset results returned by |
| 63 | + |
| 64 | +The required response is: |
| 65 | + |
| 66 | +``` |
| 67 | +{ |
| 68 | + results: [ |
| 69 | + { |
| 70 | + id: <unique identifier of event in our system>, |
| 71 | + name: string, |
| 72 | + date: Date, |
| 73 | + isOutside: boolean |
| 74 | + attandees: [] // empty array is fine for first iteration |
| 75 | + organizer: { |
| 76 | + id: <unique identifier of organizer in our system>, |
| 77 | + name: string |
| 78 | + }, |
| 79 | + } |
| 80 | + ], |
| 81 | + paginationParams: { |
| 82 | + limit: number, |
| 83 | + offset: number, |
| 84 | + total: number, |
| 85 | + } |
| 86 | +} |
| 87 | +``` |
| 88 | + |
| 89 | +`GET /events/{eventId}` |
| 90 | + |
| 91 | +Retrieve details for an upcoming event |
| 92 | + |
| 93 | +``` |
| 94 | +{ |
| 95 | + id: <unique identifier of event in our system>, |
| 96 | + name: string, |
| 97 | + date: Date, |
| 98 | + isOutside: boolean |
| 99 | + attandees: [] // empty array is fine for first iteration |
| 100 | + organizer: { |
| 101 | + id: <unique identifier of organizer in our system>, |
| 102 | + name: string |
| 103 | + }, |
| 104 | + // if an event is outside and occuring withing 7 days, call any weather api to get the following details |
| 105 | + // if an event is not outside, or not occuring within 7 days this should be null |
| 106 | + weather: null || { |
| 107 | + temperatureInDegreesCelcius: number, |
| 108 | + chanceOfRain: number 0-100 |
| 109 | + } |
| 110 | + // if an event is happening in any country other than canada, fetch the visa and proof of vaccination requirements |
| 111 | + // if an event is happening in canada, leave this null |
| 112 | + visaRequirements: null | string |
| 113 | + proofOfVaccineRequired: null | boolean |
| 114 | +} |
| 115 | +``` |
0 commit comments