HeavyConnect Challenge

HeavyConnect Technologies

  • AngularJS: Old but strong.
  • IONIC V1: A nightmare, prepare yourself (not included in the challenge).
  • Django: A powerful tool. Use with caution!

The challenge

1. Let's see your Django skills.

Write a simple Django API using the Django Rest Framework with the following.

A model called Report with:

  • id: Autogenerated by Django.
  • message: (TextField) the report content.
  • author: (ForeignKey: User) The report creator. You can use Django's default user model.
  • supervisors: (ManyToManyField: User) Who will read the report.

A Model called ReportResponse with:

  • id: Autogenerated by Django.
  • message: (TextField) the response content.
  • report: (ForeignKey: Report)
  • author: (ForeignKey: User) The response creator.

An endpoint that returns a list of reports and has:

  • PATH: '/reports'
  • METHOD: GET
  • PARAMS:
    • user_id: (int) Not required. If given, only reports related to this user should be returned. The user can be the author, supervisor or author of a response of the report.
    • pagination_offset: (int) Not required. An offset for the response list. E.g.: If you get 100 reports and the offset is 50, only the last 50 reports should be returned.
    • pagination_limit: (int) Not required. A limitation of the result size. E.g.: If you get 100 reports, the offset is 10 and the limit is 20, only the reports from 11º to 30º should be returned.
  • RETURNS: A JSON with a list of reports containing:
    • message
    • author: with first_name, last_name and email.
    • supervisors: a list of users with first_name, last_name and email.
    • responses: a list of (ReportResponse) with:
      • message
      • author: with first_name, last_name and email.

Use fixtures to create 20 users and insert 100 reports in the database, with two report responses for each one.

Notice that you may have to handle a large number of reports, so, try to follow the best practices for Django and write optimized queries.

2. Back to AngularJS.

Write a simple front-end in AngularJS to show a list of reports using the Django API that you built. Also, add a selection box with a list of all users. Once you select a user, you should list only the reports related to this user. On the reports list, each item should contain all information, including author, supervisors and the responses.

Feel free to make the front-end look beautiful. It is not required but will give you some extra points.

3. The GitHub.

Add the project to your GitHub account and send us the link.