Links

Step 3. Upvoting the features

Step duration ~18 min

Step 3.1. User management

3:44
To set up a user management we are doing the following:
  • Creating API-endpoint on App users(WebUser) data structure with condition role like admin on user's session;
  • Creating new web-page, with Security condition on role == admin
  • Add a Table on that page.

Step 3.2. Setup the upvoting mechanism

15:08
Let's add two new fields to Features data structure:
  • upvotes, type of number
  • users_upvoted_ids, type of arrayLink→WebUser
Then, create a new page for upvoting (available for all the authorised users):
Note, that we add the new field Upvotes as a counter on the cards.
Then, we are configuring actions:
  • Add new data structure upvotes with the following fields:
    • user_id, type of link→WebUser;
    • feature_id, type of link→Features
  • Create API endpoint for adding objects to upvotes;
  • Design a scenario for counting votes (avoiding duplication!)
Add an element to users_upvoted_ids
Counting the length of users_upvoted_ids
Finally, we a sorting the cards by upvotes.