Giter VIP home page Giter VIP logo

tomato's Introduction

tomato

main branch for prod dev branch for dev

DON'T FORGET TO FILL ALL .ENV

Run the web app

Install dependencies

pnpm install

Fill .env file

You need to create a .env.local file with the following the .env.example file. If you haven't start supabase locally, go to the Run supabase locally section.

Run the app

pnpm run dev

How to use supabase

Run supabase locally

Install supabase CLI

npm install -g supabase-cli

or

brew install supabase-cli

Run supabase

Before running supabase you need to create a .env file with the following variables following the .env.example file.

Then you can start supabase with:

supabase start

Errors

  1. Error: Error evaluating "env(DISCORD_CLIENT)": environment variable DISCORD_CLIENT is unset.

Because we are using env variable in the supabase config file, you need to first source the .env file with source .env.

For example if you are at the root of the project you can run this command to source the .env file.

source ./supabase/.env

Then you can restart the supabase server.

Deployments

If you have a PR with a new migrations you don't need to do something special. When you will merge your new branch on dev a github action will start and check if the current file supabase_types is up to date.

The migration will be automatically applied when you merge on main.

Migrations

Automatic migrations (Recommanded)

Unlike manual migrations, auto schema diff creates a new migration script from changes already applied to your local database.

Create an employees table under the public schema using Studio UI, accessible at localhost:54323 by default.

Next, generate a schema diff by running the following command:

supabase db diff -f new_employee

Manual migrations

Create a new migration script by running:

supabase migration new name_of_migration

You should see a new file created: supabase/migrations/<timestamp>_name_of_migration.sql. You can then write SQL statements in this script using a text editor:

create table public.example (
  id integer primary key generated always as identity,
  name text
);

Apply the new migration to your local database:

supabase db reset

This command recreates your local database from scratch and applies all migration scripts under supabase/migrations directory. Now your local database is up to date.

Tomato helper

The tomato.py file in the cli directory is a custom CLI for repetitive tasks. To use it you need to follow this steps:

  1. Install python requirements: pip install -r cli/requirements.txt

  2. Create a .env file with the following variables (see https://app.supabase.com/dashboard/project/_/settings/general):

SUPABASE_PROJECT_ID=
  1. Source the source_me file every time you start a new working session:
source source_me

Or add this line to your .bashrc or .zshrc depending on which on you use:

alias tmt="python3 /path/to/tomato/cli/tomato.py"
  1. Now you can use the CLI with tmt command

Available commands

  • tmt db_types : Generate typescript types for supabase tables
  • tmt db_migrate : Apply pending database migration to your local supabase instance
  • tmt db_reset : Reset your local database and apply all the migrations
  • tmt db_types : Generates the supabase database types for typescript development
  • tmt setup : Install all the project dependencies needed by node.js
  • tmt start : Start the supabase local instance with the environments loaded
  • tmt stop : Stop the supabase local instance

You can see each one off these by doing:

  • tmt -h

Finder flow

Step to use the feature in local

  1. tmt db_reset
  2. Aller sur http://localhost:54323/project/default/database/hooks et Cliquer sur modifier le webhook
  3. Changer l'url avec http://host.docker.internal:54321/functions/v1/handle_scan_insert
  4. Remplacer le header Authorization avec Bearer your_anon_token
  5. Remplir le tomato-x-edge-token avec super-secret-jwt-token-with-at-least-32-characters-long
  6. Creer un .env dans ./supabase et le remplir avec
export RESEND_API_KEY=ask_me_in_dm
export TOMATO_EDGE_TOKEN=super-secret-jwt-token-with-at-least-32-characters-long
export TOMATO_JWT_SECRET=super-secret-jwt-token-with-at-least-32-characters-long
  1. Inserer le jwt token dans supabase, tu va dans l'invite de commande sql de supabase en local et tu execute ça
insert into vault.secrets (name, secret)
values ('tomato-jwt-token', 'super-secret-jwt-token-with-at-least-32-characters-long') returning *;
  1. Ouvrir un nouveau terminal et lancer tmt fn_run
  2. Et apres tu creers un item, tu le marque en lost et tu ouvre la page de qrcode sur une nav privée. Si t'as besoin d'aide demande

tomato's People

Contributors

victorbillaud avatar tomspace900 avatar codenamewaddles avatar guillaumevdn avatar pastequee avatar

Stargazers

Bruno Gomes avatar Arsène Lapostolet avatar  avatar Kato, H. avatar  avatar  avatar

Watchers

 avatar

tomato's Issues

Mobile Items Tab

Features

  • Show number of QR codes available
  • Add item button (link to Create Item Tab)
  • Item Component
    image
    • Item name
    • Item status (color)
    • Description
    • Date
    • See details button (link to Item Tab)

Mobile Components

Faire les mêmes components de base en mobile qu'en web pour que ce soit cleeeaaaan

  • Text
  • Card
  • Button
  • Icon
  • InputText

Mobile User Tab

Features

  • User info
  • Edit user info
  • User picture
  • Edit user picture
  • Notification settings switches
  • Notification history
  • Mark notifications as read
  • Notification links (item/message/...)
  • Sign out

Add option to change qr code on item page ?

Maybe give the possibility to change the qr code assigned to an item amongst the one you have (maybe with a confirmation to be sure you want to change)
Don't know if its really useful, just putting it here

Mobile Create Item Tab

Features

  • QR code select from available codes
  • Show QR code and name
  • Input Item name and description
  • Create Item button (redirect to Items Tab)

Fix buy new QRCode

Buy new qrcode button adds a QRcode for EVERYONE, which is quite weird and annoying...

Mobile Item Tab

Features

  • Item status (color)
  • Name
  • Description
  • Creation date
  • If lost, lost date
  • Toggle to notify if scanned while not lost
  • Scan history
  • Declare item as lost or found
  • Show QR code and name
  • Save QR code (opens share menu)
  • Make fields editable (name, description)

Mobile Chat Tab

Features

  • Show item name
  • Input text
  • Show messages in order
  • Chat bubbles corner format
  • Show time/date when message intervals big enough

Better profile page

Add some information on the profile page such as:

  • Name/nickname
  • Phone ? (maybe SMS in the future)
  • idk

And the ability to change those values as well as the profile picture

Create token system for chat access

In order to allow an anon user to chat with the owner once he finds an item, we need a way to allow him to send and see messages while still being secure.

The method we are going to choose is the following.
Each chat will be linked to a JWT token with an object containing the chat ID inside. Let take this token as example:

  • eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb252SWQiOjU4NzEyNiwic3ViIjoiMTIzNDU2Nzg5MCIsImlhdCI6MTUxNjIzOTAyMn0.cxe8xE0AvkqY3HFKUcU9xHSim2dZ57Ml8pJ0J9PXiRA
    If we extract its content with this website (or later on with the jwt node.js lib) we have this json object inside:
{
  "convId": 587126,
  "sub": "1234567890",
  "iat": 1516239022
}

Once the anon user scans the QR code, the server gives him back the token stored in the conversation so that he can give it back at each request to authenticate himself as legitimate to send and receive messages from the server. The second he loses the token, he cannot use the chat anymore.

On the server side, each time it receives a request for the chat from an anon user, it will decode the token and look at the convId to process to request. If at any point in this verification, there is a problem, the request is denied.

Handle email sending

Need to send email to user to inform him of various actions, like a scan of his item or something else I don't know what yet

Frontend bug when token is invalid or expired

We need to check the flow for token checking when it's invalid (between different development sessions) or expired. I experienced several bugs with the interface. Need to dig this a little bit to confirm the bugs and fix them

Setup email only login and remove register page

Remove the register page.
Put only email input field in the login page.
If the user is already registered with his email, ask for his password
If the user is new, send him a code by email to connect him without creating a password. (He can set one later if he wants in the settings)

When creating an Item on mobile, show the form directly

On the computer version of the app, when creating an Item, we can create an item using the form directly (need to click on a button first) or we can continue to fill it out on our phone which is great. But when already on the phone and trying to create an item, we still have this choice to continue on the phone or use the form, which is a bit annoying because already on the phone.

Web finder flow scan

  • Create a conversation between the finder and the owner.
  • Check if there is already a conversation between them
  • Handle the finder path with registration
  • Send notification to each user

Chat add group hover for item link

On the item banner of the chat page, there is a link icon to the item that appears when you hover over it but only when hovering over the item name and not the whole bar.

I think its better to make it appear wherever you hover on the banner, to do that, a simple group-hover can be used 👍

Also, I think it would be prettier to only have red chat bubbles for your messages and grey one for the other. Not 2 different red shades

Generate random names for qrcode

Need to generate random names for the qrcode to help the user to identify them easily.
Idea, compose a name containing one fruit or vegetable name and one adjective like:

  • Dangerous tomato
  • Strong banana
  • Stupid potato

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.