Improve and update billing flow

This commit updates various components in the billing flow due to a new schema that supports multiple line items per plan. The added flexibility rendered 'line-items-mapper.ts' redundant, which has been removed. Additionally, webhooks have been created for handling account membership insertions and deletions, as well as handling subscription deletions when an account is deleted. This message also introduces a new service to handle sending out invitation emails. Lastly, the validation of the billing provider has been improved for increased security and stability.
This commit is contained in:
giancarlo
2024-03-30 14:51:16 +08:00
parent f93af31009
commit e158ff28d8
30 changed files with 670 additions and 465 deletions

View File

@@ -437,11 +437,15 @@ create table if not exists public.roles (
primary key (name)
);
grant select on table public.roles to authenticated, service_role;
-- Seed the roles table with default roles 'owner' and 'member'
insert into public.roles (name, hierarchy_level) values ('owner', 1);
insert into public.roles (name, hierarchy_level) values ('member', 2);
-- RLS
alter table public.roles enable row level security;
-- SELECT: authenticated users can query roles
create policy roles_read on public.roles for
select