Problem Description
Help! Through an unfortunate accident in our lab, we've lost all of the Discord code. We need your help to rebuild from scratch as quickly as possible!
The app and the backend are now written entirely in JavaScript, using React in the frontend and NodeJS for the backend. We've built an MVP with users, channels, and messages, but we need your help adding one of our favorite features — message reactions.
Please spend up to two hours implementing the frontend and backend for a message reaction feature. Important — when you're done, zip up this directory and submit it back to us. Please edit the last section of this README file with a short blurb telling us what tradeoffs you made and how you might improve your solution if you had more time.
Task details:
Users should be able to react to any message with any of the following emojis: 👍 ❤️ 😂.
Users may react to a single message with more than one emoji, but only once per emoji — clicking on a reaction emoji should act like a toggle, so clicking on the same emoji twice should result in no reaction.
Each reaction should include the sum of users who reacted to the message with the given emoji (e.g. if five users reacted to a message with 👍, the UI should display 👍 5).
The reaction should indicate whether the current user has reacted with that emoji or not (through a different background color, or other means).
Avoid introducing new, glaringly-obvious security vulnerabilities.
Architect your database changes assuming that this API will run in a distributed system with eventually-consistent databases — concurrent user reactions should be handled gracefully.
Hints
No hints available for this question.