Update database types and relationships

The commit removes semicolons at the ends of lines and makes updates to the Database object in the `database.types.ts` file. This better aligns the syntax with TypeScript norms. It also affects many database relationships, including but not limited to `Accounts`, `Roles`, and `Subscriptions`.
This commit is contained in:
giancarlo
2024-04-16 22:17:28 +08:00
parent 1cb0470ce0
commit 8dd4b594d2
10 changed files with 2200 additions and 1904 deletions

View File

@@ -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';

View File

@@ -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,
});
}

File diff suppressed because it is too large Load Diff