diff --git a/api/src/database.types.ts b/api/src/database.types.ts index 42aee68..eeced73 100644 --- a/api/src/database.types.ts +++ b/api/src/database.types.ts @@ -432,20 +432,20 @@ export type Database = { } user_introductions: { Row: { + config: Json created_at: string | null - intro_email: string updated_at: string | null user_id: string } Insert: { + config?: Json created_at?: string | null - intro_email: string updated_at?: string | null user_id: string } Update: { + config?: Json created_at?: string | null - intro_email?: string updated_at?: string | null user_id?: string } diff --git a/api/src/tablo.ts b/api/src/tablo.ts index cc6f397..61faa86 100644 --- a/api/src/tablo.ts +++ b/api/src/tablo.ts @@ -394,16 +394,16 @@ tabloRouter.post("/invite", async (c) => { ); } - const { data: intro, error: introError } = await supabase + const { data: introConfigData, error: introError } = await supabase .from("user_introductions") - .select("intro_email") + .select("config") .eq("user_id", sender.id) .single(); if (introError) { return c.json({ error: introError.message }, 500); } - const introEmail = intro?.intro_email; + const introEmail = introConfigData?.config?.intro_email; const { error } = await supabase.from("tablo_invites").insert({ invited_email: recipientmail, @@ -428,7 +428,10 @@ tabloRouter.post("/invite", async (c) => { }/join/${encodeURIComponent(tablo.name)}?token=${encodeURIComponent( token )}">ce lien pour accepter l'invitation.

-

${introEmail}

`, +
+ ${introEmail ? `

${introEmail}

` : ""} +

Cordialement.

+ `, }); return c.json({ diff --git a/sql/24_replace_intro_email_by_json.sql b/sql/24_replace_intro_email_by_json.sql new file mode 100644 index 0000000..803f279 --- /dev/null +++ b/sql/24_replace_intro_email_by_json.sql @@ -0,0 +1,8 @@ +-- Replace intro_email column with config JSONB column +ALTER TABLE user_introductions DROP COLUMN intro_email; + +ALTER TABLE user_introductions ADD COLUMN config JSONB NOT NULL DEFAULT '{}'::jsonb; + +-- Update column comment +COMMENT ON COLUMN user_introductions.config IS 'User introduction configuration stored as JSON'; + diff --git a/ui/src/hooks/intros.ts b/ui/src/hooks/intros.ts index 7ca8d68..6c82d8c 100644 --- a/ui/src/hooks/intros.ts +++ b/ui/src/hooks/intros.ts @@ -6,22 +6,43 @@ import { queryClient } from "src/lib/api"; import { Tables } from "@ui/types/database.types"; import { useEffect, useState } from "react"; -export const useIntroduction = () => { +type IntroductionConfig = { + intro_email: string; +}; + +type Introduction = Tables<"user_introductions"> & { + config: IntroductionConfig; +}; + +export const useIntroduction = (): { + introduction: IntroductionConfig; + setDraftIntroduction: (cfg: IntroductionConfig) => void; + updateIntroduction: (cfg: IntroductionConfig) => void; + isPending: boolean; +} => { const { data, isPending } = useFetchIntroduction(); const { mutate: updateIntroduction, isPending: updateIntroductionPending } = useUpsertIntroduction(); const [draftIntroduction, setDraftIntroduction] = - useState | null>(data || null); + useState(null); useEffect(() => { - setDraftIntroduction(data || null); + if (data) { + setDraftIntroduction(data.config as IntroductionConfig); + } else { + setDraftIntroduction({ + intro_email: "", + }); + } }, [data]); - return { - introduction: draftIntroduction, + introduction: draftIntroduction ?? { + intro_email: "", + }, setDraftIntroduction, - updateIntroduction, + updateIntroduction: (cfg: IntroductionConfig) => + updateIntroduction({ introEmail: cfg.intro_email }), isPending: updateIntroductionPending || isPending, }; }; @@ -32,7 +53,7 @@ export const useIntroduction = () => { export function useFetchIntroduction() { const user = useUser(); - const { data, isPending } = useQuery>({ + const { data, isPending } = useQuery({ queryKey: ["introduction", user.id] as QueryKey, queryFn: async () => { const { data, error } = await supabase @@ -65,7 +86,7 @@ export function useUpsertIntroduction() { const { error } = await supabase.from("user_introductions").upsert( { user_id: user.id, - intro_email: introEmail, + config: { intro_email: introEmail }, }, { onConflict: "user_id", diff --git a/ui/src/pages/settings.tsx b/ui/src/pages/settings.tsx index bde29d1..9e788ca 100644 --- a/ui/src/pages/settings.tsx +++ b/ui/src/pages/settings.tsx @@ -94,9 +94,7 @@ export default function SettingsPage() { id="introductionEmail" value={introduction?.intro_email || ""} onChange={(e) => - setDraftIntroduction((prev) => - prev ? { ...prev, intro_email: e.target.value } : null - ) + setDraftIntroduction({ ...introduction, intro_email: e.target.value }) } placeholder="Bonjour, Je vous invite à rejoindre mon espace de travail sur XTablo... Cordialement" rows={8} @@ -110,9 +108,7 @@ export default function SettingsPage() {
diff --git a/ui/src/types/database.types.ts b/ui/src/types/database.types.ts index 6fd2969..eeced73 100644 --- a/ui/src/types/database.types.ts +++ b/ui/src/types/database.types.ts @@ -4,635 +4,629 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[]; + | Json[] export type Database = { // Allows to automatically instantiate createClient with right options // instead of createClient(URL, KEY) __InternalSupabase: { - PostgrestVersion: "13.0.4"; - }; + PostgrestVersion: "13.0.4" + } public: { Tables: { availabilities: { Row: { - availability_data: Json; - created_at: string; - exceptions: Json | null; - id: number; - updated_at: string; - user_id: string; - }; + availability_data: Json + created_at: string + exceptions: Json | null + id: number + updated_at: string + user_id: string + } Insert: { - availability_data?: Json; - created_at?: string; - exceptions?: Json | null; - id?: number; - updated_at?: string; - user_id: string; - }; + availability_data?: Json + created_at?: string + exceptions?: Json | null + id?: number + updated_at?: string + user_id: string + } Update: { - availability_data?: Json; - created_at?: string; - exceptions?: Json | null; - id?: number; - updated_at?: string; - user_id?: string; - }; - Relationships: []; - }; + availability_data?: Json + created_at?: string + exceptions?: Json | null + id?: number + updated_at?: string + user_id?: string + } + Relationships: [] + } calendar_subscriptions: { Row: { - created_at: string | null; - id: string; - tablo_id: string; - token: string; - }; + created_at: string | null + id: string + tablo_id: string + token: string + } Insert: { - created_at?: string | null; - id?: string; - tablo_id: string; - token: string; - }; + created_at?: string | null + id?: string + tablo_id: string + token: string + } Update: { - created_at?: string | null; - id?: string; - tablo_id?: string; - token?: string; - }; + created_at?: string | null + id?: string + tablo_id?: string + token?: string + } Relationships: [ { - foreignKeyName: "calendar_subscriptions_tablo_id_fkey"; - columns: ["tablo_id"]; - isOneToOne: true; - referencedRelation: "events_and_tablos"; - referencedColumns: ["tablo_id"]; + foreignKeyName: "calendar_subscriptions_tablo_id_fkey" + columns: ["tablo_id"] + isOneToOne: true + referencedRelation: "events_and_tablos" + referencedColumns: ["tablo_id"] }, { - foreignKeyName: "calendar_subscriptions_tablo_id_fkey"; - columns: ["tablo_id"]; - isOneToOne: true; - referencedRelation: "tablos"; - referencedColumns: ["id"]; + foreignKeyName: "calendar_subscriptions_tablo_id_fkey" + columns: ["tablo_id"] + isOneToOne: true + referencedRelation: "tablos" + referencedColumns: ["id"] }, { - foreignKeyName: "calendar_subscriptions_tablo_id_fkey"; - columns: ["tablo_id"]; - isOneToOne: true; - referencedRelation: "user_tablos"; - referencedColumns: ["id"]; - } - ]; - }; + foreignKeyName: "calendar_subscriptions_tablo_id_fkey" + columns: ["tablo_id"] + isOneToOne: true + referencedRelation: "user_tablos" + referencedColumns: ["id"] + }, + ] + } devis: { Row: { - client_email: string; - created_at: string; - date: string; - due_date: string; - id: string; - items: Json; - notes: string | null; - number: string; - status: Database["public"]["Enums"]["devis_status"]; - subtotal: number; - tax: number; - terms: string | null; - total: number; - updated_at: string; - user_id: string; - }; + client_email: string + created_at: string + date: string + due_date: string + id: string + items: Json + notes: string | null + number: string + status: Database["public"]["Enums"]["devis_status"] + subtotal: number + tax: number + terms: string | null + total: number + updated_at: string + user_id: string + } Insert: { - client_email: string; - created_at?: string; - date: string; - due_date: string; - id?: string; - items?: Json; - notes?: string | null; - number: string; - status?: Database["public"]["Enums"]["devis_status"]; - subtotal: number; - tax: number; - terms?: string | null; - total: number; - updated_at?: string; - user_id: string; - }; + client_email: string + created_at?: string + date: string + due_date: string + id?: string + items?: Json + notes?: string | null + number: string + status?: Database["public"]["Enums"]["devis_status"] + subtotal: number + tax: number + terms?: string | null + total: number + updated_at?: string + user_id: string + } Update: { - client_email?: string; - created_at?: string; - date?: string; - due_date?: string; - id?: string; - items?: Json; - notes?: string | null; - number?: string; - status?: Database["public"]["Enums"]["devis_status"]; - subtotal?: number; - tax?: number; - terms?: string | null; - total?: number; - updated_at?: string; - user_id?: string; - }; - Relationships: []; - }; + client_email?: string + created_at?: string + date?: string + due_date?: string + id?: string + items?: Json + notes?: string | null + number?: string + status?: Database["public"]["Enums"]["devis_status"] + subtotal?: number + tax?: number + terms?: string | null + total?: number + updated_at?: string + user_id?: string + } + Relationships: [] + } event_types: { Row: { - config: Json; - created_at: string | null; - deleted_at: string | null; - id: string; - is_active: boolean; - standard_name: string | null; - updated_at: string | null; - user_id: string; - }; + config: Json + created_at: string | null + deleted_at: string | null + id: string + is_active: boolean + standard_name: string | null + updated_at: string | null + user_id: string + } Insert: { - config?: Json; - created_at?: string | null; - deleted_at?: string | null; - id?: string; - is_active?: boolean; - standard_name?: string | null; - updated_at?: string | null; - user_id: string; - }; + config?: Json + created_at?: string | null + deleted_at?: string | null + id?: string + is_active?: boolean + standard_name?: string | null + updated_at?: string | null + user_id: string + } Update: { - config?: Json; - created_at?: string | null; - deleted_at?: string | null; - id?: string; - is_active?: boolean; - standard_name?: string | null; - updated_at?: string | null; - user_id?: string; - }; - Relationships: []; - }; + config?: Json + created_at?: string | null + deleted_at?: string | null + id?: string + is_active?: boolean + standard_name?: string | null + updated_at?: string | null + user_id?: string + } + Relationships: [] + } events: { Row: { - created_at: string | null; - created_by: string; - deleted_at: string | null; - description: string | null; - end_time: string | null; - id: string; - start_date: string; - start_time: string; - tablo_id: string; - title: string; - }; + created_at: string | null + created_by: string + deleted_at: string | null + description: string | null + end_time: string | null + id: string + start_date: string + start_time: string + tablo_id: string + title: string + } Insert: { - created_at?: string | null; - created_by: string; - deleted_at?: string | null; - description?: string | null; - end_time?: string | null; - id?: string; - start_date: string; - start_time: string; - tablo_id: string; - title: string; - }; + created_at?: string | null + created_by: string + deleted_at?: string | null + description?: string | null + end_time?: string | null + id?: string + start_date: string + start_time: string + tablo_id: string + title: string + } Update: { - created_at?: string | null; - created_by?: string; - deleted_at?: string | null; - description?: string | null; - end_time?: string | null; - id?: string; - start_date?: string; - start_time?: string; - tablo_id?: string; - title?: string; - }; + created_at?: string | null + created_by?: string + deleted_at?: string | null + description?: string | null + end_time?: string | null + id?: string + start_date?: string + start_time?: string + tablo_id?: string + title?: string + } Relationships: [ { - foreignKeyName: "fk_events_tablo_id"; - columns: ["tablo_id"]; - isOneToOne: false; - referencedRelation: "events_and_tablos"; - referencedColumns: ["tablo_id"]; + foreignKeyName: "fk_events_tablo_id" + columns: ["tablo_id"] + isOneToOne: false + referencedRelation: "events_and_tablos" + referencedColumns: ["tablo_id"] }, { - foreignKeyName: "fk_events_tablo_id"; - columns: ["tablo_id"]; - isOneToOne: false; - referencedRelation: "tablos"; - referencedColumns: ["id"]; + foreignKeyName: "fk_events_tablo_id" + columns: ["tablo_id"] + isOneToOne: false + referencedRelation: "tablos" + referencedColumns: ["id"] }, { - foreignKeyName: "fk_events_tablo_id"; - columns: ["tablo_id"]; - isOneToOne: false; - referencedRelation: "user_tablos"; - referencedColumns: ["id"]; - } - ]; - }; + foreignKeyName: "fk_events_tablo_id" + columns: ["tablo_id"] + isOneToOne: false + referencedRelation: "user_tablos" + referencedColumns: ["id"] + }, + ] + } feedbacks: { Row: { - created_at: string | null; - fd_type: string; - id: number; - message: string; - user_id: string; - }; + created_at: string | null + fd_type: string + id: number + message: string + user_id: string + } Insert: { - created_at?: string | null; - fd_type: string; - id?: number; - message: string; - user_id: string; - }; + created_at?: string | null + fd_type: string + id?: number + message: string + user_id: string + } Update: { - created_at?: string | null; - fd_type?: string; - id?: number; - message?: string; - user_id?: string; - }; - Relationships: []; - }; + created_at?: string | null + fd_type?: string + id?: number + message?: string + user_id?: string + } + Relationships: [] + } profiles: { Row: { - avatar_url: string | null; - email: string | null; - first_name: string | null; - id: string; - is_temporary: boolean; - last_name: string | null; - /** @deprecated Use first_name and last_name instead */ - name: string | null; - short_user_id: string; - }; + avatar_url: string | null + email: string | null + first_name: string | null + id: string + is_temporary: boolean + last_name: string | null + name: string | null + short_user_id: string + } Insert: { - avatar_url?: string | null; - email?: string | null; - first_name?: string | null; - id: string; - is_temporary?: boolean; - last_name?: string | null; - /** @deprecated Use first_name and last_name instead */ - name?: string | null; - short_user_id: string; - }; + avatar_url?: string | null + email?: string | null + first_name?: string | null + id: string + is_temporary?: boolean + last_name?: string | null + name?: string | null + short_user_id: string + } Update: { - avatar_url?: string | null; - email?: string | null; - first_name?: string | null; - id?: string; - is_temporary?: boolean; - last_name?: string | null; - /** @deprecated Use first_name and last_name instead */ - name?: string | null; - short_user_id?: string; - }; - Relationships: []; - }; + avatar_url?: string | null + email?: string | null + first_name?: string | null + id?: string + is_temporary?: boolean + last_name?: string | null + name?: string | null + short_user_id?: string + } + Relationships: [] + } tablo_access: { Row: { - created_at: string | null; - granted_by: string; - id: number; - is_active: boolean | null; - is_admin: boolean | null; - tablo_id: string; - user_id: string; - }; + created_at: string | null + granted_by: string + id: number + is_active: boolean | null + is_admin: boolean | null + tablo_id: string + user_id: string + } Insert: { - created_at?: string | null; - granted_by: string; - id?: number; - is_active?: boolean | null; - is_admin?: boolean | null; - tablo_id: string; - user_id: string; - }; + created_at?: string | null + granted_by: string + id?: number + is_active?: boolean | null + is_admin?: boolean | null + tablo_id: string + user_id: string + } Update: { - created_at?: string | null; - granted_by?: string; - id?: number; - is_active?: boolean | null; - is_admin?: boolean | null; - tablo_id?: string; - user_id?: string; - }; + created_at?: string | null + granted_by?: string + id?: number + is_active?: boolean | null + is_admin?: boolean | null + tablo_id?: string + user_id?: string + } Relationships: [ { - foreignKeyName: "fk_tablo_access_tablo_id"; - columns: ["tablo_id"]; - isOneToOne: false; - referencedRelation: "events_and_tablos"; - referencedColumns: ["tablo_id"]; + foreignKeyName: "fk_tablo_access_tablo_id" + columns: ["tablo_id"] + isOneToOne: false + referencedRelation: "events_and_tablos" + referencedColumns: ["tablo_id"] }, { - foreignKeyName: "fk_tablo_access_tablo_id"; - columns: ["tablo_id"]; - isOneToOne: false; - referencedRelation: "tablos"; - referencedColumns: ["id"]; + foreignKeyName: "fk_tablo_access_tablo_id" + columns: ["tablo_id"] + isOneToOne: false + referencedRelation: "tablos" + referencedColumns: ["id"] }, { - foreignKeyName: "fk_tablo_access_tablo_id"; - columns: ["tablo_id"]; - isOneToOne: false; - referencedRelation: "user_tablos"; - referencedColumns: ["id"]; + foreignKeyName: "fk_tablo_access_tablo_id" + columns: ["tablo_id"] + isOneToOne: false + referencedRelation: "user_tablos" + referencedColumns: ["id"] }, { - foreignKeyName: "fk_tablo_access_user_id_from_profiles"; - columns: ["user_id"]; - isOneToOne: false; - referencedRelation: "profiles"; - referencedColumns: ["id"]; - } - ]; - }; + foreignKeyName: "fk_tablo_access_user_id_from_profiles" + columns: ["user_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + ] + } tablo_invites: { Row: { - id: number; - invite_token: string; - invited_by: string; - invited_email: string; - tablo_id: string; - }; + id: number + invite_token: string + invited_by: string + invited_email: string + tablo_id: string + } Insert: { - id?: number; - invite_token: string; - invited_by: string; - invited_email: string; - tablo_id: string; - }; + id?: number + invite_token: string + invited_by: string + invited_email: string + tablo_id: string + } Update: { - id?: number; - invite_token?: string; - invited_by?: string; - invited_email?: string; - tablo_id?: string; - }; + id?: number + invite_token?: string + invited_by?: string + invited_email?: string + tablo_id?: string + } Relationships: [ { - foreignKeyName: "fk_tablo_invitations_tablo_id"; - columns: ["tablo_id"]; - isOneToOne: false; - referencedRelation: "events_and_tablos"; - referencedColumns: ["tablo_id"]; + foreignKeyName: "fk_tablo_invitations_tablo_id" + columns: ["tablo_id"] + isOneToOne: false + referencedRelation: "events_and_tablos" + referencedColumns: ["tablo_id"] }, { - foreignKeyName: "fk_tablo_invitations_tablo_id"; - columns: ["tablo_id"]; - isOneToOne: false; - referencedRelation: "tablos"; - referencedColumns: ["id"]; + foreignKeyName: "fk_tablo_invitations_tablo_id" + columns: ["tablo_id"] + isOneToOne: false + referencedRelation: "tablos" + referencedColumns: ["id"] }, { - foreignKeyName: "fk_tablo_invitations_tablo_id"; - columns: ["tablo_id"]; - isOneToOne: false; - referencedRelation: "user_tablos"; - referencedColumns: ["id"]; - } - ]; - }; + foreignKeyName: "fk_tablo_invitations_tablo_id" + columns: ["tablo_id"] + isOneToOne: false + referencedRelation: "user_tablos" + referencedColumns: ["id"] + }, + ] + } tablos: { Row: { - color: string | null; - created_at: string | null; - deleted_at: string | null; - id: string; - image: string | null; - name: string; - owner_id: string; - position: number; - status: string; - }; + color: string | null + created_at: string | null + deleted_at: string | null + id: string + image: string | null + name: string + owner_id: string + position: number + status: string + } Insert: { - color?: string | null; - created_at?: string | null; - deleted_at?: string | null; - id?: string; - image?: string | null; - name: string; - owner_id: string; - position?: number; - status?: string; - }; + color?: string | null + created_at?: string | null + deleted_at?: string | null + id?: string + image?: string | null + name: string + owner_id: string + position?: number + status?: string + } Update: { - color?: string | null; - created_at?: string | null; - deleted_at?: string | null; - id?: string; - image?: string | null; - name?: string; - owner_id?: string; - position?: number; - status?: string; - }; - Relationships: []; - }; + color?: string | null + created_at?: string | null + deleted_at?: string | null + id?: string + image?: string | null + name?: string + owner_id?: string + position?: number + status?: string + } + Relationships: [] + } user_introductions: { Row: { - created_at: string | null; - intro_email: string; - updated_at: string | null; - user_id: string; - }; + config: Json + created_at: string | null + updated_at: string | null + user_id: string + } Insert: { - created_at?: string | null; - intro_email: string; - updated_at?: string | null; - user_id: string; - }; + config?: Json + created_at?: string | null + updated_at?: string | null + user_id: string + } Update: { - created_at?: string | null; - intro_email?: string; - updated_at?: string | null; - user_id?: string; - }; - Relationships: []; - }; - }; + config?: Json + created_at?: string | null + updated_at?: string | null + user_id?: string + } + Relationships: [] + } + } Views: { events_and_tablos: { Row: { - description: string | null; - end_time: string | null; - event_id: string | null; - start_date: string | null; - start_time: string | null; - tablo_color: string | null; - tablo_id: string | null; - tablo_name: string | null; - tablo_status: string | null; - title: string | null; - }; - Relationships: []; - }; + description: string | null + end_time: string | null + event_id: string | null + start_date: string | null + start_time: string | null + tablo_color: string | null + tablo_id: string | null + tablo_name: string | null + tablo_status: string | null + title: string | null + } + Relationships: [] + } user_tablos: { Row: { - access_level: string | null; - color: string | null; - created_at: string | null; - deleted_at: string | null; - id: string | null; - image: string | null; - is_admin: boolean | null; - name: string | null; - position: number | null; - status: string | null; - user_id: string | null; - }; + access_level: string | null + color: string | null + created_at: string | null + deleted_at: string | null + id: string | null + image: string | null + is_admin: boolean | null + name: string | null + position: number | null + status: string | null + user_id: string | null + } Relationships: [ { - foreignKeyName: "fk_tablo_access_user_id_from_profiles"; - columns: ["user_id"]; - isOneToOne: false; - referencedRelation: "profiles"; - referencedColumns: ["id"]; - } - ]; - }; - }; + foreignKeyName: "fk_tablo_access_user_id_from_profiles" + columns: ["user_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + ] + } + } Functions: { generate_random_string: { - Args: { length?: number }; - Returns: string; - }; - }; + Args: { length?: number } + Returns: string + } + } Enums: { - devis_status: "draft" | "sent" | "accepted" | "rejected" | "expired"; - }; + devis_status: "draft" | "sent" | "accepted" | "rejected" | "expired" + } CompositeTypes: { time_range: { - start_time: string | null; - end_time: string | null; - }; - }; - }; -}; + start_time: string | null + end_time: string | null + } + } + } +} -type DatabaseWithoutInternals = Omit; +type DatabaseWithoutInternals = Omit -type DefaultSchema = DatabaseWithoutInternals[Extract< - keyof Database, - "public" ->]; +type DefaultSchema = DatabaseWithoutInternals[Extract] export type Tables< DefaultSchemaTableNameOrOptions extends | keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { - schema: keyof DatabaseWithoutInternals; + schema: keyof DatabaseWithoutInternals } ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"]) - : never = never + : never = never, > = DefaultSchemaTableNameOrOptions extends { - schema: keyof DatabaseWithoutInternals; + schema: keyof DatabaseWithoutInternals } ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends { - Row: infer R; + Row: infer R } ? R : never : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & - DefaultSchema["Views"]) - ? (DefaultSchema["Tables"] & - DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends { - Row: infer R; - } - ? R + DefaultSchema["Views"]) + ? (DefaultSchema["Tables"] & + DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends { + Row: infer R + } + ? R + : never : never - : never; export type TablesInsert< DefaultSchemaTableNameOrOptions extends | keyof DefaultSchema["Tables"] | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { - schema: keyof DatabaseWithoutInternals; + schema: keyof DatabaseWithoutInternals } ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] - : never = never + : never = never, > = DefaultSchemaTableNameOrOptions extends { - schema: keyof DatabaseWithoutInternals; + schema: keyof DatabaseWithoutInternals } ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { - Insert: infer I; + Insert: infer I } ? I : never : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] - ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { - Insert: infer I; - } - ? I + ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { + Insert: infer I + } + ? I + : never : never - : never; export type TablesUpdate< DefaultSchemaTableNameOrOptions extends | keyof DefaultSchema["Tables"] | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { - schema: keyof DatabaseWithoutInternals; + schema: keyof DatabaseWithoutInternals } ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] - : never = never + : never = never, > = DefaultSchemaTableNameOrOptions extends { - schema: keyof DatabaseWithoutInternals; + schema: keyof DatabaseWithoutInternals } ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { - Update: infer U; + Update: infer U } ? U : never : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] - ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { - Update: infer U; - } - ? U + ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { + Update: infer U + } + ? U + : never : never - : never; export type Enums< DefaultSchemaEnumNameOrOptions extends | keyof DefaultSchema["Enums"] | { schema: keyof DatabaseWithoutInternals }, EnumName extends DefaultSchemaEnumNameOrOptions extends { - schema: keyof DatabaseWithoutInternals; + schema: keyof DatabaseWithoutInternals } ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"] - : never = never + : never = never, > = DefaultSchemaEnumNameOrOptions extends { - schema: keyof DatabaseWithoutInternals; + schema: keyof DatabaseWithoutInternals } ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName] : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] - ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions] - : never; + ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions] + : never export type CompositeTypes< PublicCompositeTypeNameOrOptions extends | keyof DefaultSchema["CompositeTypes"] | { schema: keyof DatabaseWithoutInternals }, CompositeTypeName extends PublicCompositeTypeNameOrOptions extends { - schema: keyof DatabaseWithoutInternals; + schema: keyof DatabaseWithoutInternals } ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] - : never = never + : never = never, > = PublicCompositeTypeNameOrOptions extends { - schema: keyof DatabaseWithoutInternals; + schema: keyof DatabaseWithoutInternals } ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] - ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] - : never; + ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] + : never export const Constants = { public: { @@ -640,4 +634,4 @@ export const Constants = { devis_status: ["draft", "sent", "accepted", "rejected", "expired"], }, }, -} as const; +} as const diff --git a/xtablo-expo/lib/database.types.ts b/xtablo-expo/lib/database.types.ts index 42aee68..eeced73 100644 --- a/xtablo-expo/lib/database.types.ts +++ b/xtablo-expo/lib/database.types.ts @@ -432,20 +432,20 @@ export type Database = { } user_introductions: { Row: { + config: Json created_at: string | null - intro_email: string updated_at: string | null user_id: string } Insert: { + config?: Json created_at?: string | null - intro_email: string updated_at?: string | null user_id: string } Update: { + config?: Json created_at?: string | null - intro_email?: string updated_at?: string | null user_id?: string }