Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(contacts): Return all sales in sales selector #16

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 🚀 Deploy
name: ✅ Check
on:
push:
branches:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions supabase/functions/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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 } =
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion supabase/migrations/20240730075029_init_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
);


Expand Down
Loading