diff --git a/apps/web/app/(dashboard)/home/[account]/_lib/server/team-account-workspace.loader.ts b/apps/web/app/(dashboard)/home/[account]/_lib/server/team-account-workspace.loader.ts
index 142b26642..cca38ac87 100644
--- a/apps/web/app/(dashboard)/home/[account]/_lib/server/team-account-workspace.loader.ts
+++ b/apps/web/app/(dashboard)/home/[account]/_lib/server/team-account-workspace.loader.ts
@@ -20,7 +20,7 @@ import pathsConfig from '~/config/paths.config';
export const loadTeamWorkspace = cache(async (accountSlug: string) => {
const client = getSupabaseServerComponentClient();
- const accountPromise = client.rpc('organization_account_workspace', {
+ const accountPromise = client.rpc('team_account_workspace', {
account_slug: accountSlug,
});
diff --git a/apps/web/app/(dashboard)/home/_components/home-sidebar.tsx b/apps/web/app/(dashboard)/home/_components/home-sidebar.tsx
index 551e3a4c8..0b261a435 100644
--- a/apps/web/app/(dashboard)/home/_components/home-sidebar.tsx
+++ b/apps/web/app/(dashboard)/home/_components/home-sidebar.tsx
@@ -16,7 +16,7 @@ import { loadUserWorkspace } from '../_lib/load-user-workspace';
export function HomeSidebar() {
const collapsed = getSidebarCollapsed();
- const { accounts, user } = use(loadUserWorkspace());
+ const { accounts, user, workspace } = use(loadUserWorkspace());
return (
@@ -38,7 +38,11 @@ export function HomeSidebar() {
diff --git a/apps/web/app/(dashboard)/home/_components/personal-account-dropdown-container.tsx b/apps/web/app/(dashboard)/home/_components/personal-account-dropdown-container.tsx
index 1e78e5aed..4bb727804 100644
--- a/apps/web/app/(dashboard)/home/_components/personal-account-dropdown-container.tsx
+++ b/apps/web/app/(dashboard)/home/_components/personal-account-dropdown-container.tsx
@@ -9,27 +9,37 @@ import { useUser } from '@kit/supabase/hooks/use-user';
import featuresFlagConfig from '~/config/feature-flags.config';
import pathsConfig from '~/config/paths.config';
+const paths = {
+ home: pathsConfig.app.home,
+};
+
+const features = {
+ enableThemeToggle: featuresFlagConfig.enableThemeToggle,
+};
+
export function ProfileAccountDropdownContainer(props: {
collapsed: boolean;
user: User | null;
+
+ account?: {
+ id: string | null;
+ name: string | null;
+ picture_url: string | null;
+ };
}) {
const signOut = useSignOut();
const user = useUser(props.user);
-
const userData = user.data ?? props.user ?? null;
return (
-
+
signOut.mutateAsync()}
/>
diff --git a/apps/web/app/(dashboard)/home/_lib/load-user-workspace.ts b/apps/web/app/(dashboard)/home/_lib/load-user-workspace.ts
index f5fb2199e..ecc7d6f07 100644
--- a/apps/web/app/(dashboard)/home/_lib/load-user-workspace.ts
+++ b/apps/web/app/(dashboard)/home/_lib/load-user-workspace.ts
@@ -1,26 +1,62 @@
import { cache } from 'react';
+import { SupabaseClient } from '@supabase/supabase-js';
+
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
import featureFlagsConfig from '~/config/feature-flags.config';
import { Database } from '~/lib/database.types';
+/**
+ * @name loadUserWorkspace
+ * @description
+ * Load the user workspace data. It's a cached per-request function that fetches the user workspace data.
+ * It can be used across the server components to load the user workspace data.
+ */
export const loadUserWorkspace = cache(async () => {
const client = getSupabaseServerComponentClient();
const loadAccounts = featureFlagsConfig.enableTeamAccounts;
- const accounts = loadAccounts ? await loadUserAccounts(client) : [];
- const { data } = await client.auth.getUser();
+ const accountsPromise = loadAccounts
+ ? loadUserAccounts(client)
+ : Promise.resolve([]);
+
+ const workspacePromise = loadUserAccountWorkspace(client);
+ const userPromise = client.auth.getUser();
+
+ const [accounts, workspace, userResult] = await Promise.all([
+ accountsPromise,
+ workspacePromise,
+ userPromise,
+ ]);
+
+ const user = userResult.data.user;
+
+ if (!user) {
+ throw new Error('User is not logged in');
+ }
return {
accounts,
- user: data.user,
+ workspace,
+ user,
};
});
-async function loadUserAccounts(
- client: ReturnType
>,
-) {
+async function loadUserAccountWorkspace(client: SupabaseClient) {
+ const { data, error } = await client
+ .from('user_account_workspace')
+ .select(`*`)
+ .single();
+
+ if (error) {
+ throw error;
+ }
+
+ return data;
+}
+
+async function loadUserAccounts(client: SupabaseClient) {
const { data: accounts, error } = await client
.from('user_accounts')
.select(`name, slug, picture_url`);
diff --git a/apps/web/lib/database.types.ts b/apps/web/lib/database.types.ts
index eb491497e..a5e720bac 100644
--- a/apps/web/lib/database.types.ts
+++ b/apps/web/lib/database.types.ts
@@ -4,1224 +4,1336 @@ export type Json =
| boolean
| null
| { [key: string]: Json | undefined }
- | Json[];
+ | Json[]
export type Database = {
graphql_public: {
Tables: {
- [_ in never]: never;
- };
+ [_ in never]: never
+ }
Views: {
- [_ in never]: never;
- };
+ [_ in never]: never
+ }
Functions: {
graphql: {
Args: {
- operationName?: string;
- query?: string;
- variables?: Json;
- extensions?: Json;
- };
- Returns: Json;
- };
- };
+ operationName?: string
+ query?: string
+ variables?: Json
+ extensions?: Json
+ }
+ Returns: Json
+ }
+ }
Enums: {
- [_ in never]: never;
- };
+ [_ in never]: never
+ }
CompositeTypes: {
- [_ in never]: never;
- };
- };
+ [_ in never]: never
+ }
+ }
public: {
Tables: {
account_roles: {
Row: {
- account_id: string;
- id: number;
- role: string;
- };
+ account_id: string
+ id: number
+ role: string
+ }
Insert: {
- account_id: string;
- id?: number;
- role: string;
- };
+ account_id: string
+ id?: number
+ role: string
+ }
Update: {
- account_id?: string;
- id?: number;
- role?: string;
- };
+ account_id?: string
+ id?: number
+ role?: string
+ }
Relationships: [
{
- foreignKeyName: 'account_roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "account_roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'account_roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "account_roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'account_roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "account_roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'account_roles_role_fkey';
- columns: ['role'];
- isOneToOne: false;
- referencedRelation: 'roles';
- referencedColumns: ['name'];
+ foreignKeyName: "account_roles_role_fkey"
+ columns: ["role"]
+ isOneToOne: false
+ referencedRelation: "roles"
+ referencedColumns: ["name"]
},
- ];
- };
+ ]
+ }
accounts: {
Row: {
- created_at: string | null;
- created_by: string | null;
- email: string | null;
- id: string;
- is_personal_account: boolean;
- name: string;
- picture_url: string | null;
- primary_owner_user_id: string;
- public_data: Json;
- slug: string | null;
- updated_at: string | null;
- updated_by: string | null;
- };
+ created_at: string | null
+ created_by: string | null
+ email: string | null
+ id: string
+ is_personal_account: boolean
+ name: string
+ picture_url: string | null
+ primary_owner_user_id: string
+ public_data: Json
+ slug: string | null
+ updated_at: string | null
+ updated_by: string | null
+ }
Insert: {
- created_at?: string | null;
- created_by?: string | null;
- email?: string | null;
- id?: string;
- is_personal_account?: boolean;
- name: string;
- picture_url?: string | null;
- primary_owner_user_id?: string;
- public_data?: Json;
- slug?: string | null;
- updated_at?: string | null;
- updated_by?: string | null;
- };
+ created_at?: string | null
+ created_by?: string | null
+ email?: string | null
+ id?: string
+ is_personal_account?: boolean
+ name: string
+ picture_url?: string | null
+ primary_owner_user_id?: string
+ public_data?: Json
+ slug?: string | null
+ updated_at?: string | null
+ updated_by?: string | null
+ }
Update: {
- created_at?: string | null;
- created_by?: string | null;
- email?: string | null;
- id?: string;
- is_personal_account?: boolean;
- name?: string;
- picture_url?: string | null;
- primary_owner_user_id?: string;
- public_data?: Json;
- slug?: string | null;
- updated_at?: string | null;
- updated_by?: string | null;
- };
+ created_at?: string | null
+ created_by?: string | null
+ email?: string | null
+ id?: string
+ is_personal_account?: boolean
+ name?: string
+ picture_url?: string | null
+ primary_owner_user_id?: string
+ public_data?: Json
+ slug?: string | null
+ updated_at?: string | null
+ updated_by?: string | null
+ }
Relationships: [
{
- foreignKeyName: 'accounts_created_by_fkey';
- columns: ['created_by'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_created_by_fkey"
+ columns: ["created_by"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_primary_owner_user_id_fkey';
- columns: ['primary_owner_user_id'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_primary_owner_user_id_fkey"
+ columns: ["primary_owner_user_id"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_updated_by_fkey';
- columns: ['updated_by'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_updated_by_fkey"
+ columns: ["updated_by"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
accounts_memberships: {
Row: {
- account_id: string;
- account_role: string;
- created_at: string;
- created_by: string | null;
- updated_at: string;
- updated_by: string | null;
- user_id: string;
- };
+ account_id: string
+ account_role: string
+ created_at: string
+ created_by: string | null
+ updated_at: string
+ updated_by: string | null
+ user_id: string
+ }
Insert: {
- account_id: string;
- account_role: string;
- created_at?: string;
- created_by?: string | null;
- updated_at?: string;
- updated_by?: string | null;
- user_id: string;
- };
+ account_id: string
+ account_role: string
+ created_at?: string
+ created_by?: string | null
+ updated_at?: string
+ updated_by?: string | null
+ user_id: string
+ }
Update: {
- account_id?: string;
- account_role?: string;
- created_at?: string;
- created_by?: string | null;
- updated_at?: string;
- updated_by?: string | null;
- user_id?: string;
- };
+ account_id?: string
+ account_role?: string
+ created_at?: string
+ created_by?: string | null
+ updated_at?: string
+ updated_by?: string | null
+ user_id?: string
+ }
Relationships: [
{
- foreignKeyName: 'accounts_memberships_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_memberships_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_memberships_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_memberships_account_role_fkey';
- columns: ['account_role'];
- isOneToOne: false;
- referencedRelation: 'roles';
- referencedColumns: ['name'];
+ foreignKeyName: "accounts_memberships_account_role_fkey"
+ columns: ["account_role"]
+ isOneToOne: false
+ referencedRelation: "roles"
+ referencedColumns: ["name"]
},
{
- foreignKeyName: 'accounts_memberships_created_by_fkey';
- columns: ['created_by'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_created_by_fkey"
+ columns: ["created_by"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_memberships_updated_by_fkey';
- columns: ['updated_by'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_updated_by_fkey"
+ columns: ["updated_by"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_memberships_user_id_fkey';
- columns: ['user_id'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_user_id_fkey"
+ columns: ["user_id"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
billing_customers: {
Row: {
- account_id: string;
- customer_id: string;
- email: string | null;
- id: number;
- provider: Database['public']['Enums']['billing_provider'];
- };
+ account_id: string
+ customer_id: string
+ email: string | null
+ id: number
+ provider: Database["public"]["Enums"]["billing_provider"]
+ }
Insert: {
- account_id: string;
- customer_id: string;
- email?: string | null;
- id?: number;
- provider: Database['public']['Enums']['billing_provider'];
- };
+ account_id: string
+ customer_id: string
+ email?: string | null
+ id?: number
+ provider: Database["public"]["Enums"]["billing_provider"]
+ }
Update: {
- account_id?: string;
- customer_id?: string;
- email?: string | null;
- id?: number;
- provider?: Database['public']['Enums']['billing_provider'];
- };
+ account_id?: string
+ customer_id?: string
+ email?: string | null
+ id?: number
+ provider?: Database["public"]["Enums"]["billing_provider"]
+ }
Relationships: [
{
- foreignKeyName: 'billing_customers_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "billing_customers_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'billing_customers_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "billing_customers_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'billing_customers_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "billing_customers_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
config: {
Row: {
- billing_provider: Database['public']['Enums']['billing_provider'];
- enable_account_billing: boolean;
- enable_team_account_billing: boolean;
- enable_team_accounts: boolean;
- };
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ enable_account_billing: boolean
+ enable_team_account_billing: boolean
+ enable_team_accounts: boolean
+ }
Insert: {
- billing_provider?: Database['public']['Enums']['billing_provider'];
- enable_account_billing?: boolean;
- enable_team_account_billing?: boolean;
- enable_team_accounts?: boolean;
- };
+ billing_provider?: Database["public"]["Enums"]["billing_provider"]
+ enable_account_billing?: boolean
+ enable_team_account_billing?: boolean
+ enable_team_accounts?: boolean
+ }
Update: {
- billing_provider?: Database['public']['Enums']['billing_provider'];
- enable_account_billing?: boolean;
- enable_team_account_billing?: boolean;
- enable_team_accounts?: boolean;
- };
- Relationships: [];
- };
+ billing_provider?: Database["public"]["Enums"]["billing_provider"]
+ enable_account_billing?: boolean
+ enable_team_account_billing?: boolean
+ enable_team_accounts?: boolean
+ }
+ Relationships: []
+ }
invitations: {
Row: {
- account_id: string;
- created_at: string;
- email: string;
- expires_at: string;
- id: number;
- invite_token: string;
- invited_by: string;
- role: string;
- updated_at: string;
- };
+ account_id: string
+ created_at: string
+ email: string
+ expires_at: string
+ id: number
+ invite_token: string
+ invited_by: string
+ role: string
+ updated_at: string
+ }
Insert: {
- account_id: string;
- created_at?: string;
- email: string;
- expires_at?: string;
- id?: number;
- invite_token: string;
- invited_by: string;
- role: string;
- updated_at?: string;
- };
+ account_id: string
+ created_at?: string
+ email: string
+ expires_at?: string
+ id?: number
+ invite_token: string
+ invited_by: string
+ role: string
+ updated_at?: string
+ }
Update: {
- account_id?: string;
- created_at?: string;
- email?: string;
- expires_at?: string;
- id?: number;
- invite_token?: string;
- invited_by?: string;
- role?: string;
- updated_at?: string;
- };
+ account_id?: string
+ created_at?: string
+ email?: string
+ expires_at?: string
+ id?: number
+ invite_token?: string
+ invited_by?: string
+ role?: string
+ updated_at?: string
+ }
Relationships: [
{
- foreignKeyName: 'invitations_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "invitations_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'invitations_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "invitations_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'invitations_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "invitations_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'invitations_invited_by_fkey';
- columns: ['invited_by'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "invitations_invited_by_fkey"
+ columns: ["invited_by"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'invitations_role_fkey';
- columns: ['role'];
- isOneToOne: false;
- referencedRelation: 'roles';
- referencedColumns: ['name'];
+ foreignKeyName: "invitations_role_fkey"
+ columns: ["role"]
+ isOneToOne: false
+ referencedRelation: "roles"
+ referencedColumns: ["name"]
},
- ];
- };
+ ]
+ }
order_items: {
Row: {
- created_at: string;
- order_id: string;
- price_amount: number | null;
- product_id: string;
- quantity: number;
- updated_at: string;
- variant_id: string;
- };
+ created_at: string
+ order_id: string
+ price_amount: number | null
+ product_id: string
+ quantity: number
+ updated_at: string
+ variant_id: string
+ }
Insert: {
- created_at?: string;
- order_id: string;
- price_amount?: number | null;
- product_id: string;
- quantity?: number;
- updated_at?: string;
- variant_id: string;
- };
+ created_at?: string
+ order_id: string
+ price_amount?: number | null
+ product_id: string
+ quantity?: number
+ updated_at?: string
+ variant_id: string
+ }
Update: {
- created_at?: string;
- order_id?: string;
- price_amount?: number | null;
- product_id?: string;
- quantity?: number;
- updated_at?: string;
- variant_id?: string;
- };
+ created_at?: string
+ order_id?: string
+ price_amount?: number | null
+ product_id?: string
+ quantity?: number
+ updated_at?: string
+ variant_id?: string
+ }
Relationships: [
{
- foreignKeyName: 'order_items_order_id_fkey';
- columns: ['order_id'];
- isOneToOne: false;
- referencedRelation: 'orders';
- referencedColumns: ['id'];
+ foreignKeyName: "order_items_order_id_fkey"
+ columns: ["order_id"]
+ isOneToOne: false
+ referencedRelation: "orders"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
orders: {
Row: {
- account_id: string;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- created_at: string;
- currency: string;
- id: string;
- status: Database['public']['Enums']['payment_status'];
- total_amount: number;
- updated_at: string;
- };
+ account_id: string
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ created_at: string
+ currency: string
+ id: string
+ status: Database["public"]["Enums"]["payment_status"]
+ total_amount: number
+ updated_at: string
+ }
Insert: {
- account_id: string;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- created_at?: string;
- currency: string;
- id: string;
- status: Database['public']['Enums']['payment_status'];
- total_amount: number;
- updated_at?: string;
- };
+ account_id: string
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ created_at?: string
+ currency: string
+ id: string
+ status: Database["public"]["Enums"]["payment_status"]
+ total_amount: number
+ updated_at?: string
+ }
Update: {
- account_id?: string;
- billing_customer_id?: number;
- billing_provider?: Database['public']['Enums']['billing_provider'];
- created_at?: string;
- currency?: string;
- id?: string;
- status?: Database['public']['Enums']['payment_status'];
- total_amount?: number;
- updated_at?: string;
- };
+ account_id?: string
+ billing_customer_id?: number
+ billing_provider?: Database["public"]["Enums"]["billing_provider"]
+ created_at?: string
+ currency?: string
+ id?: string
+ status?: Database["public"]["Enums"]["payment_status"]
+ total_amount?: number
+ updated_at?: string
+ }
Relationships: [
{
- foreignKeyName: 'orders_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "orders_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'orders_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "orders_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'orders_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "orders_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'orders_billing_customer_id_fkey';
- columns: ['billing_customer_id'];
- isOneToOne: false;
- referencedRelation: 'billing_customers';
- referencedColumns: ['id'];
+ foreignKeyName: "orders_billing_customer_id_fkey"
+ columns: ["billing_customer_id"]
+ isOneToOne: false
+ referencedRelation: "billing_customers"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
role_permissions: {
Row: {
- id: number;
- permission: Database['public']['Enums']['app_permissions'];
- role: string;
- };
+ id: number
+ permission: Database["public"]["Enums"]["app_permissions"]
+ role: string
+ }
Insert: {
- id?: number;
- permission: Database['public']['Enums']['app_permissions'];
- role: string;
- };
+ id?: number
+ permission: Database["public"]["Enums"]["app_permissions"]
+ role: string
+ }
Update: {
- id?: number;
- permission?: Database['public']['Enums']['app_permissions'];
- role?: string;
- };
+ id?: number
+ permission?: Database["public"]["Enums"]["app_permissions"]
+ role?: string
+ }
Relationships: [
{
- foreignKeyName: 'role_permissions_role_fkey';
- columns: ['role'];
- isOneToOne: false;
- referencedRelation: 'roles';
- referencedColumns: ['name'];
+ foreignKeyName: "role_permissions_role_fkey"
+ columns: ["role"]
+ isOneToOne: false
+ referencedRelation: "roles"
+ referencedColumns: ["name"]
},
- ];
- };
+ ]
+ }
roles: {
Row: {
- account_id: string | null;
- hierarchy_level: number;
- name: string;
- };
+ account_id: string | null
+ hierarchy_level: number
+ name: string
+ }
Insert: {
- account_id?: string | null;
- hierarchy_level: number;
- name: string;
- };
+ account_id?: string | null
+ hierarchy_level: number
+ name: string
+ }
Update: {
- account_id?: string | null;
- hierarchy_level?: number;
- name?: string;
- };
+ account_id?: string | null
+ hierarchy_level?: number
+ name?: string
+ }
Relationships: [
{
- foreignKeyName: 'roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
subscription_items: {
Row: {
- created_at: string;
- interval: string;
- interval_count: number;
- price_amount: number | null;
- product_id: string;
- quantity: number;
- subscription_id: string;
- type: Database['public']['Enums']['subscription_item_type'];
- updated_at: string;
- variant_id: string;
- };
+ created_at: string
+ interval: string
+ interval_count: number
+ price_amount: number | null
+ product_id: string
+ quantity: number
+ subscription_id: string
+ type: Database["public"]["Enums"]["subscription_item_type"]
+ updated_at: string
+ variant_id: string
+ }
Insert: {
- created_at?: string;
- interval: string;
- interval_count: number;
- price_amount?: number | null;
- product_id: string;
- quantity?: number;
- subscription_id: string;
- type: Database['public']['Enums']['subscription_item_type'];
- updated_at?: string;
- variant_id: string;
- };
+ created_at?: string
+ interval: string
+ interval_count: number
+ price_amount?: number | null
+ product_id: string
+ quantity?: number
+ subscription_id: string
+ type: Database["public"]["Enums"]["subscription_item_type"]
+ updated_at?: string
+ variant_id: string
+ }
Update: {
- created_at?: string;
- interval?: string;
- interval_count?: number;
- price_amount?: number | null;
- product_id?: string;
- quantity?: number;
- subscription_id?: string;
- type?: Database['public']['Enums']['subscription_item_type'];
- updated_at?: string;
- variant_id?: string;
- };
+ created_at?: string
+ interval?: string
+ interval_count?: number
+ price_amount?: number | null
+ product_id?: string
+ quantity?: number
+ subscription_id?: string
+ type?: Database["public"]["Enums"]["subscription_item_type"]
+ updated_at?: string
+ variant_id?: string
+ }
Relationships: [
{
- foreignKeyName: 'subscription_items_subscription_id_fkey';
- columns: ['subscription_id'];
- isOneToOne: false;
- referencedRelation: 'subscriptions';
- referencedColumns: ['id'];
+ foreignKeyName: "subscription_items_subscription_id_fkey"
+ columns: ["subscription_id"]
+ isOneToOne: false
+ referencedRelation: "subscriptions"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
subscriptions: {
Row: {
- account_id: string;
- active: boolean;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- cancel_at_period_end: boolean;
- created_at: string;
- currency: string;
- id: string;
- period_ends_at: string;
- period_starts_at: string;
- status: Database['public']['Enums']['subscription_status'];
- trial_ends_at: string | null;
- trial_starts_at: string | null;
- updated_at: string;
- };
+ account_id: string
+ active: boolean
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ cancel_at_period_end: boolean
+ created_at: string
+ currency: string
+ id: string
+ period_ends_at: string
+ period_starts_at: string
+ status: Database["public"]["Enums"]["subscription_status"]
+ trial_ends_at: string | null
+ trial_starts_at: string | null
+ updated_at: string
+ }
Insert: {
- account_id: string;
- active: boolean;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- cancel_at_period_end: boolean;
- created_at?: string;
- currency: string;
- id: string;
- period_ends_at: string;
- period_starts_at: string;
- status: Database['public']['Enums']['subscription_status'];
- trial_ends_at?: string | null;
- trial_starts_at?: string | null;
- updated_at?: string;
- };
+ account_id: string
+ active: boolean
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ cancel_at_period_end: boolean
+ created_at?: string
+ currency: string
+ id: string
+ period_ends_at: string
+ period_starts_at: string
+ status: Database["public"]["Enums"]["subscription_status"]
+ trial_ends_at?: string | null
+ trial_starts_at?: string | null
+ updated_at?: string
+ }
Update: {
- account_id?: string;
- active?: boolean;
- billing_customer_id?: number;
- billing_provider?: Database['public']['Enums']['billing_provider'];
- cancel_at_period_end?: boolean;
- created_at?: string;
- currency?: string;
- id?: string;
- period_ends_at?: string;
- period_starts_at?: string;
- status?: Database['public']['Enums']['subscription_status'];
- trial_ends_at?: string | null;
- trial_starts_at?: string | null;
- updated_at?: string;
- };
+ account_id?: string
+ active?: boolean
+ billing_customer_id?: number
+ billing_provider?: Database["public"]["Enums"]["billing_provider"]
+ cancel_at_period_end?: boolean
+ created_at?: string
+ currency?: string
+ id?: string
+ period_ends_at?: string
+ period_starts_at?: string
+ status?: Database["public"]["Enums"]["subscription_status"]
+ trial_ends_at?: string | null
+ trial_starts_at?: string | null
+ updated_at?: string
+ }
Relationships: [
{
- foreignKeyName: 'subscriptions_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "subscriptions_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'subscriptions_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "subscriptions_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'subscriptions_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "subscriptions_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'subscriptions_billing_customer_id_fkey';
- columns: ['billing_customer_id'];
- isOneToOne: false;
- referencedRelation: 'billing_customers';
- referencedColumns: ['id'];
+ foreignKeyName: "subscriptions_billing_customer_id_fkey"
+ columns: ["billing_customer_id"]
+ isOneToOne: false
+ referencedRelation: "billing_customers"
+ referencedColumns: ["id"]
},
- ];
- };
- };
+ ]
+ }
+ }
Views: {
user_account_workspace: {
Row: {
- id: string | null;
- name: string | null;
- picture_url: string | null;
+ id: string | null
+ name: string | null
+ picture_url: string | null
+ public_data: Json | null
subscription_status:
- | Database['public']['Enums']['subscription_status']
- | null;
- };
- Relationships: [];
- };
+ | Database["public"]["Enums"]["subscription_status"]
+ | null
+ }
+ Relationships: []
+ }
user_accounts: {
Row: {
- id: string | null;
- name: string | null;
- picture_url: string | null;
- role: string | null;
- slug: string | null;
- };
+ id: string | null
+ name: string | null
+ picture_url: string | null
+ role: string | null
+ slug: string | null
+ }
Relationships: [
{
- foreignKeyName: 'accounts_memberships_account_role_fkey';
- columns: ['role'];
- isOneToOne: false;
- referencedRelation: 'roles';
- referencedColumns: ['name'];
+ foreignKeyName: "accounts_memberships_account_role_fkey"
+ columns: ["role"]
+ isOneToOne: false
+ referencedRelation: "roles"
+ referencedColumns: ["name"]
},
- ];
- };
- };
+ ]
+ }
+ }
Functions: {
accept_invitation: {
Args: {
- token: string;
- user_id: string;
- };
- Returns: string;
- };
+ token: string
+ user_id: string
+ }
+ Returns: string
+ }
add_invitations_to_account: {
Args: {
- account_slug: string;
- invitations: unknown[];
- };
- Returns: Database['public']['Tables']['invitations']['Row'][];
- };
- create_account: {
- Args: {
- account_name: string;
- };
- Returns: {
- created_at: string | null;
- created_by: string | null;
- email: string | null;
- id: string;
- is_personal_account: boolean;
- name: string;
- picture_url: string | null;
- primary_owner_user_id: string;
- public_data: Json;
- slug: string | null;
- updated_at: string | null;
- updated_by: string | null;
- };
- };
+ account_slug: string
+ invitations: Database["public"]["CompositeTypes"]["invitation"][]
+ }
+ Returns: Database["public"]["Tables"]["invitations"]["Row"][]
+ }
create_invitation: {
Args: {
- account_id: string;
- email: string;
- role: string;
- };
+ account_id: string
+ email: string
+ role: string
+ }
Returns: {
- account_id: string;
- created_at: string;
- email: string;
- expires_at: string;
- id: number;
- invite_token: string;
- invited_by: string;
- role: string;
- updated_at: string;
- };
- };
+ account_id: string
+ created_at: string
+ email: string
+ expires_at: string
+ id: number
+ invite_token: string
+ invited_by: string
+ role: string
+ updated_at: string
+ }
+ }
create_team_account: {
Args: {
- account_name: string;
- };
+ account_name: string
+ }
Returns: {
- created_at: string | null;
- created_by: string | null;
- email: string | null;
- id: string;
- is_personal_account: boolean;
- name: string;
- picture_url: string | null;
- primary_owner_user_id: string;
- public_data: Json;
- slug: string | null;
- updated_at: string | null;
- updated_by: string | null;
- };
- };
+ created_at: string | null
+ created_by: string | null
+ email: string | null
+ id: string
+ is_personal_account: boolean
+ name: string
+ picture_url: string | null
+ primary_owner_user_id: string
+ public_data: Json
+ slug: string | null
+ updated_at: string | null
+ updated_by: string | null
+ }
+ }
get_account_invitations: {
Args: {
- account_slug: string;
- };
+ account_slug: string
+ }
Returns: {
- id: number;
- email: string;
- account_id: string;
- invited_by: string;
- role: string;
- created_at: string;
- updated_at: string;
- expires_at: string;
- inviter_name: string;
- inviter_email: string;
- }[];
- };
+ id: number
+ email: string
+ account_id: string
+ invited_by: string
+ role: string
+ created_at: string
+ updated_at: string
+ expires_at: string
+ inviter_name: string
+ inviter_email: string
+ }[]
+ }
get_account_members: {
Args: {
- account_slug: string;
- };
+ account_slug: string
+ }
Returns: {
- id: string;
- user_id: string;
- account_id: string;
- role: string;
- role_hierarchy_level: number;
- primary_owner_user_id: string;
- name: string;
- email: string;
- picture_url: string;
- created_at: string;
- updated_at: string;
- }[];
- };
+ id: string
+ user_id: string
+ account_id: string
+ role: string
+ role_hierarchy_level: number
+ primary_owner_user_id: string
+ name: string
+ email: string
+ picture_url: string
+ created_at: string
+ updated_at: string
+ }[]
+ }
get_config: {
- Args: Record;
- Returns: Json;
- };
+ Args: Record
+ Returns: Json
+ }
has_more_elevated_role: {
Args: {
- target_user_id: string;
- target_account_id: string;
- role_name: string;
- };
- Returns: boolean;
- };
+ target_user_id: string
+ target_account_id: string
+ role_name: string
+ }
+ Returns: boolean
+ }
has_permission: {
Args: {
- user_id: string;
- account_id: string;
- permission_name: Database['public']['Enums']['app_permissions'];
- };
- Returns: boolean;
- };
+ user_id: string
+ account_id: string
+ permission_name: Database["public"]["Enums"]["app_permissions"]
+ }
+ Returns: boolean
+ }
has_role_on_account: {
Args: {
- account_id: string;
- account_role?: string;
- };
- Returns: boolean;
- };
+ account_id: string
+ account_role?: string
+ }
+ Returns: boolean
+ }
is_account_owner: {
Args: {
- account_id: string;
- };
- Returns: boolean;
- };
+ account_id: string
+ }
+ Returns: boolean
+ }
is_set: {
Args: {
- field_name: string;
- };
- Returns: boolean;
- };
+ field_name: string
+ }
+ Returns: boolean
+ }
is_team_member: {
Args: {
- account_id: string;
- user_id: string;
- };
- Returns: boolean;
- };
- organization_account_workspace: {
+ account_id: string
+ user_id: string
+ }
+ Returns: boolean
+ }
+ team_account_workspace: {
Args: {
- account_slug: string;
- };
+ account_slug: string
+ }
Returns: {
- id: string;
- name: string;
- picture_url: string;
- slug: string;
- role: string;
- role_hierarchy_level: number;
- primary_owner_user_id: string;
- subscription_status: Database['public']['Enums']['subscription_status'];
- permissions: Database['public']['Enums']['app_permissions'][];
- }[];
- };
+ id: string
+ name: string
+ picture_url: string
+ slug: string
+ role: string
+ role_hierarchy_level: number
+ primary_owner_user_id: string
+ subscription_status: Database["public"]["Enums"]["subscription_status"]
+ permissions: Database["public"]["Enums"]["app_permissions"][]
+ }[]
+ }
transfer_team_account_ownership: {
Args: {
- target_account_id: string;
- new_owner_id: string;
- };
- Returns: undefined;
- };
+ target_account_id: string
+ new_owner_id: string
+ }
+ Returns: undefined
+ }
unaccent: {
Args: {
- '': string;
- };
- Returns: string;
- };
+ "": string
+ }
+ Returns: string
+ }
unaccent_init: {
Args: {
- '': unknown;
- };
- Returns: unknown;
- };
+ "": unknown
+ }
+ Returns: unknown
+ }
upsert_order: {
Args: {
- target_account_id: string;
- target_customer_id: string;
- target_order_id: string;
- status: Database['public']['Enums']['payment_status'];
- billing_provider: Database['public']['Enums']['billing_provider'];
- total_amount: number;
- currency: string;
- line_items: Json;
- };
+ target_account_id: string
+ target_customer_id: string
+ target_order_id: string
+ status: Database["public"]["Enums"]["payment_status"]
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ total_amount: number
+ currency: string
+ line_items: Json
+ }
Returns: {
- account_id: string;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- created_at: string;
- currency: string;
- id: string;
- status: Database['public']['Enums']['payment_status'];
- total_amount: number;
- updated_at: string;
- };
- };
+ account_id: string
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ created_at: string
+ currency: string
+ id: string
+ status: Database["public"]["Enums"]["payment_status"]
+ total_amount: number
+ updated_at: string
+ }
+ }
upsert_subscription: {
Args: {
- target_account_id: string;
- target_customer_id: string;
- target_subscription_id: string;
- active: boolean;
- status: Database['public']['Enums']['subscription_status'];
- billing_provider: Database['public']['Enums']['billing_provider'];
- cancel_at_period_end: boolean;
- currency: string;
- period_starts_at: string;
- period_ends_at: string;
- line_items: Json;
- trial_starts_at?: string;
- trial_ends_at?: string;
- };
+ target_account_id: string
+ target_customer_id: string
+ target_subscription_id: string
+ active: boolean
+ status: Database["public"]["Enums"]["subscription_status"]
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ cancel_at_period_end: boolean
+ currency: string
+ period_starts_at: string
+ period_ends_at: string
+ line_items: Json
+ trial_starts_at?: string
+ trial_ends_at?: string
+ }
Returns: {
- account_id: string;
- active: boolean;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- cancel_at_period_end: boolean;
- created_at: string;
- currency: string;
- id: string;
- period_ends_at: string;
- period_starts_at: string;
- status: Database['public']['Enums']['subscription_status'];
- trial_ends_at: string | null;
- trial_starts_at: string | null;
- updated_at: string;
- };
- };
- };
+ account_id: string
+ active: boolean
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ cancel_at_period_end: boolean
+ created_at: string
+ currency: string
+ id: string
+ period_ends_at: string
+ period_starts_at: string
+ status: Database["public"]["Enums"]["subscription_status"]
+ trial_ends_at: string | null
+ trial_starts_at: string | null
+ updated_at: string
+ }
+ }
+ }
Enums: {
app_permissions:
- | 'roles.manage'
- | 'billing.manage'
- | 'settings.manage'
- | 'members.manage'
- | 'invites.manage';
- billing_provider: 'stripe' | 'lemon-squeezy' | 'paddle';
- payment_status: 'pending' | 'succeeded' | 'failed';
- subscription_item_type: 'flat' | 'per_seat' | 'metered';
+ | "roles.manage"
+ | "billing.manage"
+ | "settings.manage"
+ | "members.manage"
+ | "invites.manage"
+ billing_provider: "stripe" | "lemon-squeezy" | "paddle"
+ payment_status: "pending" | "succeeded" | "failed"
+ subscription_item_type: "flat" | "per_seat" | "metered"
subscription_status:
- | 'active'
- | 'trialing'
- | 'past_due'
- | 'canceled'
- | 'unpaid'
- | 'incomplete'
- | 'incomplete_expired'
- | 'paused';
- };
+ | "active"
+ | "trialing"
+ | "past_due"
+ | "canceled"
+ | "unpaid"
+ | "incomplete"
+ | "incomplete_expired"
+ | "paused"
+ }
CompositeTypes: {
- [_ in never]: never;
- };
- };
+ invitation: {
+ email: string | null
+ role: string | null
+ }
+ }
+ }
storage: {
Tables: {
buckets: {
Row: {
- allowed_mime_types: string[] | null;
- avif_autodetection: boolean | null;
- created_at: string | null;
- file_size_limit: number | null;
- id: string;
- name: string;
- owner: string | null;
- owner_id: string | null;
- public: boolean | null;
- updated_at: string | null;
- };
+ allowed_mime_types: string[] | null
+ avif_autodetection: boolean | null
+ created_at: string | null
+ file_size_limit: number | null
+ id: string
+ name: string
+ owner: string | null
+ owner_id: string | null
+ public: boolean | null
+ updated_at: string | null
+ }
Insert: {
- allowed_mime_types?: string[] | null;
- avif_autodetection?: boolean | null;
- created_at?: string | null;
- file_size_limit?: number | null;
- id: string;
- name: string;
- owner?: string | null;
- owner_id?: string | null;
- public?: boolean | null;
- updated_at?: string | null;
- };
+ allowed_mime_types?: string[] | null
+ avif_autodetection?: boolean | null
+ created_at?: string | null
+ file_size_limit?: number | null
+ id: string
+ name: string
+ owner?: string | null
+ owner_id?: string | null
+ public?: boolean | null
+ updated_at?: string | null
+ }
Update: {
- allowed_mime_types?: string[] | null;
- avif_autodetection?: boolean | null;
- created_at?: string | null;
- file_size_limit?: number | null;
- id?: string;
- name?: string;
- owner?: string | null;
- owner_id?: string | null;
- public?: boolean | null;
- updated_at?: string | null;
- };
- Relationships: [];
- };
+ allowed_mime_types?: string[] | null
+ avif_autodetection?: boolean | null
+ created_at?: string | null
+ file_size_limit?: number | null
+ id?: string
+ name?: string
+ owner?: string | null
+ owner_id?: string | null
+ public?: boolean | null
+ updated_at?: string | null
+ }
+ Relationships: []
+ }
migrations: {
Row: {
- executed_at: string | null;
- hash: string;
- id: number;
- name: string;
- };
+ executed_at: string | null
+ hash: string
+ id: number
+ name: string
+ }
Insert: {
- executed_at?: string | null;
- hash: string;
- id: number;
- name: string;
- };
+ executed_at?: string | null
+ hash: string
+ id: number
+ name: string
+ }
Update: {
- executed_at?: string | null;
- hash?: string;
- id?: number;
- name?: string;
- };
- Relationships: [];
- };
+ executed_at?: string | null
+ hash?: string
+ id?: number
+ name?: string
+ }
+ Relationships: []
+ }
objects: {
Row: {
- bucket_id: string | null;
- created_at: string | null;
- id: string;
- last_accessed_at: string | null;
- metadata: Json | null;
- name: string | null;
- owner: string | null;
- owner_id: string | null;
- path_tokens: string[] | null;
- updated_at: string | null;
- version: string | null;
- };
+ bucket_id: string | null
+ created_at: string | null
+ id: string
+ last_accessed_at: string | null
+ metadata: Json | null
+ name: string | null
+ owner: string | null
+ owner_id: string | null
+ path_tokens: string[] | null
+ updated_at: string | null
+ version: string | null
+ }
Insert: {
- bucket_id?: string | null;
- created_at?: string | null;
- id?: string;
- last_accessed_at?: string | null;
- metadata?: Json | null;
- name?: string | null;
- owner?: string | null;
- owner_id?: string | null;
- path_tokens?: string[] | null;
- updated_at?: string | null;
- version?: string | null;
- };
+ bucket_id?: string | null
+ created_at?: string | null
+ id?: string
+ last_accessed_at?: string | null
+ metadata?: Json | null
+ name?: string | null
+ owner?: string | null
+ owner_id?: string | null
+ path_tokens?: string[] | null
+ updated_at?: string | null
+ version?: string | null
+ }
Update: {
- bucket_id?: string | null;
- created_at?: string | null;
- id?: string;
- last_accessed_at?: string | null;
- metadata?: Json | null;
- name?: string | null;
- owner?: string | null;
- owner_id?: string | null;
- path_tokens?: string[] | null;
- updated_at?: string | null;
- version?: string | null;
- };
+ bucket_id?: string | null
+ created_at?: string | null
+ id?: string
+ last_accessed_at?: string | null
+ metadata?: Json | null
+ name?: string | null
+ owner?: string | null
+ owner_id?: string | null
+ path_tokens?: string[] | null
+ updated_at?: string | null
+ version?: string | null
+ }
Relationships: [
{
- foreignKeyName: 'objects_bucketId_fkey';
- columns: ['bucket_id'];
- isOneToOne: false;
- referencedRelation: 'buckets';
- referencedColumns: ['id'];
+ foreignKeyName: "objects_bucketId_fkey"
+ columns: ["bucket_id"]
+ isOneToOne: false
+ referencedRelation: "buckets"
+ referencedColumns: ["id"]
},
- ];
- };
- };
+ ]
+ }
+ s3_multipart_uploads: {
+ Row: {
+ bucket_id: string
+ created_at: string
+ id: string
+ in_progress_size: number
+ key: string
+ owner_id: string | null
+ upload_signature: string
+ version: string
+ }
+ Insert: {
+ bucket_id: string
+ created_at?: string
+ id: string
+ in_progress_size?: number
+ key: string
+ owner_id?: string | null
+ upload_signature: string
+ version: string
+ }
+ Update: {
+ bucket_id?: string
+ created_at?: string
+ id?: string
+ in_progress_size?: number
+ key?: string
+ owner_id?: string | null
+ upload_signature?: string
+ version?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "s3_multipart_uploads_bucket_id_fkey"
+ columns: ["bucket_id"]
+ isOneToOne: false
+ referencedRelation: "buckets"
+ referencedColumns: ["id"]
+ },
+ ]
+ }
+ s3_multipart_uploads_parts: {
+ Row: {
+ bucket_id: string
+ created_at: string
+ etag: string
+ id: string
+ key: string
+ owner_id: string | null
+ part_number: number
+ size: number
+ upload_id: string
+ version: string
+ }
+ Insert: {
+ bucket_id: string
+ created_at?: string
+ etag: string
+ id?: string
+ key: string
+ owner_id?: string | null
+ part_number: number
+ size?: number
+ upload_id: string
+ version: string
+ }
+ Update: {
+ bucket_id?: string
+ created_at?: string
+ etag?: string
+ id?: string
+ key?: string
+ owner_id?: string | null
+ part_number?: number
+ size?: number
+ upload_id?: string
+ version?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "s3_multipart_uploads_parts_bucket_id_fkey"
+ columns: ["bucket_id"]
+ isOneToOne: false
+ referencedRelation: "buckets"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "s3_multipart_uploads_parts_upload_id_fkey"
+ columns: ["upload_id"]
+ isOneToOne: false
+ referencedRelation: "s3_multipart_uploads"
+ referencedColumns: ["id"]
+ },
+ ]
+ }
+ }
Views: {
- [_ in never]: never;
- };
+ [_ in never]: never
+ }
Functions: {
can_insert_object: {
Args: {
- bucketid: string;
- name: string;
- owner: string;
- metadata: Json;
- };
- Returns: undefined;
- };
+ bucketid: string
+ name: string
+ owner: string
+ metadata: Json
+ }
+ Returns: undefined
+ }
extension: {
Args: {
- name: string;
- };
- Returns: string;
- };
+ name: string
+ }
+ Returns: string
+ }
filename: {
Args: {
- name: string;
- };
- Returns: string;
- };
+ name: string
+ }
+ Returns: string
+ }
foldername: {
Args: {
- name: string;
- };
- Returns: string[];
- };
+ name: string
+ }
+ Returns: string[]
+ }
get_size_by_bucket: {
- Args: Record;
+ Args: Record
Returns: {
- size: number;
- bucket_id: string;
- }[];
- };
+ size: number
+ bucket_id: string
+ }[]
+ }
+ list_multipart_uploads_with_delimiter: {
+ Args: {
+ bucket_id: string
+ prefix_param: string
+ delimiter_param: string
+ max_keys?: number
+ next_key_token?: string
+ next_upload_token?: string
+ }
+ Returns: {
+ key: string
+ id: string
+ created_at: string
+ }[]
+ }
+ list_objects_with_delimiter: {
+ Args: {
+ bucket_id: string
+ prefix_param: string
+ delimiter_param: string
+ max_keys?: number
+ start_after?: string
+ next_token?: string
+ }
+ Returns: {
+ name: string
+ id: string
+ metadata: Json
+ updated_at: string
+ }[]
+ }
search: {
Args: {
- prefix: string;
- bucketname: string;
- limits?: number;
- levels?: number;
- offsets?: number;
- search?: string;
- sortcolumn?: string;
- sortorder?: string;
- };
+ prefix: string
+ bucketname: string
+ limits?: number
+ levels?: number
+ offsets?: number
+ search?: string
+ sortcolumn?: string
+ sortorder?: string
+ }
Returns: {
- name: string;
- id: string;
- updated_at: string;
- created_at: string;
- last_accessed_at: string;
- metadata: Json;
- }[];
- };
- };
+ name: string
+ id: string
+ updated_at: string
+ created_at: string
+ last_accessed_at: string
+ metadata: Json
+ }[]
+ }
+ }
Enums: {
- [_ in never]: never;
- };
+ [_ in never]: never
+ }
CompositeTypes: {
- [_ in never]: never;
- };
- };
-};
+ [_ in never]: never
+ }
+ }
+}
-type PublicSchema = Database[Extract];
+type PublicSchema = Database[Extract]
export type Tables<
PublicTableNameOrOptions extends
- | keyof (PublicSchema['Tables'] & PublicSchema['Views'])
+ | keyof (PublicSchema["Tables"] & PublicSchema["Views"])
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
- ? keyof (Database[PublicTableNameOrOptions['schema']]['Tables'] &
- Database[PublicTableNameOrOptions['schema']]['Views'])
+ ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
+ Database[PublicTableNameOrOptions["schema"]]["Views"])
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
- ? (Database[PublicTableNameOrOptions['schema']]['Tables'] &
- Database[PublicTableNameOrOptions['schema']]['Views'])[TableName] extends {
- Row: infer R;
+ ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
+ Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
+ Row: infer R
}
? R
: never
- : PublicTableNameOrOptions extends keyof (PublicSchema['Tables'] &
- PublicSchema['Views'])
- ? (PublicSchema['Tables'] &
- PublicSchema['Views'])[PublicTableNameOrOptions] extends {
- Row: infer R;
+ : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] &
+ PublicSchema["Views"])
+ ? (PublicSchema["Tables"] &
+ PublicSchema["Views"])[PublicTableNameOrOptions] extends {
+ Row: infer R
}
? R
: never
- : never;
+ : never
export type TablesInsert<
PublicTableNameOrOptions extends
- | keyof PublicSchema['Tables']
+ | keyof PublicSchema["Tables"]
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
- ? keyof Database[PublicTableNameOrOptions['schema']]['Tables']
+ ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
- ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
- Insert: infer I;
+ ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
+ Insert: infer I
}
? I
: never
- : PublicTableNameOrOptions extends keyof PublicSchema['Tables']
- ? PublicSchema['Tables'][PublicTableNameOrOptions] extends {
- Insert: infer I;
+ : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
+ ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
+ Insert: infer I
}
? I
: never
- : never;
+ : never
export type TablesUpdate<
PublicTableNameOrOptions extends
- | keyof PublicSchema['Tables']
+ | keyof PublicSchema["Tables"]
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
- ? keyof Database[PublicTableNameOrOptions['schema']]['Tables']
+ ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
- ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
- Update: infer U;
+ ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
+ Update: infer U
}
? U
: never
- : PublicTableNameOrOptions extends keyof PublicSchema['Tables']
- ? PublicSchema['Tables'][PublicTableNameOrOptions] extends {
- Update: infer U;
+ : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
+ ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
+ Update: infer U
}
? U
: never
- : never;
+ : never
export type Enums<
PublicEnumNameOrOptions extends
- | keyof PublicSchema['Enums']
+ | keyof PublicSchema["Enums"]
| { schema: keyof Database },
EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
- ? keyof Database[PublicEnumNameOrOptions['schema']]['Enums']
+ ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]
: never = never,
> = PublicEnumNameOrOptions extends { schema: keyof Database }
- ? Database[PublicEnumNameOrOptions['schema']]['Enums'][EnumName]
- : PublicEnumNameOrOptions extends keyof PublicSchema['Enums']
- ? PublicSchema['Enums'][PublicEnumNameOrOptions]
- : never;
+ ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
+ : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"]
+ ? PublicSchema["Enums"][PublicEnumNameOrOptions]
+ : never
+
diff --git a/apps/web/public/images/dashboard-demo.webp b/apps/web/public/images/dashboard-demo.webp
index 6e895efea..60d1c664e 100644
Binary files a/apps/web/public/images/dashboard-demo.webp and b/apps/web/public/images/dashboard-demo.webp differ
diff --git a/apps/web/supabase/migrations/20221215192558_schema.sql b/apps/web/supabase/migrations/20221215192558_schema.sql
index 1eb7ba846..29ad8e0cd 100644
--- a/apps/web/supabase/migrations/20221215192558_schema.sql
+++ b/apps/web/supabase/migrations/20221215192558_schema.sql
@@ -1781,19 +1781,21 @@ language plpgsql;
--
-- VIEW "user_account_workspace":
-- we create a view to load the general app data for the authenticated
--- user which includes the user's accounts, memberships, and roles, and relative subscription status
+-- user which includes the user accounts and memberships
create or replace view public.user_account_workspace as
select
accounts.id as id,
accounts.name as name,
accounts.picture_url as picture_url,
+ accounts.public_data as public_data,
subscriptions.status as subscription_status
from
public.accounts
left join public.subscriptions on accounts.id = subscriptions.account_id
where
primary_owner_user_id = auth.uid()
- and accounts.is_personal_account = true;
+ and accounts.is_personal_account = true
+limit 1;
grant select on public.user_account_workspace to authenticated, service_role;
@@ -1822,7 +1824,7 @@ grant select on public.user_accounts to authenticated, service_role;
-- Function: get the account workspace for an organization account
-- to load all the required data for the authenticated user within the account scope
create or replace function
- public.organization_account_workspace(account_slug text)
+ public.team_account_workspace(account_slug text)
returns table(
id uuid,
name varchar(255),
@@ -1869,7 +1871,7 @@ end;
$$
language plpgsql;
-grant execute on function public.organization_account_workspace(text)
+grant execute on function public.team_account_workspace(text)
to authenticated, service_role;
-- Functions: get account members
diff --git a/packages/features/accounts/src/components/personal-account-dropdown.tsx b/packages/features/accounts/src/components/personal-account-dropdown.tsx
index 0c72c1e67..12309c96b 100644
--- a/packages/features/accounts/src/components/personal-account-dropdown.tsx
+++ b/packages/features/accounts/src/components/personal-account-dropdown.tsx
@@ -36,19 +36,29 @@ export function PersonalAccountDropdown({
showProfileName,
paths,
features,
+ account,
}: {
className?: string;
user: User | null;
+
+ account?: {
+ id: string | null;
+ name: string | null;
+ picture_url: string | null;
+ };
+
signOutRequested: () => unknown;
showProfileName?: boolean;
+
paths: {
home: string;
};
+
features: {
enableThemeToggle: boolean;
};
}) {
- const { data: personalAccountData } = usePersonalAccountData();
+ const { data: personalAccountData } = usePersonalAccountData(account);
const signedInAsLabel = useMemo(() => {
const email = user?.email ?? undefined;
@@ -57,7 +67,8 @@ export function PersonalAccountDropdown({
return email ?? phone;
}, [user?.email, user?.phone]);
- const displayName = personalAccountData?.name ?? user?.email ?? '';
+ const displayName =
+ account?.name ?? personalAccountData?.name ?? user?.email ?? '';
const isSuperAdmin = useMemo(() => {
return user?.app_metadata.role === 'super-admin';
diff --git a/packages/features/accounts/src/hooks/use-personal-account-data.ts b/packages/features/accounts/src/hooks/use-personal-account-data.ts
index c21b1e490..14b7e037e 100644
--- a/packages/features/accounts/src/hooks/use-personal-account-data.ts
+++ b/packages/features/accounts/src/hooks/use-personal-account-data.ts
@@ -5,7 +5,15 @@ import { useQuery, useQueryClient } from '@tanstack/react-query';
import { useSupabase } from '@kit/supabase/hooks/use-supabase';
import { useUser } from '@kit/supabase/hooks/use-user';
-export function usePersonalAccountData() {
+export function usePersonalAccountData(
+ partialAccount?:
+ | {
+ id: string | null;
+ name: string | null;
+ picture_url: string | null;
+ }
+ | undefined,
+) {
const client = useSupabase();
const user = useUser();
const userId = user.data?.id;
@@ -43,6 +51,7 @@ export function usePersonalAccountData() {
enabled: !!userId,
refetchOnWindowFocus: false,
refetchOnMount: false,
+ initialData: partialAccount,
});
}
diff --git a/packages/supabase/src/database.types.ts b/packages/supabase/src/database.types.ts
index eb491497e..a5e720bac 100644
--- a/packages/supabase/src/database.types.ts
+++ b/packages/supabase/src/database.types.ts
@@ -4,1224 +4,1336 @@ export type Json =
| boolean
| null
| { [key: string]: Json | undefined }
- | Json[];
+ | Json[]
export type Database = {
graphql_public: {
Tables: {
- [_ in never]: never;
- };
+ [_ in never]: never
+ }
Views: {
- [_ in never]: never;
- };
+ [_ in never]: never
+ }
Functions: {
graphql: {
Args: {
- operationName?: string;
- query?: string;
- variables?: Json;
- extensions?: Json;
- };
- Returns: Json;
- };
- };
+ operationName?: string
+ query?: string
+ variables?: Json
+ extensions?: Json
+ }
+ Returns: Json
+ }
+ }
Enums: {
- [_ in never]: never;
- };
+ [_ in never]: never
+ }
CompositeTypes: {
- [_ in never]: never;
- };
- };
+ [_ in never]: never
+ }
+ }
public: {
Tables: {
account_roles: {
Row: {
- account_id: string;
- id: number;
- role: string;
- };
+ account_id: string
+ id: number
+ role: string
+ }
Insert: {
- account_id: string;
- id?: number;
- role: string;
- };
+ account_id: string
+ id?: number
+ role: string
+ }
Update: {
- account_id?: string;
- id?: number;
- role?: string;
- };
+ account_id?: string
+ id?: number
+ role?: string
+ }
Relationships: [
{
- foreignKeyName: 'account_roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "account_roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'account_roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "account_roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'account_roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "account_roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'account_roles_role_fkey';
- columns: ['role'];
- isOneToOne: false;
- referencedRelation: 'roles';
- referencedColumns: ['name'];
+ foreignKeyName: "account_roles_role_fkey"
+ columns: ["role"]
+ isOneToOne: false
+ referencedRelation: "roles"
+ referencedColumns: ["name"]
},
- ];
- };
+ ]
+ }
accounts: {
Row: {
- created_at: string | null;
- created_by: string | null;
- email: string | null;
- id: string;
- is_personal_account: boolean;
- name: string;
- picture_url: string | null;
- primary_owner_user_id: string;
- public_data: Json;
- slug: string | null;
- updated_at: string | null;
- updated_by: string | null;
- };
+ created_at: string | null
+ created_by: string | null
+ email: string | null
+ id: string
+ is_personal_account: boolean
+ name: string
+ picture_url: string | null
+ primary_owner_user_id: string
+ public_data: Json
+ slug: string | null
+ updated_at: string | null
+ updated_by: string | null
+ }
Insert: {
- created_at?: string | null;
- created_by?: string | null;
- email?: string | null;
- id?: string;
- is_personal_account?: boolean;
- name: string;
- picture_url?: string | null;
- primary_owner_user_id?: string;
- public_data?: Json;
- slug?: string | null;
- updated_at?: string | null;
- updated_by?: string | null;
- };
+ created_at?: string | null
+ created_by?: string | null
+ email?: string | null
+ id?: string
+ is_personal_account?: boolean
+ name: string
+ picture_url?: string | null
+ primary_owner_user_id?: string
+ public_data?: Json
+ slug?: string | null
+ updated_at?: string | null
+ updated_by?: string | null
+ }
Update: {
- created_at?: string | null;
- created_by?: string | null;
- email?: string | null;
- id?: string;
- is_personal_account?: boolean;
- name?: string;
- picture_url?: string | null;
- primary_owner_user_id?: string;
- public_data?: Json;
- slug?: string | null;
- updated_at?: string | null;
- updated_by?: string | null;
- };
+ created_at?: string | null
+ created_by?: string | null
+ email?: string | null
+ id?: string
+ is_personal_account?: boolean
+ name?: string
+ picture_url?: string | null
+ primary_owner_user_id?: string
+ public_data?: Json
+ slug?: string | null
+ updated_at?: string | null
+ updated_by?: string | null
+ }
Relationships: [
{
- foreignKeyName: 'accounts_created_by_fkey';
- columns: ['created_by'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_created_by_fkey"
+ columns: ["created_by"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_primary_owner_user_id_fkey';
- columns: ['primary_owner_user_id'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_primary_owner_user_id_fkey"
+ columns: ["primary_owner_user_id"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_updated_by_fkey';
- columns: ['updated_by'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_updated_by_fkey"
+ columns: ["updated_by"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
accounts_memberships: {
Row: {
- account_id: string;
- account_role: string;
- created_at: string;
- created_by: string | null;
- updated_at: string;
- updated_by: string | null;
- user_id: string;
- };
+ account_id: string
+ account_role: string
+ created_at: string
+ created_by: string | null
+ updated_at: string
+ updated_by: string | null
+ user_id: string
+ }
Insert: {
- account_id: string;
- account_role: string;
- created_at?: string;
- created_by?: string | null;
- updated_at?: string;
- updated_by?: string | null;
- user_id: string;
- };
+ account_id: string
+ account_role: string
+ created_at?: string
+ created_by?: string | null
+ updated_at?: string
+ updated_by?: string | null
+ user_id: string
+ }
Update: {
- account_id?: string;
- account_role?: string;
- created_at?: string;
- created_by?: string | null;
- updated_at?: string;
- updated_by?: string | null;
- user_id?: string;
- };
+ account_id?: string
+ account_role?: string
+ created_at?: string
+ created_by?: string | null
+ updated_at?: string
+ updated_by?: string | null
+ user_id?: string
+ }
Relationships: [
{
- foreignKeyName: 'accounts_memberships_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_memberships_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_memberships_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_memberships_account_role_fkey';
- columns: ['account_role'];
- isOneToOne: false;
- referencedRelation: 'roles';
- referencedColumns: ['name'];
+ foreignKeyName: "accounts_memberships_account_role_fkey"
+ columns: ["account_role"]
+ isOneToOne: false
+ referencedRelation: "roles"
+ referencedColumns: ["name"]
},
{
- foreignKeyName: 'accounts_memberships_created_by_fkey';
- columns: ['created_by'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_created_by_fkey"
+ columns: ["created_by"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_memberships_updated_by_fkey';
- columns: ['updated_by'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_updated_by_fkey"
+ columns: ["updated_by"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'accounts_memberships_user_id_fkey';
- columns: ['user_id'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "accounts_memberships_user_id_fkey"
+ columns: ["user_id"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
billing_customers: {
Row: {
- account_id: string;
- customer_id: string;
- email: string | null;
- id: number;
- provider: Database['public']['Enums']['billing_provider'];
- };
+ account_id: string
+ customer_id: string
+ email: string | null
+ id: number
+ provider: Database["public"]["Enums"]["billing_provider"]
+ }
Insert: {
- account_id: string;
- customer_id: string;
- email?: string | null;
- id?: number;
- provider: Database['public']['Enums']['billing_provider'];
- };
+ account_id: string
+ customer_id: string
+ email?: string | null
+ id?: number
+ provider: Database["public"]["Enums"]["billing_provider"]
+ }
Update: {
- account_id?: string;
- customer_id?: string;
- email?: string | null;
- id?: number;
- provider?: Database['public']['Enums']['billing_provider'];
- };
+ account_id?: string
+ customer_id?: string
+ email?: string | null
+ id?: number
+ provider?: Database["public"]["Enums"]["billing_provider"]
+ }
Relationships: [
{
- foreignKeyName: 'billing_customers_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "billing_customers_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'billing_customers_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "billing_customers_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'billing_customers_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "billing_customers_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
config: {
Row: {
- billing_provider: Database['public']['Enums']['billing_provider'];
- enable_account_billing: boolean;
- enable_team_account_billing: boolean;
- enable_team_accounts: boolean;
- };
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ enable_account_billing: boolean
+ enable_team_account_billing: boolean
+ enable_team_accounts: boolean
+ }
Insert: {
- billing_provider?: Database['public']['Enums']['billing_provider'];
- enable_account_billing?: boolean;
- enable_team_account_billing?: boolean;
- enable_team_accounts?: boolean;
- };
+ billing_provider?: Database["public"]["Enums"]["billing_provider"]
+ enable_account_billing?: boolean
+ enable_team_account_billing?: boolean
+ enable_team_accounts?: boolean
+ }
Update: {
- billing_provider?: Database['public']['Enums']['billing_provider'];
- enable_account_billing?: boolean;
- enable_team_account_billing?: boolean;
- enable_team_accounts?: boolean;
- };
- Relationships: [];
- };
+ billing_provider?: Database["public"]["Enums"]["billing_provider"]
+ enable_account_billing?: boolean
+ enable_team_account_billing?: boolean
+ enable_team_accounts?: boolean
+ }
+ Relationships: []
+ }
invitations: {
Row: {
- account_id: string;
- created_at: string;
- email: string;
- expires_at: string;
- id: number;
- invite_token: string;
- invited_by: string;
- role: string;
- updated_at: string;
- };
+ account_id: string
+ created_at: string
+ email: string
+ expires_at: string
+ id: number
+ invite_token: string
+ invited_by: string
+ role: string
+ updated_at: string
+ }
Insert: {
- account_id: string;
- created_at?: string;
- email: string;
- expires_at?: string;
- id?: number;
- invite_token: string;
- invited_by: string;
- role: string;
- updated_at?: string;
- };
+ account_id: string
+ created_at?: string
+ email: string
+ expires_at?: string
+ id?: number
+ invite_token: string
+ invited_by: string
+ role: string
+ updated_at?: string
+ }
Update: {
- account_id?: string;
- created_at?: string;
- email?: string;
- expires_at?: string;
- id?: number;
- invite_token?: string;
- invited_by?: string;
- role?: string;
- updated_at?: string;
- };
+ account_id?: string
+ created_at?: string
+ email?: string
+ expires_at?: string
+ id?: number
+ invite_token?: string
+ invited_by?: string
+ role?: string
+ updated_at?: string
+ }
Relationships: [
{
- foreignKeyName: 'invitations_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "invitations_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'invitations_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "invitations_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'invitations_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "invitations_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'invitations_invited_by_fkey';
- columns: ['invited_by'];
- isOneToOne: false;
- referencedRelation: 'users';
- referencedColumns: ['id'];
+ foreignKeyName: "invitations_invited_by_fkey"
+ columns: ["invited_by"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'invitations_role_fkey';
- columns: ['role'];
- isOneToOne: false;
- referencedRelation: 'roles';
- referencedColumns: ['name'];
+ foreignKeyName: "invitations_role_fkey"
+ columns: ["role"]
+ isOneToOne: false
+ referencedRelation: "roles"
+ referencedColumns: ["name"]
},
- ];
- };
+ ]
+ }
order_items: {
Row: {
- created_at: string;
- order_id: string;
- price_amount: number | null;
- product_id: string;
- quantity: number;
- updated_at: string;
- variant_id: string;
- };
+ created_at: string
+ order_id: string
+ price_amount: number | null
+ product_id: string
+ quantity: number
+ updated_at: string
+ variant_id: string
+ }
Insert: {
- created_at?: string;
- order_id: string;
- price_amount?: number | null;
- product_id: string;
- quantity?: number;
- updated_at?: string;
- variant_id: string;
- };
+ created_at?: string
+ order_id: string
+ price_amount?: number | null
+ product_id: string
+ quantity?: number
+ updated_at?: string
+ variant_id: string
+ }
Update: {
- created_at?: string;
- order_id?: string;
- price_amount?: number | null;
- product_id?: string;
- quantity?: number;
- updated_at?: string;
- variant_id?: string;
- };
+ created_at?: string
+ order_id?: string
+ price_amount?: number | null
+ product_id?: string
+ quantity?: number
+ updated_at?: string
+ variant_id?: string
+ }
Relationships: [
{
- foreignKeyName: 'order_items_order_id_fkey';
- columns: ['order_id'];
- isOneToOne: false;
- referencedRelation: 'orders';
- referencedColumns: ['id'];
+ foreignKeyName: "order_items_order_id_fkey"
+ columns: ["order_id"]
+ isOneToOne: false
+ referencedRelation: "orders"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
orders: {
Row: {
- account_id: string;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- created_at: string;
- currency: string;
- id: string;
- status: Database['public']['Enums']['payment_status'];
- total_amount: number;
- updated_at: string;
- };
+ account_id: string
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ created_at: string
+ currency: string
+ id: string
+ status: Database["public"]["Enums"]["payment_status"]
+ total_amount: number
+ updated_at: string
+ }
Insert: {
- account_id: string;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- created_at?: string;
- currency: string;
- id: string;
- status: Database['public']['Enums']['payment_status'];
- total_amount: number;
- updated_at?: string;
- };
+ account_id: string
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ created_at?: string
+ currency: string
+ id: string
+ status: Database["public"]["Enums"]["payment_status"]
+ total_amount: number
+ updated_at?: string
+ }
Update: {
- account_id?: string;
- billing_customer_id?: number;
- billing_provider?: Database['public']['Enums']['billing_provider'];
- created_at?: string;
- currency?: string;
- id?: string;
- status?: Database['public']['Enums']['payment_status'];
- total_amount?: number;
- updated_at?: string;
- };
+ account_id?: string
+ billing_customer_id?: number
+ billing_provider?: Database["public"]["Enums"]["billing_provider"]
+ created_at?: string
+ currency?: string
+ id?: string
+ status?: Database["public"]["Enums"]["payment_status"]
+ total_amount?: number
+ updated_at?: string
+ }
Relationships: [
{
- foreignKeyName: 'orders_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "orders_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'orders_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "orders_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'orders_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "orders_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'orders_billing_customer_id_fkey';
- columns: ['billing_customer_id'];
- isOneToOne: false;
- referencedRelation: 'billing_customers';
- referencedColumns: ['id'];
+ foreignKeyName: "orders_billing_customer_id_fkey"
+ columns: ["billing_customer_id"]
+ isOneToOne: false
+ referencedRelation: "billing_customers"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
role_permissions: {
Row: {
- id: number;
- permission: Database['public']['Enums']['app_permissions'];
- role: string;
- };
+ id: number
+ permission: Database["public"]["Enums"]["app_permissions"]
+ role: string
+ }
Insert: {
- id?: number;
- permission: Database['public']['Enums']['app_permissions'];
- role: string;
- };
+ id?: number
+ permission: Database["public"]["Enums"]["app_permissions"]
+ role: string
+ }
Update: {
- id?: number;
- permission?: Database['public']['Enums']['app_permissions'];
- role?: string;
- };
+ id?: number
+ permission?: Database["public"]["Enums"]["app_permissions"]
+ role?: string
+ }
Relationships: [
{
- foreignKeyName: 'role_permissions_role_fkey';
- columns: ['role'];
- isOneToOne: false;
- referencedRelation: 'roles';
- referencedColumns: ['name'];
+ foreignKeyName: "role_permissions_role_fkey"
+ columns: ["role"]
+ isOneToOne: false
+ referencedRelation: "roles"
+ referencedColumns: ["name"]
},
- ];
- };
+ ]
+ }
roles: {
Row: {
- account_id: string | null;
- hierarchy_level: number;
- name: string;
- };
+ account_id: string | null
+ hierarchy_level: number
+ name: string
+ }
Insert: {
- account_id?: string | null;
- hierarchy_level: number;
- name: string;
- };
+ account_id?: string | null
+ hierarchy_level: number
+ name: string
+ }
Update: {
- account_id?: string | null;
- hierarchy_level?: number;
- name?: string;
- };
+ account_id?: string | null
+ hierarchy_level?: number
+ name?: string
+ }
Relationships: [
{
- foreignKeyName: 'roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'roles_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "roles_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
subscription_items: {
Row: {
- created_at: string;
- interval: string;
- interval_count: number;
- price_amount: number | null;
- product_id: string;
- quantity: number;
- subscription_id: string;
- type: Database['public']['Enums']['subscription_item_type'];
- updated_at: string;
- variant_id: string;
- };
+ created_at: string
+ interval: string
+ interval_count: number
+ price_amount: number | null
+ product_id: string
+ quantity: number
+ subscription_id: string
+ type: Database["public"]["Enums"]["subscription_item_type"]
+ updated_at: string
+ variant_id: string
+ }
Insert: {
- created_at?: string;
- interval: string;
- interval_count: number;
- price_amount?: number | null;
- product_id: string;
- quantity?: number;
- subscription_id: string;
- type: Database['public']['Enums']['subscription_item_type'];
- updated_at?: string;
- variant_id: string;
- };
+ created_at?: string
+ interval: string
+ interval_count: number
+ price_amount?: number | null
+ product_id: string
+ quantity?: number
+ subscription_id: string
+ type: Database["public"]["Enums"]["subscription_item_type"]
+ updated_at?: string
+ variant_id: string
+ }
Update: {
- created_at?: string;
- interval?: string;
- interval_count?: number;
- price_amount?: number | null;
- product_id?: string;
- quantity?: number;
- subscription_id?: string;
- type?: Database['public']['Enums']['subscription_item_type'];
- updated_at?: string;
- variant_id?: string;
- };
+ created_at?: string
+ interval?: string
+ interval_count?: number
+ price_amount?: number | null
+ product_id?: string
+ quantity?: number
+ subscription_id?: string
+ type?: Database["public"]["Enums"]["subscription_item_type"]
+ updated_at?: string
+ variant_id?: string
+ }
Relationships: [
{
- foreignKeyName: 'subscription_items_subscription_id_fkey';
- columns: ['subscription_id'];
- isOneToOne: false;
- referencedRelation: 'subscriptions';
- referencedColumns: ['id'];
+ foreignKeyName: "subscription_items_subscription_id_fkey"
+ columns: ["subscription_id"]
+ isOneToOne: false
+ referencedRelation: "subscriptions"
+ referencedColumns: ["id"]
},
- ];
- };
+ ]
+ }
subscriptions: {
Row: {
- account_id: string;
- active: boolean;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- cancel_at_period_end: boolean;
- created_at: string;
- currency: string;
- id: string;
- period_ends_at: string;
- period_starts_at: string;
- status: Database['public']['Enums']['subscription_status'];
- trial_ends_at: string | null;
- trial_starts_at: string | null;
- updated_at: string;
- };
+ account_id: string
+ active: boolean
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ cancel_at_period_end: boolean
+ created_at: string
+ currency: string
+ id: string
+ period_ends_at: string
+ period_starts_at: string
+ status: Database["public"]["Enums"]["subscription_status"]
+ trial_ends_at: string | null
+ trial_starts_at: string | null
+ updated_at: string
+ }
Insert: {
- account_id: string;
- active: boolean;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- cancel_at_period_end: boolean;
- created_at?: string;
- currency: string;
- id: string;
- period_ends_at: string;
- period_starts_at: string;
- status: Database['public']['Enums']['subscription_status'];
- trial_ends_at?: string | null;
- trial_starts_at?: string | null;
- updated_at?: string;
- };
+ account_id: string
+ active: boolean
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ cancel_at_period_end: boolean
+ created_at?: string
+ currency: string
+ id: string
+ period_ends_at: string
+ period_starts_at: string
+ status: Database["public"]["Enums"]["subscription_status"]
+ trial_ends_at?: string | null
+ trial_starts_at?: string | null
+ updated_at?: string
+ }
Update: {
- account_id?: string;
- active?: boolean;
- billing_customer_id?: number;
- billing_provider?: Database['public']['Enums']['billing_provider'];
- cancel_at_period_end?: boolean;
- created_at?: string;
- currency?: string;
- id?: string;
- period_ends_at?: string;
- period_starts_at?: string;
- status?: Database['public']['Enums']['subscription_status'];
- trial_ends_at?: string | null;
- trial_starts_at?: string | null;
- updated_at?: string;
- };
+ account_id?: string
+ active?: boolean
+ billing_customer_id?: number
+ billing_provider?: Database["public"]["Enums"]["billing_provider"]
+ cancel_at_period_end?: boolean
+ created_at?: string
+ currency?: string
+ id?: string
+ period_ends_at?: string
+ period_starts_at?: string
+ status?: Database["public"]["Enums"]["subscription_status"]
+ trial_ends_at?: string | null
+ trial_starts_at?: string | null
+ updated_at?: string
+ }
Relationships: [
{
- foreignKeyName: 'subscriptions_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "subscriptions_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'subscriptions_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_account_workspace';
- referencedColumns: ['id'];
+ foreignKeyName: "subscriptions_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_account_workspace"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'subscriptions_account_id_fkey';
- columns: ['account_id'];
- isOneToOne: false;
- referencedRelation: 'user_accounts';
- referencedColumns: ['id'];
+ foreignKeyName: "subscriptions_account_id_fkey"
+ columns: ["account_id"]
+ isOneToOne: false
+ referencedRelation: "user_accounts"
+ referencedColumns: ["id"]
},
{
- foreignKeyName: 'subscriptions_billing_customer_id_fkey';
- columns: ['billing_customer_id'];
- isOneToOne: false;
- referencedRelation: 'billing_customers';
- referencedColumns: ['id'];
+ foreignKeyName: "subscriptions_billing_customer_id_fkey"
+ columns: ["billing_customer_id"]
+ isOneToOne: false
+ referencedRelation: "billing_customers"
+ referencedColumns: ["id"]
},
- ];
- };
- };
+ ]
+ }
+ }
Views: {
user_account_workspace: {
Row: {
- id: string | null;
- name: string | null;
- picture_url: string | null;
+ id: string | null
+ name: string | null
+ picture_url: string | null
+ public_data: Json | null
subscription_status:
- | Database['public']['Enums']['subscription_status']
- | null;
- };
- Relationships: [];
- };
+ | Database["public"]["Enums"]["subscription_status"]
+ | null
+ }
+ Relationships: []
+ }
user_accounts: {
Row: {
- id: string | null;
- name: string | null;
- picture_url: string | null;
- role: string | null;
- slug: string | null;
- };
+ id: string | null
+ name: string | null
+ picture_url: string | null
+ role: string | null
+ slug: string | null
+ }
Relationships: [
{
- foreignKeyName: 'accounts_memberships_account_role_fkey';
- columns: ['role'];
- isOneToOne: false;
- referencedRelation: 'roles';
- referencedColumns: ['name'];
+ foreignKeyName: "accounts_memberships_account_role_fkey"
+ columns: ["role"]
+ isOneToOne: false
+ referencedRelation: "roles"
+ referencedColumns: ["name"]
},
- ];
- };
- };
+ ]
+ }
+ }
Functions: {
accept_invitation: {
Args: {
- token: string;
- user_id: string;
- };
- Returns: string;
- };
+ token: string
+ user_id: string
+ }
+ Returns: string
+ }
add_invitations_to_account: {
Args: {
- account_slug: string;
- invitations: unknown[];
- };
- Returns: Database['public']['Tables']['invitations']['Row'][];
- };
- create_account: {
- Args: {
- account_name: string;
- };
- Returns: {
- created_at: string | null;
- created_by: string | null;
- email: string | null;
- id: string;
- is_personal_account: boolean;
- name: string;
- picture_url: string | null;
- primary_owner_user_id: string;
- public_data: Json;
- slug: string | null;
- updated_at: string | null;
- updated_by: string | null;
- };
- };
+ account_slug: string
+ invitations: Database["public"]["CompositeTypes"]["invitation"][]
+ }
+ Returns: Database["public"]["Tables"]["invitations"]["Row"][]
+ }
create_invitation: {
Args: {
- account_id: string;
- email: string;
- role: string;
- };
+ account_id: string
+ email: string
+ role: string
+ }
Returns: {
- account_id: string;
- created_at: string;
- email: string;
- expires_at: string;
- id: number;
- invite_token: string;
- invited_by: string;
- role: string;
- updated_at: string;
- };
- };
+ account_id: string
+ created_at: string
+ email: string
+ expires_at: string
+ id: number
+ invite_token: string
+ invited_by: string
+ role: string
+ updated_at: string
+ }
+ }
create_team_account: {
Args: {
- account_name: string;
- };
+ account_name: string
+ }
Returns: {
- created_at: string | null;
- created_by: string | null;
- email: string | null;
- id: string;
- is_personal_account: boolean;
- name: string;
- picture_url: string | null;
- primary_owner_user_id: string;
- public_data: Json;
- slug: string | null;
- updated_at: string | null;
- updated_by: string | null;
- };
- };
+ created_at: string | null
+ created_by: string | null
+ email: string | null
+ id: string
+ is_personal_account: boolean
+ name: string
+ picture_url: string | null
+ primary_owner_user_id: string
+ public_data: Json
+ slug: string | null
+ updated_at: string | null
+ updated_by: string | null
+ }
+ }
get_account_invitations: {
Args: {
- account_slug: string;
- };
+ account_slug: string
+ }
Returns: {
- id: number;
- email: string;
- account_id: string;
- invited_by: string;
- role: string;
- created_at: string;
- updated_at: string;
- expires_at: string;
- inviter_name: string;
- inviter_email: string;
- }[];
- };
+ id: number
+ email: string
+ account_id: string
+ invited_by: string
+ role: string
+ created_at: string
+ updated_at: string
+ expires_at: string
+ inviter_name: string
+ inviter_email: string
+ }[]
+ }
get_account_members: {
Args: {
- account_slug: string;
- };
+ account_slug: string
+ }
Returns: {
- id: string;
- user_id: string;
- account_id: string;
- role: string;
- role_hierarchy_level: number;
- primary_owner_user_id: string;
- name: string;
- email: string;
- picture_url: string;
- created_at: string;
- updated_at: string;
- }[];
- };
+ id: string
+ user_id: string
+ account_id: string
+ role: string
+ role_hierarchy_level: number
+ primary_owner_user_id: string
+ name: string
+ email: string
+ picture_url: string
+ created_at: string
+ updated_at: string
+ }[]
+ }
get_config: {
- Args: Record;
- Returns: Json;
- };
+ Args: Record
+ Returns: Json
+ }
has_more_elevated_role: {
Args: {
- target_user_id: string;
- target_account_id: string;
- role_name: string;
- };
- Returns: boolean;
- };
+ target_user_id: string
+ target_account_id: string
+ role_name: string
+ }
+ Returns: boolean
+ }
has_permission: {
Args: {
- user_id: string;
- account_id: string;
- permission_name: Database['public']['Enums']['app_permissions'];
- };
- Returns: boolean;
- };
+ user_id: string
+ account_id: string
+ permission_name: Database["public"]["Enums"]["app_permissions"]
+ }
+ Returns: boolean
+ }
has_role_on_account: {
Args: {
- account_id: string;
- account_role?: string;
- };
- Returns: boolean;
- };
+ account_id: string
+ account_role?: string
+ }
+ Returns: boolean
+ }
is_account_owner: {
Args: {
- account_id: string;
- };
- Returns: boolean;
- };
+ account_id: string
+ }
+ Returns: boolean
+ }
is_set: {
Args: {
- field_name: string;
- };
- Returns: boolean;
- };
+ field_name: string
+ }
+ Returns: boolean
+ }
is_team_member: {
Args: {
- account_id: string;
- user_id: string;
- };
- Returns: boolean;
- };
- organization_account_workspace: {
+ account_id: string
+ user_id: string
+ }
+ Returns: boolean
+ }
+ team_account_workspace: {
Args: {
- account_slug: string;
- };
+ account_slug: string
+ }
Returns: {
- id: string;
- name: string;
- picture_url: string;
- slug: string;
- role: string;
- role_hierarchy_level: number;
- primary_owner_user_id: string;
- subscription_status: Database['public']['Enums']['subscription_status'];
- permissions: Database['public']['Enums']['app_permissions'][];
- }[];
- };
+ id: string
+ name: string
+ picture_url: string
+ slug: string
+ role: string
+ role_hierarchy_level: number
+ primary_owner_user_id: string
+ subscription_status: Database["public"]["Enums"]["subscription_status"]
+ permissions: Database["public"]["Enums"]["app_permissions"][]
+ }[]
+ }
transfer_team_account_ownership: {
Args: {
- target_account_id: string;
- new_owner_id: string;
- };
- Returns: undefined;
- };
+ target_account_id: string
+ new_owner_id: string
+ }
+ Returns: undefined
+ }
unaccent: {
Args: {
- '': string;
- };
- Returns: string;
- };
+ "": string
+ }
+ Returns: string
+ }
unaccent_init: {
Args: {
- '': unknown;
- };
- Returns: unknown;
- };
+ "": unknown
+ }
+ Returns: unknown
+ }
upsert_order: {
Args: {
- target_account_id: string;
- target_customer_id: string;
- target_order_id: string;
- status: Database['public']['Enums']['payment_status'];
- billing_provider: Database['public']['Enums']['billing_provider'];
- total_amount: number;
- currency: string;
- line_items: Json;
- };
+ target_account_id: string
+ target_customer_id: string
+ target_order_id: string
+ status: Database["public"]["Enums"]["payment_status"]
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ total_amount: number
+ currency: string
+ line_items: Json
+ }
Returns: {
- account_id: string;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- created_at: string;
- currency: string;
- id: string;
- status: Database['public']['Enums']['payment_status'];
- total_amount: number;
- updated_at: string;
- };
- };
+ account_id: string
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ created_at: string
+ currency: string
+ id: string
+ status: Database["public"]["Enums"]["payment_status"]
+ total_amount: number
+ updated_at: string
+ }
+ }
upsert_subscription: {
Args: {
- target_account_id: string;
- target_customer_id: string;
- target_subscription_id: string;
- active: boolean;
- status: Database['public']['Enums']['subscription_status'];
- billing_provider: Database['public']['Enums']['billing_provider'];
- cancel_at_period_end: boolean;
- currency: string;
- period_starts_at: string;
- period_ends_at: string;
- line_items: Json;
- trial_starts_at?: string;
- trial_ends_at?: string;
- };
+ target_account_id: string
+ target_customer_id: string
+ target_subscription_id: string
+ active: boolean
+ status: Database["public"]["Enums"]["subscription_status"]
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ cancel_at_period_end: boolean
+ currency: string
+ period_starts_at: string
+ period_ends_at: string
+ line_items: Json
+ trial_starts_at?: string
+ trial_ends_at?: string
+ }
Returns: {
- account_id: string;
- active: boolean;
- billing_customer_id: number;
- billing_provider: Database['public']['Enums']['billing_provider'];
- cancel_at_period_end: boolean;
- created_at: string;
- currency: string;
- id: string;
- period_ends_at: string;
- period_starts_at: string;
- status: Database['public']['Enums']['subscription_status'];
- trial_ends_at: string | null;
- trial_starts_at: string | null;
- updated_at: string;
- };
- };
- };
+ account_id: string
+ active: boolean
+ billing_customer_id: number
+ billing_provider: Database["public"]["Enums"]["billing_provider"]
+ cancel_at_period_end: boolean
+ created_at: string
+ currency: string
+ id: string
+ period_ends_at: string
+ period_starts_at: string
+ status: Database["public"]["Enums"]["subscription_status"]
+ trial_ends_at: string | null
+ trial_starts_at: string | null
+ updated_at: string
+ }
+ }
+ }
Enums: {
app_permissions:
- | 'roles.manage'
- | 'billing.manage'
- | 'settings.manage'
- | 'members.manage'
- | 'invites.manage';
- billing_provider: 'stripe' | 'lemon-squeezy' | 'paddle';
- payment_status: 'pending' | 'succeeded' | 'failed';
- subscription_item_type: 'flat' | 'per_seat' | 'metered';
+ | "roles.manage"
+ | "billing.manage"
+ | "settings.manage"
+ | "members.manage"
+ | "invites.manage"
+ billing_provider: "stripe" | "lemon-squeezy" | "paddle"
+ payment_status: "pending" | "succeeded" | "failed"
+ subscription_item_type: "flat" | "per_seat" | "metered"
subscription_status:
- | 'active'
- | 'trialing'
- | 'past_due'
- | 'canceled'
- | 'unpaid'
- | 'incomplete'
- | 'incomplete_expired'
- | 'paused';
- };
+ | "active"
+ | "trialing"
+ | "past_due"
+ | "canceled"
+ | "unpaid"
+ | "incomplete"
+ | "incomplete_expired"
+ | "paused"
+ }
CompositeTypes: {
- [_ in never]: never;
- };
- };
+ invitation: {
+ email: string | null
+ role: string | null
+ }
+ }
+ }
storage: {
Tables: {
buckets: {
Row: {
- allowed_mime_types: string[] | null;
- avif_autodetection: boolean | null;
- created_at: string | null;
- file_size_limit: number | null;
- id: string;
- name: string;
- owner: string | null;
- owner_id: string | null;
- public: boolean | null;
- updated_at: string | null;
- };
+ allowed_mime_types: string[] | null
+ avif_autodetection: boolean | null
+ created_at: string | null
+ file_size_limit: number | null
+ id: string
+ name: string
+ owner: string | null
+ owner_id: string | null
+ public: boolean | null
+ updated_at: string | null
+ }
Insert: {
- allowed_mime_types?: string[] | null;
- avif_autodetection?: boolean | null;
- created_at?: string | null;
- file_size_limit?: number | null;
- id: string;
- name: string;
- owner?: string | null;
- owner_id?: string | null;
- public?: boolean | null;
- updated_at?: string | null;
- };
+ allowed_mime_types?: string[] | null
+ avif_autodetection?: boolean | null
+ created_at?: string | null
+ file_size_limit?: number | null
+ id: string
+ name: string
+ owner?: string | null
+ owner_id?: string | null
+ public?: boolean | null
+ updated_at?: string | null
+ }
Update: {
- allowed_mime_types?: string[] | null;
- avif_autodetection?: boolean | null;
- created_at?: string | null;
- file_size_limit?: number | null;
- id?: string;
- name?: string;
- owner?: string | null;
- owner_id?: string | null;
- public?: boolean | null;
- updated_at?: string | null;
- };
- Relationships: [];
- };
+ allowed_mime_types?: string[] | null
+ avif_autodetection?: boolean | null
+ created_at?: string | null
+ file_size_limit?: number | null
+ id?: string
+ name?: string
+ owner?: string | null
+ owner_id?: string | null
+ public?: boolean | null
+ updated_at?: string | null
+ }
+ Relationships: []
+ }
migrations: {
Row: {
- executed_at: string | null;
- hash: string;
- id: number;
- name: string;
- };
+ executed_at: string | null
+ hash: string
+ id: number
+ name: string
+ }
Insert: {
- executed_at?: string | null;
- hash: string;
- id: number;
- name: string;
- };
+ executed_at?: string | null
+ hash: string
+ id: number
+ name: string
+ }
Update: {
- executed_at?: string | null;
- hash?: string;
- id?: number;
- name?: string;
- };
- Relationships: [];
- };
+ executed_at?: string | null
+ hash?: string
+ id?: number
+ name?: string
+ }
+ Relationships: []
+ }
objects: {
Row: {
- bucket_id: string | null;
- created_at: string | null;
- id: string;
- last_accessed_at: string | null;
- metadata: Json | null;
- name: string | null;
- owner: string | null;
- owner_id: string | null;
- path_tokens: string[] | null;
- updated_at: string | null;
- version: string | null;
- };
+ bucket_id: string | null
+ created_at: string | null
+ id: string
+ last_accessed_at: string | null
+ metadata: Json | null
+ name: string | null
+ owner: string | null
+ owner_id: string | null
+ path_tokens: string[] | null
+ updated_at: string | null
+ version: string | null
+ }
Insert: {
- bucket_id?: string | null;
- created_at?: string | null;
- id?: string;
- last_accessed_at?: string | null;
- metadata?: Json | null;
- name?: string | null;
- owner?: string | null;
- owner_id?: string | null;
- path_tokens?: string[] | null;
- updated_at?: string | null;
- version?: string | null;
- };
+ bucket_id?: string | null
+ created_at?: string | null
+ id?: string
+ last_accessed_at?: string | null
+ metadata?: Json | null
+ name?: string | null
+ owner?: string | null
+ owner_id?: string | null
+ path_tokens?: string[] | null
+ updated_at?: string | null
+ version?: string | null
+ }
Update: {
- bucket_id?: string | null;
- created_at?: string | null;
- id?: string;
- last_accessed_at?: string | null;
- metadata?: Json | null;
- name?: string | null;
- owner?: string | null;
- owner_id?: string | null;
- path_tokens?: string[] | null;
- updated_at?: string | null;
- version?: string | null;
- };
+ bucket_id?: string | null
+ created_at?: string | null
+ id?: string
+ last_accessed_at?: string | null
+ metadata?: Json | null
+ name?: string | null
+ owner?: string | null
+ owner_id?: string | null
+ path_tokens?: string[] | null
+ updated_at?: string | null
+ version?: string | null
+ }
Relationships: [
{
- foreignKeyName: 'objects_bucketId_fkey';
- columns: ['bucket_id'];
- isOneToOne: false;
- referencedRelation: 'buckets';
- referencedColumns: ['id'];
+ foreignKeyName: "objects_bucketId_fkey"
+ columns: ["bucket_id"]
+ isOneToOne: false
+ referencedRelation: "buckets"
+ referencedColumns: ["id"]
},
- ];
- };
- };
+ ]
+ }
+ s3_multipart_uploads: {
+ Row: {
+ bucket_id: string
+ created_at: string
+ id: string
+ in_progress_size: number
+ key: string
+ owner_id: string | null
+ upload_signature: string
+ version: string
+ }
+ Insert: {
+ bucket_id: string
+ created_at?: string
+ id: string
+ in_progress_size?: number
+ key: string
+ owner_id?: string | null
+ upload_signature: string
+ version: string
+ }
+ Update: {
+ bucket_id?: string
+ created_at?: string
+ id?: string
+ in_progress_size?: number
+ key?: string
+ owner_id?: string | null
+ upload_signature?: string
+ version?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "s3_multipart_uploads_bucket_id_fkey"
+ columns: ["bucket_id"]
+ isOneToOne: false
+ referencedRelation: "buckets"
+ referencedColumns: ["id"]
+ },
+ ]
+ }
+ s3_multipart_uploads_parts: {
+ Row: {
+ bucket_id: string
+ created_at: string
+ etag: string
+ id: string
+ key: string
+ owner_id: string | null
+ part_number: number
+ size: number
+ upload_id: string
+ version: string
+ }
+ Insert: {
+ bucket_id: string
+ created_at?: string
+ etag: string
+ id?: string
+ key: string
+ owner_id?: string | null
+ part_number: number
+ size?: number
+ upload_id: string
+ version: string
+ }
+ Update: {
+ bucket_id?: string
+ created_at?: string
+ etag?: string
+ id?: string
+ key?: string
+ owner_id?: string | null
+ part_number?: number
+ size?: number
+ upload_id?: string
+ version?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "s3_multipart_uploads_parts_bucket_id_fkey"
+ columns: ["bucket_id"]
+ isOneToOne: false
+ referencedRelation: "buckets"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "s3_multipart_uploads_parts_upload_id_fkey"
+ columns: ["upload_id"]
+ isOneToOne: false
+ referencedRelation: "s3_multipart_uploads"
+ referencedColumns: ["id"]
+ },
+ ]
+ }
+ }
Views: {
- [_ in never]: never;
- };
+ [_ in never]: never
+ }
Functions: {
can_insert_object: {
Args: {
- bucketid: string;
- name: string;
- owner: string;
- metadata: Json;
- };
- Returns: undefined;
- };
+ bucketid: string
+ name: string
+ owner: string
+ metadata: Json
+ }
+ Returns: undefined
+ }
extension: {
Args: {
- name: string;
- };
- Returns: string;
- };
+ name: string
+ }
+ Returns: string
+ }
filename: {
Args: {
- name: string;
- };
- Returns: string;
- };
+ name: string
+ }
+ Returns: string
+ }
foldername: {
Args: {
- name: string;
- };
- Returns: string[];
- };
+ name: string
+ }
+ Returns: string[]
+ }
get_size_by_bucket: {
- Args: Record;
+ Args: Record
Returns: {
- size: number;
- bucket_id: string;
- }[];
- };
+ size: number
+ bucket_id: string
+ }[]
+ }
+ list_multipart_uploads_with_delimiter: {
+ Args: {
+ bucket_id: string
+ prefix_param: string
+ delimiter_param: string
+ max_keys?: number
+ next_key_token?: string
+ next_upload_token?: string
+ }
+ Returns: {
+ key: string
+ id: string
+ created_at: string
+ }[]
+ }
+ list_objects_with_delimiter: {
+ Args: {
+ bucket_id: string
+ prefix_param: string
+ delimiter_param: string
+ max_keys?: number
+ start_after?: string
+ next_token?: string
+ }
+ Returns: {
+ name: string
+ id: string
+ metadata: Json
+ updated_at: string
+ }[]
+ }
search: {
Args: {
- prefix: string;
- bucketname: string;
- limits?: number;
- levels?: number;
- offsets?: number;
- search?: string;
- sortcolumn?: string;
- sortorder?: string;
- };
+ prefix: string
+ bucketname: string
+ limits?: number
+ levels?: number
+ offsets?: number
+ search?: string
+ sortcolumn?: string
+ sortorder?: string
+ }
Returns: {
- name: string;
- id: string;
- updated_at: string;
- created_at: string;
- last_accessed_at: string;
- metadata: Json;
- }[];
- };
- };
+ name: string
+ id: string
+ updated_at: string
+ created_at: string
+ last_accessed_at: string
+ metadata: Json
+ }[]
+ }
+ }
Enums: {
- [_ in never]: never;
- };
+ [_ in never]: never
+ }
CompositeTypes: {
- [_ in never]: never;
- };
- };
-};
+ [_ in never]: never
+ }
+ }
+}
-type PublicSchema = Database[Extract];
+type PublicSchema = Database[Extract]
export type Tables<
PublicTableNameOrOptions extends
- | keyof (PublicSchema['Tables'] & PublicSchema['Views'])
+ | keyof (PublicSchema["Tables"] & PublicSchema["Views"])
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
- ? keyof (Database[PublicTableNameOrOptions['schema']]['Tables'] &
- Database[PublicTableNameOrOptions['schema']]['Views'])
+ ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
+ Database[PublicTableNameOrOptions["schema"]]["Views"])
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
- ? (Database[PublicTableNameOrOptions['schema']]['Tables'] &
- Database[PublicTableNameOrOptions['schema']]['Views'])[TableName] extends {
- Row: infer R;
+ ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
+ Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
+ Row: infer R
}
? R
: never
- : PublicTableNameOrOptions extends keyof (PublicSchema['Tables'] &
- PublicSchema['Views'])
- ? (PublicSchema['Tables'] &
- PublicSchema['Views'])[PublicTableNameOrOptions] extends {
- Row: infer R;
+ : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] &
+ PublicSchema["Views"])
+ ? (PublicSchema["Tables"] &
+ PublicSchema["Views"])[PublicTableNameOrOptions] extends {
+ Row: infer R
}
? R
: never
- : never;
+ : never
export type TablesInsert<
PublicTableNameOrOptions extends
- | keyof PublicSchema['Tables']
+ | keyof PublicSchema["Tables"]
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
- ? keyof Database[PublicTableNameOrOptions['schema']]['Tables']
+ ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
- ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
- Insert: infer I;
+ ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
+ Insert: infer I
}
? I
: never
- : PublicTableNameOrOptions extends keyof PublicSchema['Tables']
- ? PublicSchema['Tables'][PublicTableNameOrOptions] extends {
- Insert: infer I;
+ : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
+ ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
+ Insert: infer I
}
? I
: never
- : never;
+ : never
export type TablesUpdate<
PublicTableNameOrOptions extends
- | keyof PublicSchema['Tables']
+ | keyof PublicSchema["Tables"]
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
- ? keyof Database[PublicTableNameOrOptions['schema']]['Tables']
+ ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
: never = never,
> = PublicTableNameOrOptions extends { schema: keyof Database }
- ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
- Update: infer U;
+ ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
+ Update: infer U
}
? U
: never
- : PublicTableNameOrOptions extends keyof PublicSchema['Tables']
- ? PublicSchema['Tables'][PublicTableNameOrOptions] extends {
- Update: infer U;
+ : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
+ ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
+ Update: infer U
}
? U
: never
- : never;
+ : never
export type Enums<
PublicEnumNameOrOptions extends
- | keyof PublicSchema['Enums']
+ | keyof PublicSchema["Enums"]
| { schema: keyof Database },
EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
- ? keyof Database[PublicEnumNameOrOptions['schema']]['Enums']
+ ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]
: never = never,
> = PublicEnumNameOrOptions extends { schema: keyof Database }
- ? Database[PublicEnumNameOrOptions['schema']]['Enums'][EnumName]
- : PublicEnumNameOrOptions extends keyof PublicSchema['Enums']
- ? PublicSchema['Enums'][PublicEnumNameOrOptions]
- : never;
+ ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
+ : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"]
+ ? PublicSchema["Enums"][PublicEnumNameOrOptions]
+ : never
+