diff --git a/src/supabase/exhibits/queries.tsx b/src/supabase/exhibits/queries.tsx index cb726955..a72d9566 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -8,7 +8,7 @@ import { ExhibitRow } from '../../types/types'; * @returns A promise that resolves to an array of ExhibitRow objects. */ export async function fetchAllExhibits() { - const { data, error } = await supabase.rpc('get_exhibits'); + const { data, error } = await supabase.rpc('get_exhibit_details'); if (error) { throw new Error(error.message); } diff --git a/src/types/supabase.ts b/src/types/supabase.ts index dc4795ad..d2ed141d 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,521 +4,521 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[]; + | Json[] export type Database = { public: { Tables: { categories: { Row: { - category: string | null; - color_hex: string; - created_at: string; - description: string; - id: number; - image: string; - }; + category: string | null + color_hex: string + created_at: string + description: string + id: number + image: string + } Insert: { - category?: string | null; - color_hex: string; - created_at?: string; - description: string; - id?: number; - image: string; - }; + category?: string | null + color_hex: string + created_at?: string + description: string + id?: number + image: string + } Update: { - category?: string | null; - color_hex?: string; - created_at?: string; - description?: string; - id?: number; - image?: string; - }; - Relationships: []; - }; + category?: string | null + color_hex?: string + created_at?: string + description?: string + id?: number + image?: string + } + Relationships: [] + } display_media: { Row: { - display_id: string; - media_id: string; - media_placement: string | null; - }; + display_id: string + media_id: string + media_placement: string | null + } Insert: { - display_id: string; - media_id: string; - media_placement?: string | null; - }; + display_id: string + media_id: string + media_placement?: string | null + } Update: { - display_id?: string; - media_id?: string; - media_placement?: string | null; - }; + display_id?: string + media_id?: string + media_placement?: string | null + } Relationships: [ { - foreignKeyName: 'display_media_display_id_fkey'; - columns: ['display_id']; - isOneToOne: false; - referencedRelation: 'displays'; - referencedColumns: ['id']; + foreignKeyName: "display_media_display_id_fkey" + columns: ["display_id"] + isOneToOne: false + referencedRelation: "displays" + referencedColumns: ["id"] }, { - foreignKeyName: 'display_media_media_id_fkey'; - columns: ['media_id']; - isOneToOne: false; - referencedRelation: 'media'; - referencedColumns: ['id']; + foreignKeyName: "display_media_media_id_fkey" + columns: ["media_id"] + isOneToOne: false + referencedRelation: "media" + referencedColumns: ["id"] }, - ]; - }; + ] + } displays: { Row: { - coordinates: Json | null; - created_at: string; - description: string; - id: string; - title: string; - updated_at: string | null; - }; + coordinates: Json | null + created_at: string + description: string + id: string + title: string + updated_at: string | null + } Insert: { - coordinates?: Json | null; - created_at?: string; - description?: string; - id?: string; - title?: string; - updated_at?: string | null; - }; + coordinates?: Json | null + created_at?: string + description?: string + id?: string + title?: string + updated_at?: string | null + } Update: { - coordinates?: Json | null; - created_at?: string; - description?: string; - id?: string; - title?: string; - updated_at?: string | null; - }; - Relationships: []; - }; + coordinates?: Json | null + created_at?: string + description?: string + id?: string + title?: string + updated_at?: string | null + } + Relationships: [] + } emails: { Row: { - emails: string | null; - id: number; - }; + emails: string | null + id: number + } Insert: { - emails?: string | null; - id?: number; - }; + emails?: string | null + id?: number + } Update: { - emails?: string | null; - id?: number; - }; - Relationships: []; - }; + emails?: string | null + id?: number + } + Relationships: [] + } exhibits: { Row: { - category_id: number; - coordinates: Json | null; - id: string; - title: string; - }; + category_id: number + coordinates: Json | null + id: string + title: string + } Insert: { - category_id: number; - coordinates?: Json | null; - id?: string; - title: string; - }; + category_id: number + coordinates?: Json | null + id?: string + title: string + } Update: { - category_id?: number; - coordinates?: Json | null; - id?: string; - title?: string; - }; + category_id?: number + coordinates?: Json | null + id?: string + title?: string + } Relationships: [ { - foreignKeyName: 'public_exhibits_category_id_fkey'; - columns: ['category_id']; - isOneToOne: false; - referencedRelation: 'categories'; - referencedColumns: ['id']; + foreignKeyName: "public_exhibits_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] }, - ]; - }; + ] + } media: { Row: { - created_at: string; - id: string; - text: string | null; - title: string | null; - type: string | null; - url: string; - }; + created_at: string + id: string + text: string | null + title: string | null + type: string | null + url: string + } Insert: { - created_at?: string; - id?: string; - text?: string | null; - title?: string | null; - type?: string | null; - url?: string; - }; + created_at?: string + id?: string + text?: string | null + title?: string | null + type?: string | null + url?: string + } Update: { - created_at?: string; - id?: string; - text?: string | null; - title?: string | null; - type?: string | null; - url?: string; - }; - Relationships: []; - }; + created_at?: string + id?: string + text?: string | null + title?: string | null + type?: string | null + url?: string + } + Relationships: [] + } news: { Row: { - content_link: string; - created_at: string; - id: string; - title: string; - updated_at: string | null; - }; + content_link: string + created_at: string + id: string + title: string + updated_at: string | null + } Insert: { - content_link: string; - created_at?: string; - id?: string; - title: string; - updated_at?: string | null; - }; + content_link: string + created_at?: string + id?: string + title: string + updated_at?: string | null + } Update: { - content_link?: string; - created_at?: string; - id?: string; - title?: string; - updated_at?: string | null; - }; - Relationships: []; - }; + content_link?: string + created_at?: string + id?: string + title?: string + updated_at?: string | null + } + Relationships: [] + } spotlight_recommendations: { Row: { - source_display_id: string; - target_display_id: string; - }; + source_display_id: string + target_display_id: string + } Insert: { - source_display_id: string; - target_display_id: string; - }; + source_display_id: string + target_display_id: string + } Update: { - source_display_id?: string; - target_display_id?: string; - }; + source_display_id?: string + target_display_id?: string + } Relationships: [ { - foreignKeyName: 'spotlight_recommendations_source_display_id_fkey'; - columns: ['source_display_id']; - isOneToOne: false; - referencedRelation: 'tours'; - referencedColumns: ['id']; + foreignKeyName: "spotlight_recommendations_source_display_id_fkey" + columns: ["source_display_id"] + isOneToOne: false + referencedRelation: "tours" + referencedColumns: ["id"] }, { - foreignKeyName: 'spotlight_recommendations_target_display_id_fkey'; - columns: ['target_display_id']; - isOneToOne: false; - referencedRelation: 'tours'; - referencedColumns: ['id']; + foreignKeyName: "spotlight_recommendations_target_display_id_fkey" + columns: ["target_display_id"] + isOneToOne: false + referencedRelation: "tours" + referencedColumns: ["id"] }, - ]; - }; + ] + } tour_displays: { Row: { - display_id: string; - display_order: number | null; - tour_id: string; - }; + display_id: string + display_order: number | null + tour_id: string + } Insert: { - display_id: string; - display_order?: number | null; - tour_id: string; - }; + display_id: string + display_order?: number | null + tour_id: string + } Update: { - display_id?: string; - display_order?: number | null; - tour_id?: string; - }; + display_id?: string + display_order?: number | null + tour_id?: string + } Relationships: [ { - foreignKeyName: 'tour_displays_display_id_fkey'; - columns: ['display_id']; - isOneToOne: false; - referencedRelation: 'displays'; - referencedColumns: ['id']; + foreignKeyName: "tour_displays_display_id_fkey" + columns: ["display_id"] + isOneToOne: false + referencedRelation: "displays" + referencedColumns: ["id"] }, { - foreignKeyName: 'tour_displays_tour_id_fkey'; - columns: ['tour_id']; - isOneToOne: false; - referencedRelation: 'tours'; - referencedColumns: ['id']; + foreignKeyName: "tour_displays_tour_id_fkey" + columns: ["tour_id"] + isOneToOne: false + referencedRelation: "tours" + referencedColumns: ["id"] }, - ]; - }; + ] + } tour_media: { Row: { - media_id: string; - tour_id: string; - }; + media_id: string + tour_id: string + } Insert: { - media_id: string; - tour_id: string; - }; + media_id: string + tour_id: string + } Update: { - media_id?: string; - tour_id?: string; - }; + media_id?: string + tour_id?: string + } Relationships: [ { - foreignKeyName: 'tour_media_media_id_fkey'; - columns: ['media_id']; - isOneToOne: false; - referencedRelation: 'media'; - referencedColumns: ['id']; + foreignKeyName: "tour_media_media_id_fkey" + columns: ["media_id"] + isOneToOne: false + referencedRelation: "media" + referencedColumns: ["id"] }, { - foreignKeyName: 'tour_media_tour_id_fkey'; - columns: ['tour_id']; - isOneToOne: false; - referencedRelation: 'tours'; - referencedColumns: ['id']; + foreignKeyName: "tour_media_tour_id_fkey" + columns: ["tour_id"] + isOneToOne: false + referencedRelation: "tours" + referencedColumns: ["id"] }, - ]; - }; + ] + } tours: { Row: { - category: Database['public']['Enums']['tour_category']; - coordinates: Json | null; - created_at: string; - description: string | null; - id: string; - name: string; - preview_text: string | null; - spotlight: boolean; - stop_count: number | null; - }; + category: Database["public"]["Enums"]["tour_category"] + coordinates: Json | null + created_at: string + description: string | null + id: string + name: string + preview_text: string | null + spotlight: boolean + stop_count: number | null + } Insert: { - category?: Database['public']['Enums']['tour_category']; - coordinates?: Json | null; - created_at?: string; - description?: string | null; - id?: string; - name: string; - preview_text?: string | null; - spotlight?: boolean; - stop_count?: number | null; - }; + category?: Database["public"]["Enums"]["tour_category"] + coordinates?: Json | null + created_at?: string + description?: string | null + id?: string + name: string + preview_text?: string | null + spotlight?: boolean + stop_count?: number | null + } Update: { - category?: Database['public']['Enums']['tour_category']; - coordinates?: Json | null; - created_at?: string; - description?: string | null; - id?: string; - name?: string; - preview_text?: string | null; - spotlight?: boolean; - stop_count?: number | null; - }; - Relationships: []; - }; - }; + category?: Database["public"]["Enums"]["tour_category"] + coordinates?: Json | null + created_at?: string + description?: string | null + id?: string + name?: string + preview_text?: string | null + spotlight?: boolean + stop_count?: number | null + } + Relationships: [] + } + } Views: { - [_ in never]: never; - }; + [_ in never]: never + } Functions: { fetch_recommended_spotlights: { Args: { - source_spotlight_id: string; - }; + source_spotlight_id: string + } Returns: { - id: string; - name: string; - description: string; - created_at: string; - stop_count: number; - spotlight: boolean; - preview_text: string; - coordinates: Json; - category: Database['public']['Enums']['tour_category']; - }[]; - }; + id: string + name: string + description: string + created_at: string + stop_count: number + spotlight: boolean + preview_text: string + coordinates: Json + category: Database["public"]["Enums"]["tour_category"] + }[] + } fetchimagesfordisplay: { Args: { - displayid: string; - }; + displayid: string + } Returns: { - id: string; - url: string; - type: string; - title: string; - text: string; - created_at: string; - }[]; - }; + id: string + url: string + type: string + title: string + text: string + created_at: string + }[] + } fetchimagesfortour: { Args: { - tourid: string; - }; + tourid: string + } Returns: { - id: string; - url: string; - type: string; - title: string; - text: string; - created_at: string; - }[]; - }; + id: string + url: string + type: string + title: string + text: string + created_at: string + }[] + } get_category_color: { Args: { - category_in: string; - }; - Returns: string; - }; - get_exhibits: { - Args: Record; + category_in: string + } + Returns: string + } + get_exhibit_details: { + Args: Record Returns: { - id: number; - coordinates: Json; - category: string; - description: string; - image: string; - }[]; - }; + coordinates: Json + category_id: number + category: string + description: string + image: string + }[] + } get_non_spotlight_tours: { - Args: Record; + Args: Record Returns: { - id: string; - name: string; - description: string; - created_at: string; - stop_count: number; - spotlight: boolean; - preview_text: string; - coordinates: Json; - category: Database['public']['Enums']['tour_category']; - }[]; - }; + id: string + name: string + description: string + created_at: string + stop_count: number + spotlight: boolean + preview_text: string + coordinates: Json + category: Database["public"]["Enums"]["tour_category"] + }[] + } join_all_spotlights_with_media: { - Args: Record; + Args: Record Returns: { - id: string; - name: string; - description: string; - created_at: string; - stop_count: number; - spotlight: boolean; - preview_text: string; - coordinates: Json; - category: Database['public']['Enums']['tour_category']; - media_url: string; - }[]; - }; + id: string + name: string + description: string + created_at: string + stop_count: number + spotlight: boolean + preview_text: string + coordinates: Json + category: Database["public"]["Enums"]["tour_category"] + media_url: string + }[] + } join_all_tours_with_media: { - Args: Record; + Args: Record Returns: { - id: string; - name: string; - description: string; - created_at: string; - stop_count: number; - spotlight: boolean; - preview_text: string; - coordinates: Json; - category: Database['public']['Enums']['tour_category']; - media_url: string; - }[]; - }; - }; + id: string + name: string + description: string + created_at: string + stop_count: number + spotlight: boolean + preview_text: string + coordinates: Json + category: Database["public"]["Enums"]["tour_category"] + media_url: string + }[] + } + } Enums: { - media_type: 'image' | 'video' | 'link'; + media_type: "image" | "video" | "link" tour_category: - | 'BuildingsAndServices' - | 'ParksAviariesEnclosures' - | 'SiteFeatures'; - }; + | "BuildingsAndServices" + | "ParksAviariesEnclosures" + | "SiteFeatures" + } 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; - } - ? 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; - } - ? 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; - } - ? 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