Welcome to the Zipmex backend challenge! Thanks for attempting it, we wish you good luck!
We prefer well-thought out, quality code over quick-and-dirty solutions. So - please take your time, if you need it.
- Create an server application in your language/framework of choice.
- Write an algorithm that will take a
JSON
object structured like Appendix 1 Input and transform it into the structure shown under Appendix 2 Output. In other words, the algorithm will place "children" objects under the correct "parent" objects. - Add a single endpoint that takes the unstructured
JSON
object as parameter and responds with the structuredJSON
object.
- Please use Elixir, Scala or NodeJS.
- Do not forget to write comprehensive tests.
- Do not forget to write documentation.
- Have some fun!
- Please submit via a git format-patch. Send your patch to the hiring team.
- Please keep track of the number of hours spent on this challenge and send along with your submission.
- As a reviewer, I can run your tests with a simple command.
- As a reviewer, I can boot your application locally and call the endpoint.
- As a reviewer, I can find clear documentation on how to check for the above two deliverables.
{"0":
[{"id": 10,
"title": "House",
"level": 0,
"children": [],
"parent_id": null}],
"1":
[{"id": 12,
"title": "Red Roof",
"level": 1,
"children": [],
"parent_id": 10},
{"id": 18,
"title": "Blue Roof",
"level": 1,
"children": [],
"parent_id": 10},
{"id": 13,
"title": "Wall",
"level": 1,
"children": [],
"parent_id": 10}],
"2":
[{"id": 17,
"title": "Blue Window",
"level": 2,
"children": [],
"parent_id": 12},
{"id": 16,
"title": "Door",
"level": 2,
"children": [],
"parent_id": 13},
{"id": 15,
"title": "Red Window",
"level": 2,
"children": [],
"parent_id": 12}]}
[{"id": 10,
"title": "House",
"level": 0,
"children":
[{"id": 12,
"title": "Red Roof",
"level": 1,
"children":
[{"id": 17,
"title": "Blue Window",
"level": 2,
"children": [],
"parent_id": 12},
{"id": 15,
"title": "Red Window",
"level": 2,
"children": [],
"parent_id": 12}],
"parent_id": 10},
{"id": 18,
"title": "Blue Roof",
"level": 1,
"children": [],
"parent_id": 10},
{"id": 13,
"title": "Wall",
"level": 1,
"children":
[{"id": 16,
"title": "Door",
"level": 2,
"children": [],
"parent_id": 13}],
"parent_id": 10}],
"parent_id": null}]