-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
In-app Chat and notifications #32
Labels
enhancement
New feature or request
Comments
@chakrihacker I have a request for you 😃 When you have time, please add properties to |
I added a table Table -- public.notification definition
-- Drop table
-- DROP TABLE public.notification;
CREATE TABLE public.notification (
id int8 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
created_at timestamptz NULL DEFAULT now(),
"read" bool NOT NULL DEFAULT false,
"type" text NOT NULL,
meta json NULL DEFAULT '{}'::json,
to_user uuid NULL,
CONSTRAINT notification_pkey PRIMARY KEY (id),
CONSTRAINT notification_to_user_fkey FOREIGN KEY (to_user) REFERENCES auth.users(id)
); Function begin
insert into public.notification(type, to_user, meta)
values(
'message',
new.to_user,
format('{"chat_id":"%s", "from_user":"%s"}', new.chat_id, (select from_user from public.chats where id = new.chat_id))::jsonb
);
return new;
end; Trigger |
Created function and trigger to handle the notifications of the schedules Function begin
insert into public.notification(type, to_user, meta)
values(
'schedule',
(select space.userid
from public.spaces space
inner join public.users on public.users.id = space.userid
where space.id = new.space_id),
format('{"space_id":"%s", "schedule_id":"%s"}', new.space_id, new.id)::jsonb
);
return new;
end; Trigger |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
According to the Database, we need an In-app chat, the dynamic is simply, only the users can start a chat with the coworkers owners.
read_for_from_user
andread_for_to_user
to the chat entityAny others features are welcome.
The text was updated successfully, but these errors were encountered: