Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/desoga10/ng-chat-v

In this tutorial, we delve into creating a powerful real time Chat application using Angular 17 and Supabase. Here is the link to the tutorial on YouTube: https://www.youtube.com/watch?v=8SRhekaJ5iI
https://github.com/desoga10/ng-chat-v

angular angular17 angular2 supabase supabase-auth supabase-db supabase-functions supabase-storage supabase-trigger

Last synced: 4 months ago
JSON representation

In this tutorial, we delve into creating a powerful real time Chat application using Angular 17 and Supabase. Here is the link to the tutorial on YouTube: https://www.youtube.com/watch?v=8SRhekaJ5iI

Awesome Lists containing this project

README

        

## users table

* id (uuid)
* full_name (text)
* avatar_url (text)

## Creating a users table

```sql
CREATE TABLE public.users (
id uuid not null references auth.users on delete cascade,
full_name text NULL,
avatar_url text NULL,
primary key (id)
);
```

## Enable Row Level Security

```sql
ALTER TABLE public.users ENABLE ROW LEVEL SECURITY;
```

## Permit Users Access Their Profile

```sql
CREATE POLICY "Permit Users to Access Their Profile"
ON public.users
FOR SELECT
USING ( auth.uid() = id );
```

## Permit Users to Update Their Profile

```sql
CREATE POLICY "Permit Users to Update Their Profile"
ON public.users
FOR UPDATE
USING ( auth.uid() = id );
```

## Supabase Functions

```sql
CREATE
OR REPLACE FUNCTION public.user_profile() RETURNS TRIGGER AS $$ BEGIN INSERT INTO public.users (id, full_name,avatar_url)
VALUES
(
NEW.id,
NEW.raw_user_meta_data ->> 'full_name'::TEXT,
NEW.raw_user_meta_data ->> 'avatar_url'::TEXT,
);
RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
```

## Supabase Trigger

```sql
CREATE TRIGGER
create_user_trigger
AFTER INSERT ON auth.users
FOR EACH ROW
EXECUTE PROCEDURE
public.user_profile();
```

## Chat_Messages table (Real Time)

* id (uuid)
* Created At (date)
* text (text)
* editable (boolean)
* sender (uuid)