Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Fix(contacts): Return all sales in sales selector

Jonathan ARNAULT1454adfc5d2d
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 5f1ba437..f121493a 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -1,4 +1,4 @@
-name: πŸš€ Deploy
+name: βœ… Check
on:
push:
branches:
diff --git a/README.md b/README.md
index 617949bb..b528fcbd 100644
--- a/README.md
+++ b/README.md
@@ -93,7 +93,7 @@ You can then access the app via [`http://localhost:3000/`](http://localhost:3000
# GitHub Actions
This project supports github actions for continuous integration and delivery. To enable GitHub actions on this repo, you will
-have to create the following secrets for the `deploy` environment:
+have to create the following secrets:
```bash
SUPABASE_ACCESS_TOKEN: Your personal access token, can be found at https://supabase.com/dashboard/account/tokens
diff --git a/supabase/functions/users/index.ts b/supabase/functions/users/index.ts
index 9e74b1e3..958370ac 100644
--- a/supabase/functions/users/index.ts
+++ b/supabase/functions/users/index.ts
@@ -29,7 +29,7 @@ function createErrorResponse(status: number, message: string) {
async function updateSaleDisabled(user_id: string, disabled: boolean) {
return await supabaseServiceClient
.from('sales')
- .update({ disabled })
+ .update({ disabled: disabled ?? false })
.eq('user_id', user_id);
}
@@ -51,7 +51,7 @@ async function updateSaleAdministrator(
}
async function inviteUser(req: Request) {
- const { email, password, first_name, last_name, administrator } =
+ const { email, password, first_name, last_name, disabled, administrator } =
await req.json();
const { data, error: userError } =
@@ -68,6 +68,7 @@ async function inviteUser(req: Request) {
}
try {
+ await updateSaleDisabled(data.user.id, disabled);
const sale = await updateSaleAdministrator(data.user.id, administrator);
return new Response(
diff --git a/supabase/migrations/20240730075029_init_db.sql b/supabase/migrations/20240730075029_init_db.sql
index 4f42ebc6..58af5bf0 100644
--- a/supabase/migrations/20240730075029_init_db.sql
+++ b/supabase/migrations/20240730075029_init_db.sql
@@ -102,7 +102,7 @@ create table "public"."sales" (
"administrator" boolean not null,
"user_id" uuid not null,
"avatar" jsonb,
- "disabled" boolean
+ "disabled" boolean not null default FALSE
);