humblFINANCE / humblFINANCE-frontend

the official codebase for the humblFINANCE web app
https://humbl-finance-frontend.vercel.app
Other
0 stars 0 forks source link

[FEAT]: Create `Watchlist` component #28

Closed jjfantini closed 1 week ago

jjfantini commented 1 month ago

Main Goal

Create a modal that allows users to create, name, and modify multiple watchlists of tickers. On the

Image

The modal popup should have functionality like this, and look similar to the video.

https://github.com/humblFINANCE/humblFINANCE-frontend/assets/63276164/dba62d9a-fd70-4ef0-a149-80faa9198418

Tasks

  1. Create a NextUI Watchlist Modal

    • [x] modal should fire when the settings icon is clicked, next to the dropdown of available watchlists for the user
  2. Enable Watchlist Creation and Management

    • [ ] Check the ticker entered against an exhaustive list of all valid tickers (will be provided, and should be stored in memory), only add the ticker to the watchlist if it is valid.
    • [ ] The watchlists should be saved to the supabase database and linked to the user.
  3. Change the watchlist name

    • [x] When you hover over the watchlist name on the right hand side of the modal, you should be able to rename the watchlist and save the new name. This will updates in the Supabase Watchlists table (detailed below).

Notes

Watchlist Creation Permissions

Watchlist, User, Ticker Relational DB Schema Logic

1.  Users Table: This table will store information about each user.
2.  Watchlists Table: This table will store information about each watchlist and will reference the Users table.
3.  Tickers Table: This table will store the tickers and will reference the Watchlists table.

This logic should also include the user_role, what type of subscriber they are (basic, premium or power) Include RLS for these tables and the user_role.

User Table:

CREATE TABLE profiles (
    user_id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL UNIQUE,
    password_hash VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Watchlist Table:

CREATE TABLE watchlists (
    watchlist_id INT AUTO_INCREMENT PRIMARY KEY,
    user_id INT,
    name VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (user_id) REFERENCES Users(user_id)
);

Tickers Table:

CREATE TABLE watchlist_symbols (
    symbol_id INT AUTO_INCREMENT PRIMARY KEY,
    watchlist_id INT,
    symbol VARCHAR(10) NOT NULL,
    FOREIGN KEY (watchlist_id) REFERENCES Watchlists(watchlist_id)
);