For this challenge you will be creating highly simplified version of the Hindsite web app from scratch using Ruby on Rails. This is a functional challenge, so you don't need to worry about design too much. You should use Git as you build your solution. Note, this doesn't need to be hosted on any services such as AWS/Azure, just show us it running on your machine!
Your app is to have three models: users, organisations, and posts. Your database should closely resemble the following entity-relationship diagram:
The following illustrations should only serve as an example. You do not need to follow the designs presented below. You can split functionality out to other pages. Just make sure it is all there.
An unauthenticated user should first be prompted to log in, sign up, or reset their password:
To have a user sign in to the application, we'll need a sign up page.
Once a user has signed up, the home page should be an overview of actions for that organisation: viewing posts, editing the organisation, or leaving the organisation.
Leaving an organisation should allow the user to belong to no organisation and can be invited to another organisation. The departed user's posts should be deleted.
Finally, the post page should show all posts that belong to the user and their fellow employees at their organisation.
Here are some optional exercises for you to do. We recommend that you try at least one of them. They are all mutually compatible, so you could do all of them. Some will require changes to the structure of the database.
-
Users details (easy) Allow users to change their own name, email address, or password.
-
Modifying/Deleting Posts (easy) Allow users to modify or delete existing posts.
-
Departed Employee Post Storage (easy) Create a way for posts of a departed employee to be stored. Create a link on the "View Posts" route that would direct a user to a table of prior employees posts. You may need to make schema changes for this exercise. Bonus: If a departed employee re-joins the organisation, have a way for their past posts to be re-added to current posts.
-
Filtering posts (medium) Allow users to filter which posts are visible based on employee or a date range or both.
-
Multiple organisations (tricky) Extend organisation functionality to allow users to belong to more than one organisation. You will need to rethink the posts model. Posts currently belong to a user (who belongs to a single organisation). If there are multiple organisations involved, this falls apart, because you don't know which organisation the user posted to.
-
React frontend Use React functional components to build the frontend on your Rails application.
-
Functional or Unit tests Adding tests is a good idea. We don't mandate that you write any for this challenge, but feel free to go ahead and write some tests for your code.
-
Your own idea Feel free to add a feature of your own devising.
You will be judged on the the appropriate use of database constraints, your choice of data types, working data validation, the general quality of your code, and how closely your solution matches this spec. Be a show off! Impress us with your strong command of relational databases and idiomatic code.