Introduction
Users gave feedback that there are many mentors on our platform (we have hundred+ mentors 🎉🎉 ) that would like to ‘save’ somewhere so that they could comeback to them once they have finished scrolling.
This is because they will not approach all hundred mentors and furthermore, our platform has a daily limit on how many you may approach
Hence, we implemented the wishlish feature.
Design
Each mentor card will have a heart shape, which user’s can select
User’s then can find the mentors on the wishlist page
User may remove mentor’s from the wishlist by clicking on the heart again
Potential Implementation
Local Browser Cache (Local Storage)
A simple solution would be to store in the local storage as an array
Pros: Easy to implement
const wishlist_key = '__AMIGOALS_WISHLIST__';
window.localStorage.setItem(wishlist_key, JSON.stringify(wishlist));
JSON.parse(window.localStorage.getItem('wishlist_key'));Cons:
- Not observable
- Mentor information may change, some may no longer be bookable
Store in Backend
Create a user_wishlist table that stores users.
Endpoints
- POST /wishlist/:username
- DELETE /wishlist/:username
- GET /wishlist
Where username belongs to the mentor of interest
Validations / Edge cases
- Mentor must exist (for both adding and deleting from wishlist)
- User can only wishlist the same mentor once
- User can only add mentor to their own wishlist
CREATE TABLE user_wishlist (
id serial NOT NULL,
fk_user_id VARCHAR(50) NOT NULL,
fk_mentor_id VARCHAR(50) NOT NULL,
created_at timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
FOREIGN KEY (fk_user_id) REFERENCES tbl_user(id)
);
-- create unique index to ensure that you cannot wishlist the same mentor more than once
create unique index user_wishlist_index on user_wishlist (fk_user_id, fk_mentor_id);Pros
- Observability: we know who are the more popular mentor. This would give the team insights to improve the platform
Cons:
- Additional Storage and api calls to the backend
Summary
This was a small and non critical feature, but would give user’s better experience for our platform.
Because it was low effort and medium reward, we went ahead and implemented it.
