From 5c3e2ce55122d14cb98323b984dc314c556bfd0d Mon Sep 17 00:00:00 2001 From: TanCodeX Date: Mon, 20 Jul 2026 16:08:59 +0530 Subject: [PATCH 1/2] refactor: update chat shortcut initialization and add Supabase type definitions --- src/components/AvatarUpload.tsx | 2 +- src/components/dashboard/RecentActivity.tsx | 2 +- src/integrations/supabase/types.ts | 897 ++++++++++++++++++++ src/pages/Chat.tsx | 17 +- src/pages/Contact.test.tsx | 2 +- supabase_types.ts | 1 + temp2_types.ts | 845 ++++++++++++++++++ temp_types.ts | 814 ++++++++++++++++++ 8 files changed, 2569 insertions(+), 11 deletions(-) create mode 100644 supabase_types.ts create mode 100644 temp2_types.ts create mode 100644 temp_types.ts diff --git a/src/components/AvatarUpload.tsx b/src/components/AvatarUpload.tsx index a7e2fa1e..7c1c5744 100644 --- a/src/components/AvatarUpload.tsx +++ b/src/components/AvatarUpload.tsx @@ -1,7 +1,7 @@ import React, { useRef, useState } from "react"; import { Camera, Loader2 } from "lucide-react"; import { supabase } from "@/integrations/supabase/client"; - +import { API_BASE_URL } from "@/config/api"; type AvatarUploadProps = { currentAvatarUrl: string; onUploadSuccess: (url: string) => void; diff --git a/src/components/dashboard/RecentActivity.tsx b/src/components/dashboard/RecentActivity.tsx index 675a56db..a0f5b005 100644 --- a/src/components/dashboard/RecentActivity.tsx +++ b/src/components/dashboard/RecentActivity.tsx @@ -49,7 +49,7 @@ export default function RecentActivity() { supabase .from("resources") .select("id, title, created_at") - .eq("user_id", user.id) + .eq("uploaded_by", user.id) .order("created_at", { ascending: false }) .limit(3), supabase diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index e69de29b..ca3b4b0e 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -0,0 +1,897 @@ +export type Json = + | string + | number + | boolean + | null + | { [key: string]: Json | undefined } + | Json[] + +export type Database = { + // Allows to automatically instantiate createClient with right options + // instead of createClient(URL, KEY) + __InternalSupabase: { + PostgrestVersion: "14.5" + } + public: { + Tables: { + mentorship_paths: { + Row: { + id: string + mentor_id: string + mentee_id: string + goal: string + status: string + created_at: string + updated_at: string + } + Insert: { + id?: string + mentor_id: string + mentee_id: string + goal: string + status?: string + created_at?: string + updated_at?: string + } + Update: { + id?: string + mentor_id?: string + mentee_id?: string + goal?: string + status?: string + created_at?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "mentorship_paths_mentee_id_fkey" + columns: ["mentee_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mentorship_paths_mentor_id_fkey" + columns: ["mentor_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + mentorship_milestones: { + Row: { + id: string + path_id: string + title: string + description: string | null + is_completed: boolean + due_date: string | null + created_at: string + updated_at: string + } + Insert: { + id?: string + path_id: string + title: string + description?: string | null + is_completed?: boolean + due_date?: string | null + created_at?: string + updated_at?: string + } + Update: { + id?: string + path_id?: string + title?: string + description?: string | null + is_completed?: boolean + due_date?: string | null + created_at?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "mentorship_milestones_path_id_fkey" + columns: ["path_id"] + isOneToOne: false + referencedRelation: "mentorship_paths" + referencedColumns: ["id"] + } + ] + } + peer_submissions: { + Row: { + id: string + user_id: string + title: string + description: string | null + content_url: string | null + content: string | null + is_anonymous: boolean + status: string + created_at: string + } + Insert: { + id?: string + user_id: string + title: string + description?: string | null + content_url?: string | null + content?: string | null + is_anonymous?: boolean + status?: string + created_at?: string + } + Update: { + id?: string + user_id?: string + title?: string + description?: string | null + content_url?: string | null + content?: string | null + is_anonymous?: boolean + status?: string + created_at?: string + } + Relationships: [ + { + foreignKeyName: "peer_submissions_user_id_fkey" + columns: ["user_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + peer_reviews: { + Row: { + id: string + submission_id: string + reviewer_id: string + feedback: string + rating: number | null + created_at: string + } + Insert: { + id?: string + submission_id: string + reviewer_id: string + feedback: string + rating?: number | null + created_at?: string + } + Update: { + id?: string + submission_id?: string + reviewer_id?: string + feedback?: string + rating?: number | null + created_at?: string + } + Relationships: [ + { + foreignKeyName: "peer_reviews_submission_id_fkey" + columns: ["submission_id"] + isOneToOne: false + referencedRelation: "peer_submissions" + referencedColumns: ["id"] + }, + { + foreignKeyName: "peer_reviews_reviewer_id_fkey" + columns: ["reviewer_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + + chat_messages: { + Row: { + created_at: string + id: number + } + Insert: { + created_at?: string + id?: number + } + Update: { + created_at?: string + id?: number + } + Relationships: [] + } + messages: { + Row: { + content: string | null + created_at: string | null + id: string + message: string | null + read_at: string | null + receiver_id: string | null + sender_id: string | null + text: string | null + } + Insert: { + content?: string | null + created_at?: string | null + id?: string + message?: string | null + read_at?: string | null + receiver_id?: string | null + sender_id?: string | null + text?: string | null + } + Update: { + content?: string | null + created_at?: string | null + id?: string + message?: string | null + read_at?: string | null + receiver_id?: string | null + sender_id?: string | null + text?: string | null + } + Relationships: [] + } + leaderboard: { + Row: { + id: string + user_id: string + username: string + avatar_url: string | null + xp: number + streak: number + sessions_joined: number + badges: string[] + updated_at: string + } + Insert: { + id?: string + user_id: string + username: string + avatar_url?: string | null + xp?: number + streak?: number + sessions_joined?: number + badges?: string[] + updated_at?: string + } + Update: { + id?: string + user_id?: string + username?: string + avatar_url?: string | null + xp?: number + streak?: number + sessions_joined?: number + badges?: string[] + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "leaderboard_user_id_fkey" + columns: ["user_id"] + isOneToOne: true + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + profiles: { + Row: { + avatar_url: string | null + bio: string | null + created_at: string | null + email: string | null + id: string + last_seen: string | null + name: string | null + skills: string[] | null + is_mentor: boolean + is_learner: boolean + points: number | null + sessions_completed: number | null + rating: number | null + badges: string[] | null + interests: string[] | null + teach_subjects: string[] | null + learn_subjects: string[] | null + updated_at: string | null + streak: number + last_active: string | null + restoration_used_today: boolean + restoration_date: string | null + is_in_focus_mode: boolean | null + focus_time_this_week: number | null + learning_style: string | null + availability: string | null + preferred_language: string | null + timezone: string | null + } + Insert: { + avatar_url?: string | null + bio?: string | null + created_at?: string | null + email?: string | null + id: string + last_seen?: string | null + name?: string | null + skills?: string[] | null + is_mentor?: boolean + is_learner?: boolean + points?: number | null + sessions_completed?: number | null + rating?: number | null + badges?: string[] | null + interests?: string[] | null + teach_subjects?: string[] | null + learn_subjects?: string[] | null + updated_at?: string | null + streak?: number + last_active?: string | null + restoration_used_today?: boolean + restoration_date?: string | null + learning_style?: string | null + availability?: string | null + preferred_language?: string | null + timezone?: string | null + } + Update: { + avatar_url?: string | null + bio?: string | null + created_at?: string | null + email?: string | null + id?: string + last_seen?: string | null + name?: string | null + skills?: string[] | null + is_mentor?: boolean + is_learner?: boolean + points?: number | null + sessions_completed?: number | null + rating?: number | null + badges?: string[] | null + interests?: string[] | null + teach_subjects?: string[] | null + learn_subjects?: string[] | null + updated_at?: string | null + streak?: number + last_active?: string | null + restoration_used_today?: boolean + restoration_date?: string | null + learning_style?: string | null + availability?: string | null + preferred_language?: string | null + timezone?: string | null + } + Relationships: [] + } + resources: { + Row: { + id: string + title: string + description: string | null + file_url: string + file_size: number | null + tags: string[] | null + file_type: string + uploaded_by: string + created_at: string + } + Insert: { + id?: string + title: string + description?: string | null + file_url: string + file_size?: number | null + tags?: string[] | null + file_type: string + uploaded_by: string + created_at?: string + } + Update: { + id?: string + title?: string + description?: string | null + file_url?: string + file_size?: number | null + tags?: string[] | null + file_type?: string + uploaded_by?: string + created_at?: string + } + Relationships: [] + } + resource_votes: { + Row: { + id: string + resource_id: string + user_id: string + vote_type: number + created_at: string + } + Insert: { + id?: string + resource_id: string + user_id: string + vote_type: number + created_at?: string + } + Update: { + id?: string + resource_id?: string + user_id?: string + vote_type?: number + created_at?: string + } + Relationships: [] + } + saved_resources: { + Row: { + id: string + resource_id: string + user_id: string + created_at: string + } + Insert: { + id?: string + resource_id: string + user_id: string + created_at?: string + } + Update: { + id?: string + resource_id?: string + user_id?: string + created_at?: string + } + Relationships: [] + } + skill_endorsements: { + Row: { + id: string + skill: string + endorsed_user_id: string + endorser_id: string + created_at: string + } + Insert: { + id?: string + skill: string + endorsed_user_id: string + endorser_id: string + created_at?: string + } + Update: { + id?: string + skill?: string + endorsed_user_id?: string + endorser_id?: string + created_at?: string + } + Relationships: [] + } + testimonials: { + Row: { + id: string + user_id: string + name: string | null + rating: number | null + review: string + status: string + created_at: string + } + Insert: { + id?: string + user_id: string + name?: string | null + rating?: number | null + review: string + status?: string + created_at?: string + } + Update: { + id?: string + user_id?: string + name?: string | null + rating?: number | null + review?: string + status?: string + created_at?: string + } + Relationships: [ + { + foreignKeyName: "testimonials_user_id_fkey" + columns: ["user_id"] + isOneToOne: false + referencedRelation: "users" + referencedColumns: ["id"] + } + ] + } + study_rooms: { + Row: { + id: string + topic: string + created_by: string | null + created_at: string + is_private: boolean + } + Insert: { + id?: string + topic: string + created_by?: string | null + created_at?: string + is_private?: boolean + } + Update: { + id?: string + topic?: string + created_by?: string | null + created_at?: string + is_private?: boolean + } + Relationships: [ + { + foreignKeyName: "study_rooms_created_by_fkey" + columns: ["created_by"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + study_room_messages: { + Row: { + id: string + room_id: string | null + profile_id: string | null + content: string + created_at: string + } + Insert: { + id?: string + room_id?: string | null + profile_id?: string | null + content: string + created_at?: string + } + Update: { + id?: string + room_id?: string | null + profile_id?: string | null + content?: string + created_at?: string + } + Relationships: [ + { + foreignKeyName: "study_room_messages_profile_id_fkey" + columns: ["profile_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "study_room_messages_room_id_fkey" + columns: ["room_id"] + isOneToOne: false + referencedRelation: "study_rooms" + referencedColumns: ["id"] + } + ] + } + study_room_participants: { + Row: { + room_id: string + profile_id: string + joined_at: string + } + Insert: { + room_id: string + profile_id: string + joined_at?: string + } + Update: { + room_id?: string + profile_id?: string + joined_at?: string + } + Relationships: [ + { + foreignKeyName: "study_room_participants_profile_id_fkey" + columns: ["profile_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "study_room_participants_room_id_fkey" + columns: ["room_id"] + isOneToOne: false + referencedRelation: "study_rooms" + referencedColumns: ["id"] + } + ] + } + sessions: { + Row: { + created_at: string + description: string | null + id: number + scheduled_at: string | null + /** duration_minutes – NEW column added by session scheduling migration */ + duration_minutes: number + /** status values: 'scheduled' | 'live' | 'ended' */ + status: string + student_id: string | null + mentor_id: string | null + seat_limit: number | null + participants: number + title: string | null + tags: string[] | null + } + Insert: { + created_at?: string + description?: string | null + id?: number + scheduled_at?: string | null + duration_minutes?: number + status?: string + student_id?: string | null + mentor_id?: string | null + seat_limit?: number | null + participants?: number + title?: string | null + tags?: string[] | null + } + Update: { + created_at?: string + description?: string | null + id?: number + scheduled_at?: string | null + duration_minutes?: number + status?: string + student_id?: string | null + mentor_id?: string | null + seat_limit?: number | null + participants?: number + title?: string | null + tags?: string[] | null + } + Relationships: [] + } + users: { + Row: { + created_at: string | null + email: string | null + id: string + learning_goals: string | null + name: string | null + skills: string | null + } + Insert: { + created_at?: string | null + email?: string | null + id?: string + learning_goals?: string | null + name?: string | null + skills?: string | null + } + Update: { + created_at?: string | null + email?: string | null + id?: string + learning_goals?: string | null + name?: string | null + skills?: string | null + } + Relationships: [] + } + } + Views: { + skill_endorsement_counts: { + Row: { + endorsed_user_id: string + skill: string + endorsement_count: number + } + Relationships: [] + } + } + Functions: { + submit_peer_review: { + Args: { + p_submission_id: string + p_feedback: string + } + Returns: { + id: string + submission_id: string + reviewer_id: string + feedback: string + rating: number | null + created_at: string + } + } + award_activity_xp: { + Args: { _activity_type: string } + Returns: undefined + } + get_user_rank: { + Args: { + p_user_id: string + p_filter?: string + } + Returns: number + } + has_role: { + Args: { + _role: string + _user_id: string + } + Returns: boolean + } + invite_to_study_room: { + Args: { + p_room_id: string + p_user_email: string + } + Returns: undefined + } + join_leaderboard: { + Args: { + _username: string + _avatar_url: string | null + } + Returns: undefined + } + join_public_study_room: { + Args: { p_room_id: string } + Returns: undefined + } + join_session: { + Args: { p_session_id: string } + Returns: undefined + } + mark_messages_as_read: { + Args: { message_ids: string[] } + Returns: undefined + } + tick_session_statuses: { + Args: Record + Returns: undefined + } + } + Enums: { + [_ in never]: never + } + CompositeTypes: { + [_ in never]: never + } + } +} + +type DatabaseWithoutInternals = Omit + +type DefaultSchema = DatabaseWithoutInternals[Extract] + +export type Tables< + DefaultSchemaTableNameOrOptions extends + | keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) + | { schema: keyof DatabaseWithoutInternals }, + TableName extends DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"]) + : never = never, +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends { + Row: infer R + } + ? R + : never + : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & + DefaultSchema["Views"]) + ? (DefaultSchema["Tables"] & + DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends { + Row: infer R + } + ? R + : never + : never + +export type TablesInsert< + DefaultSchemaTableNameOrOptions extends + | keyof DefaultSchema["Tables"] + | { schema: keyof DatabaseWithoutInternals }, + TableName extends DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Insert: infer I + } + ? I + : never + : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] + ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { + Insert: infer I + } + ? I + : never + : never + +export type TablesUpdate< + DefaultSchemaTableNameOrOptions extends + | keyof DefaultSchema["Tables"] + | { schema: keyof DatabaseWithoutInternals }, + TableName extends DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Update: infer U + } + ? U + : never + : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] + ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { + Update: infer U + } + ? U + : never + : never + +export type Enums< + DefaultSchemaEnumNameOrOptions extends + | keyof DefaultSchema["Enums"] + | { schema: keyof DatabaseWithoutInternals }, + EnumName extends DefaultSchemaEnumNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"] + : never = never, +> = DefaultSchemaEnumNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName] + : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] + ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions] + : never + +export type CompositeTypes< + PublicCompositeTypeNameOrOptions extends + | keyof DefaultSchema["CompositeTypes"] + | { schema: keyof DatabaseWithoutInternals }, + CompositeTypeName extends PublicCompositeTypeNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] + : never = never, +> = PublicCompositeTypeNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] + : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] + ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] + : never + +export const Constants = { + public: { + Enums: {}, + }, +} as const diff --git a/src/pages/Chat.tsx b/src/pages/Chat.tsx index 8d02e158..7a061d44 100644 --- a/src/pages/Chat.tsx +++ b/src/pages/Chat.tsx @@ -123,14 +123,6 @@ const Chat = () => { const searchInputRef = useRef(null); - useChatShortcuts({ - searchInputRef, - items: filteredUsers, - selectedItem: selectedUser, - onSelect: selectUser, - onEscape: () => setShowConversationList(true), - getItemId: (user) => user.id, - }); const messagesEndRef = useRef(null); const typingTimeoutRef = useRef | null>(null); @@ -432,6 +424,15 @@ const Chat = () => { setTypingUserId(null); }, []); + useChatShortcuts({ + searchInputRef, + items: filteredUsers, + selectedItem: selectedUser, + onSelect: selectUser, + onEscape: () => setShowConversationList(true), + getItemId: (user) => user.id, + }); + if (!currentUser) { return (
diff --git a/src/pages/Contact.test.tsx b/src/pages/Contact.test.tsx index ca4459e0..3ffa3345 100644 --- a/src/pages/Contact.test.tsx +++ b/src/pages/Contact.test.tsx @@ -29,7 +29,7 @@ describe("Contact", () => { beforeEach(() => { vi.clearAllMocks(); - localStorage?.clear(); + localStorage?.clear?.(); (useToast as any).mockReturnValue({ toast }); (supabase.from as any).mockReturnValue({ insert }); diff --git a/supabase_types.ts b/supabase_types.ts new file mode 100644 index 00000000..fd42686e --- /dev/null +++ b/supabase_types.ts @@ -0,0 +1 @@ +{"_tag":"Error","error":{"code":"LegacyPlatformAuthRequiredError","message":"Access token not provided. Supply an access token by running `supabase login` or setting the SUPABASE_ACCESS_TOKEN environment variable."}} diff --git a/temp2_types.ts b/temp2_types.ts new file mode 100644 index 00000000..56d607d3 --- /dev/null +++ b/temp2_types.ts @@ -0,0 +1,845 @@ +export type Json = + | string + | number + | boolean + | null + | { [key: string]: Json | undefined } + | Json[] + +export type Database = { + // Allows to automatically instantiate createClient with right options + // instead of createClient(URL, KEY) + __InternalSupabase: { + PostgrestVersion: "14.5" + } + public: { + Tables: { + mentorship_paths: { + Row: { + id: string + mentor_id: string + mentee_id: string + goal: string + status: string + created_at: string + updated_at: string + } + Insert: { + id?: string + mentor_id: string + mentee_id: string + goal: string + status?: string + created_at?: string + updated_at?: string + } + Update: { + id?: string + mentor_id?: string + mentee_id?: string + goal?: string + status?: string + created_at?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "mentorship_paths_mentee_id_fkey" + columns: ["mentee_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mentorship_paths_mentor_id_fkey" + columns: ["mentor_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + mentorship_milestones: { + Row: { + id: string + path_id: string + title: string + description: string | null + is_completed: boolean + due_date: string | null + created_at: string + updated_at: string + } + Insert: { + id?: string + path_id: string + title: string + description?: string | null + is_completed?: boolean + due_date?: string | null + created_at?: string + updated_at?: string + } + Update: { + id?: string + path_id?: string + title?: string + description?: string | null + is_completed?: boolean + due_date?: string | null + created_at?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "mentorship_milestones_path_id_fkey" + columns: ["path_id"] + isOneToOne: false + referencedRelation: "mentorship_paths" + referencedColumns: ["id"] + } + ] + } + peer_submissions: { + Row: { + id: string + user_id: string + title: string + description: string | null + content_url: string | null + content: string | null + is_anonymous: boolean + status: string + created_at: string + } + Insert: { + id?: string + user_id: string + title: string + description?: string | null + content_url?: string | null + content?: string | null + is_anonymous?: boolean + status?: string + created_at?: string + } + Update: { + id?: string + user_id?: string + title?: string + description?: string | null + content_url?: string | null + content?: string | null + is_anonymous?: boolean + status?: string + created_at?: string + } + Relationships: [ + { + foreignKeyName: "peer_submissions_user_id_fkey" + columns: ["user_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + peer_reviews: { + Row: { + id: string + submission_id: string + reviewer_id: string + feedback: string + rating: number | null + created_at: string + } + Insert: { + id?: string + submission_id: string + reviewer_id: string + feedback: string + rating?: number | null + created_at?: string + } + Update: { + id?: string + submission_id?: string + reviewer_id?: string + feedback?: string + rating?: number | null + created_at?: string + } + Relationships: [ + { + foreignKeyName: "peer_reviews_submission_id_fkey" + columns: ["submission_id"] + isOneToOne: false + referencedRelation: "peer_submissions" + referencedColumns: ["id"] + }, + { + foreignKeyName: "peer_reviews_reviewer_id_fkey" + columns: ["reviewer_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + + chat_messages: { + Row: { + created_at: string + id: number + } + Insert: { + created_at?: string + id?: number + } + Update: { + created_at?: string + id?: number + } + Relationships: [] + } + messages: { + Row: { + content: string | null + created_at: string | null + id: string + message: string | null + read_at: string | null + receiver_id: string | null + sender_id: string | null + text: string | null + } + Insert: { + content?: string | null + created_at?: string | null + id?: string + message?: string | null + read_at?: string | null + receiver_id?: string | null + sender_id?: string | null + text?: string | null + } + Update: { + content?: string | null + created_at?: string | null + id?: string + message?: string | null + read_at?: string | null + receiver_id?: string | null + sender_id?: string | null + text?: string | null + } + Relationships: [] + } + leaderboard: { + Row: { + id: string + user_id: string + username: string + avatar_url: string | null + xp: number + streak: number + sessions_joined: number + badges: string[] + updated_at: string + } + Insert: { + id?: string + user_id: string + username: string + avatar_url?: string | null + xp?: number + streak?: number + sessions_joined?: number + badges?: string[] + updated_at?: string + } + Update: { + id?: string + user_id?: string + username?: string + avatar_url?: string | null + xp?: number + streak?: number + sessions_joined?: number + badges?: string[] + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "leaderboard_user_id_fkey" + columns: ["user_id"] + isOneToOne: true + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + profiles: { + Row: { + avatar_url: string | null + bio: string | null + created_at: string | null + email: string | null + id: string + last_seen: string | null + name: string | null + skills: string[] | null + is_mentor: boolean + is_learner: boolean + points: number | null + sessions_completed: number | null + rating: number | null + badges: string[] | null + interests: string[] | null + teach_subjects: string[] | null + learn_subjects: string[] | null + updated_at: string | null + streak: number + last_active: string | null + restoration_used_today: boolean + restoration_date: string | null + is_in_focus_mode: boolean | null + focus_time_this_week: number | null + learning_style: string | null + availability: string | null + preferred_language: string | null + timezone: string | null + } + Insert: { + avatar_url?: string | null + bio?: string | null + created_at?: string | null + email?: string | null + id: string + last_seen?: string | null + name?: string | null + skills?: string[] | null + is_mentor?: boolean + is_learner?: boolean + points?: number | null + sessions_completed?: number | null + rating?: number | null + badges?: string[] | null + interests?: string[] | null + teach_subjects?: string[] | null + learn_subjects?: string[] | null + updated_at?: string | null + streak?: number + last_active?: string | null + restoration_used_today?: boolean + restoration_date?: string | null + learning_style?: string | null + availability?: string | null + preferred_language?: string | null + timezone?: string | null + } + Update: { + avatar_url?: string | null + bio?: string | null + created_at?: string | null + email?: string | null + id?: string + last_seen?: string | null + name?: string | null + skills?: string[] | null + is_mentor?: boolean + is_learner?: boolean + points?: number | null + sessions_completed?: number | null + rating?: number | null + badges?: string[] | null + interests?: string[] | null + teach_subjects?: string[] | null + learn_subjects?: string[] | null + updated_at?: string | null + streak?: number + last_active?: string | null + restoration_used_today?: boolean + restoration_date?: string | null + learning_style?: string | null + availability?: string | null + preferred_language?: string | null + timezone?: string | null + } + Relationships: [] + } + resources: { + Row: { + id: string + title: string + description: string | null + file_url: string + file_size: number | null + tags: string[] | null + file_type: string + uploaded_by: string + created_at: string + } + Insert: { + id?: string + title: string + description?: string | null + file_url: string + file_size?: number | null + tags?: string[] | null + file_type: string + uploaded_by: string + created_at?: string + } + Update: { + id?: string + title?: string + description?: string | null + file_url?: string + file_size?: number | null + tags?: string[] | null + file_type?: string + uploaded_by?: string + created_at?: string + } + Relationships: [] + } + resource_votes: { + Row: { + id: string + resource_id: string + user_id: string + vote_type: number + created_at: string + } + Insert: { + id?: string + resource_id: string + user_id: string + vote_type: number + created_at?: string + } + Update: { + id?: string + resource_id?: string + user_id?: string + vote_type?: number + created_at?: string + } + Relationships: [] + } + saved_resources: { + Row: { + id: string + resource_id: string + user_id: string + created_at: string + } + Insert: { + id?: string + resource_id: string + user_id: string + created_at?: string + } + Update: { + id?: string + resource_id?: string + user_id?: string + created_at?: string + } + Relationships: [] + } + skill_endorsements: { + Row: { + id: string + skill: string + endorsed_user_id: string + endorser_id: string + created_at: string + } + Insert: { + id?: string + skill: string + endorsed_user_id: string + endorser_id: string + created_at?: string + } + Update: { + id?: string + skill?: string + endorsed_user_id?: string + endorser_id?: string + created_at?: string + } + Relationships: [] + } + study_rooms: { + Row: { + id: string + topic: string + created_by: string | null + created_at: string + is_private: boolean + } + Insert: { + id?: string + topic: string + created_by?: string | null + created_at?: string + is_private?: boolean + } + Update: { + id?: string + topic?: string + created_by?: string | null + created_at?: string + is_private?: boolean + } + Relationships: [ + { + foreignKeyName: "study_rooms_created_by_fkey" + columns: ["created_by"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + study_room_messages: { + Row: { + id: string + room_id: string | null + profile_id: string | null + content: string + created_at: string + } + Insert: { + id?: string + room_id?: string | null + profile_id?: string | null + content: string + created_at?: string + } + Update: { + id?: string + room_id?: string | null + profile_id?: string | null + content?: string + created_at?: string + } + Relationships: [ + { + foreignKeyName: "study_room_messages_profile_id_fkey" + columns: ["profile_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "study_room_messages_room_id_fkey" + columns: ["room_id"] + isOneToOne: false + referencedRelation: "study_rooms" + referencedColumns: ["id"] + } + ] + } + study_room_participants: { + Row: { + room_id: string + profile_id: string + joined_at: string + } + Insert: { + room_id: string + profile_id: string + joined_at?: string + } + Update: { + room_id?: string + profile_id?: string + joined_at?: string + } + Relationships: [ + { + foreignKeyName: "study_room_participants_profile_id_fkey" + columns: ["profile_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "study_room_participants_room_id_fkey" + columns: ["room_id"] + isOneToOne: false + referencedRelation: "study_rooms" + referencedColumns: ["id"] + } + ] + } + sessions: { + Row: { + created_at: string + description: string | null + id: number + scheduled_at: string | null + /** duration_minutes – NEW column added by session scheduling migration */ + duration_minutes: number + /** status values: 'scheduled' | 'live' | 'ended' */ + status: string + student_id: string | null + mentor_id: string | null + seat_limit: number | null + participants: number + title: string | null + tags: string[] | null + } + Insert: { + created_at?: string + description?: string | null + id?: number + scheduled_at?: string | null + duration_minutes?: number + status?: string + student_id?: string | null + mentor_id?: string | null + seat_limit?: number | null + participants?: number + title?: string | null + tags?: string[] | null + } + Update: { + created_at?: string + description?: string | null + id?: number + scheduled_at?: string | null + duration_minutes?: number + status?: string + student_id?: string | null + mentor_id?: string | null + seat_limit?: number | null + participants?: number + title?: string | null + tags?: string[] | null + } + Relationships: [] + } + users: { + Row: { + created_at: string | null + email: string | null + id: string + learning_goals: string | null + name: string | null + skills: string | null + } + Insert: { + created_at?: string | null + email?: string | null + id?: string + learning_goals?: string | null + name?: string | null + skills?: string | null + } + Update: { + created_at?: string | null + email?: string | null + id?: string + learning_goals?: string | null + name?: string | null + skills?: string | null + } + Relationships: [] + } + } + Views: { + skill_endorsement_counts: { + Row: { + endorsed_user_id: string + skill: string + endorsement_count: number + } + Relationships: [] + } + } + Functions: { + award_activity_xp: { + Args: { _activity_type: string } + Returns: undefined + } + get_user_rank: { + Args: { + p_user_id: string + p_filter?: string + } + Returns: number + } + has_role: { + Args: { + _role: string + _user_id: string + } + Returns: boolean + } + invite_to_study_room: { + Args: { + p_room_id: string + p_user_email: string + } + Returns: undefined + } + join_leaderboard: { + Args: { + _username: string + _avatar_url: string | null + } + Returns: undefined + } + join_public_study_room: { + Args: { p_room_id: string } + Returns: undefined + } + join_session: { + Args: { p_session_id: string } + Returns: undefined + } + mark_messages_as_read: { + Args: { message_ids: string[] } + Returns: undefined + } + tick_session_statuses: { + Args: Record + Returns: undefined + } + } + Enums: { + [_ in never]: never + } + CompositeTypes: { + [_ in never]: never + } + } +} + +type DatabaseWithoutInternals = Omit + +type DefaultSchema = DatabaseWithoutInternals[Extract] + +export type Tables< + DefaultSchemaTableNameOrOptions extends + | keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) + | { schema: keyof DatabaseWithoutInternals }, + TableName extends DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"]) + : never = never, +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends { + Row: infer R + } + ? R + : never + : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & + DefaultSchema["Views"]) + ? (DefaultSchema["Tables"] & + DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends { + Row: infer R + } + ? R + : never + : never + +export type TablesInsert< + DefaultSchemaTableNameOrOptions extends + | keyof DefaultSchema["Tables"] + | { schema: keyof DatabaseWithoutInternals }, + TableName extends DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Insert: infer I + } + ? I + : never + : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] + ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { + Insert: infer I + } + ? I + : never + : never + +export type TablesUpdate< + DefaultSchemaTableNameOrOptions extends + | keyof DefaultSchema["Tables"] + | { schema: keyof DatabaseWithoutInternals }, + TableName extends DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Update: infer U + } + ? U + : never + : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] + ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { + Update: infer U + } + ? U + : never + : never + +export type Enums< + DefaultSchemaEnumNameOrOptions extends + | keyof DefaultSchema["Enums"] + | { schema: keyof DatabaseWithoutInternals }, + EnumName extends DefaultSchemaEnumNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"] + : never = never, +> = DefaultSchemaEnumNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName] + : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] + ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions] + : never + +export type CompositeTypes< + PublicCompositeTypeNameOrOptions extends + | keyof DefaultSchema["CompositeTypes"] + | { schema: keyof DatabaseWithoutInternals }, + CompositeTypeName extends PublicCompositeTypeNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] + : never = never, +> = PublicCompositeTypeNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] + : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] + ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] + : never + +export const Constants = { + public: { + Enums: {}, + }, +} as const diff --git a/temp_types.ts b/temp_types.ts new file mode 100644 index 00000000..ed2c217a --- /dev/null +++ b/temp_types.ts @@ -0,0 +1,814 @@ +export type Json = + | string + | number + | boolean + | null + | { [key: string]: Json | undefined } + | Json[] + +export type Database = { + // Allows to automatically instantiate createClient with right options + // instead of createClient(URL, KEY) + __InternalSupabase: { + PostgrestVersion: "14.5" + } + public: { + Tables: { + mentorship_paths: { + Row: { + id: string + mentor_id: string + mentee_id: string + goal: string + status: string + created_at: string + updated_at: string + } + Insert: { + id?: string + mentor_id: string + mentee_id: string + goal: string + status?: string + created_at?: string + updated_at?: string + } + Update: { + id?: string + mentor_id?: string + mentee_id?: string + goal?: string + status?: string + created_at?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "mentorship_paths_mentee_id_fkey" + columns: ["mentee_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mentorship_paths_mentor_id_fkey" + columns: ["mentor_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + mentorship_milestones: { + Row: { + id: string + path_id: string + title: string + description: string | null + is_completed: boolean + due_date: string | null + created_at: string + updated_at: string + } + Insert: { + id?: string + path_id: string + title: string + description?: string | null + is_completed?: boolean + due_date?: string | null + created_at?: string + updated_at?: string + } + Update: { + id?: string + path_id?: string + title?: string + description?: string | null + is_completed?: boolean + due_date?: string | null + created_at?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "mentorship_milestones_path_id_fkey" + columns: ["path_id"] + isOneToOne: false + referencedRelation: "mentorship_paths" + referencedColumns: ["id"] + } + ] + } + peer_submissions: { + Row: { + id: string + user_id: string + title: string + description: string | null + content_url: string | null + content: string | null + is_anonymous: boolean + status: string + created_at: string + } + Insert: { + id?: string + user_id: string + title: string + description?: string | null + content_url?: string | null + content?: string | null + is_anonymous?: boolean + status?: string + created_at?: string + } + Update: { + id?: string + user_id?: string + title?: string + description?: string | null + content_url?: string | null + content?: string | null + is_anonymous?: boolean + status?: string + created_at?: string + } + Relationships: [ + { + foreignKeyName: "peer_submissions_user_id_fkey" + columns: ["user_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + peer_reviews: { + Row: { + id: string + submission_id: string + reviewer_id: string + feedback: string + rating: number | null + created_at: string + } + Insert: { + id?: string + submission_id: string + reviewer_id: string + feedback: string + rating?: number | null + created_at?: string + } + Update: { + id?: string + submission_id?: string + reviewer_id?: string + feedback?: string + rating?: number | null + created_at?: string + } + Relationships: [ + { + foreignKeyName: "peer_reviews_submission_id_fkey" + columns: ["submission_id"] + isOneToOne: false + referencedRelation: "peer_submissions" + referencedColumns: ["id"] + }, + { + foreignKeyName: "peer_reviews_reviewer_id_fkey" + columns: ["reviewer_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + + chat_messages: { + Row: { + created_at: string + id: number + } + Insert: { + created_at?: string + id?: number + } + Update: { + created_at?: string + id?: number + } + Relationships: [] + } + messages: { + Row: { + content: string | null + created_at: string | null + id: string + message: string | null + read_at: string | null + receiver_id: string | null + sender_id: string | null + text: string | null + } + Insert: { + content?: string | null + created_at?: string | null + id?: string + message?: string | null + read_at?: string | null + receiver_id?: string | null + sender_id?: string | null + text?: string | null + } + Update: { + content?: string | null + created_at?: string | null + id?: string + message?: string | null + read_at?: string | null + receiver_id?: string | null + sender_id?: string | null + text?: string | null + } + Relationships: [] + } + leaderboard: { + Row: { + id: string + user_id: string + username: string + avatar_url: string | null + xp: number + streak: number + sessions_joined: number + badges: string[] + updated_at: string + } + Insert: { + id?: string + user_id: string + username: string + avatar_url?: string | null + xp?: number + streak?: number + sessions_joined?: number + badges?: string[] + updated_at?: string + } + Update: { + id?: string + user_id?: string + username?: string + avatar_url?: string | null + xp?: number + streak?: number + sessions_joined?: number + badges?: string[] + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "leaderboard_user_id_fkey" + columns: ["user_id"] + isOneToOne: true + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + profiles: { + Row: { + avatar_url: string | null + bio: string | null + created_at: string | null + email: string | null + id: string + last_seen: string | null + name: string | null + skills: string[] | null + is_mentor: boolean + is_learner: boolean + points: number | null + sessions_completed: number | null + rating: number | null + badges: string[] | null + interests: string[] | null + teach_subjects: string[] | null + learn_subjects: string[] | null + updated_at: string | null + streak: number + last_active: string | null + restoration_used_today: boolean + restoration_date: string | null + is_in_focus_mode: boolean | null + focus_time_this_week: number | null + learning_style: string | null + availability: string | null + preferred_language: string | null + timezone: string | null + } + Insert: { + avatar_url?: string | null + bio?: string | null + created_at?: string | null + email?: string | null + id: string + last_seen?: string | null + name?: string | null + skills?: string[] | null + is_mentor?: boolean + is_learner?: boolean + points?: number | null + sessions_completed?: number | null + rating?: number | null + badges?: string[] | null + interests?: string[] | null + teach_subjects?: string[] | null + learn_subjects?: string[] | null + updated_at?: string | null + streak?: number + last_active?: string | null + restoration_used_today?: boolean + restoration_date?: string | null + learning_style?: string | null + availability?: string | null + preferred_language?: string | null + timezone?: string | null + } + Update: { + avatar_url?: string | null + bio?: string | null + created_at?: string | null + email?: string | null + id?: string + last_seen?: string | null + name?: string | null + skills?: string[] | null + is_mentor?: boolean + is_learner?: boolean + points?: number | null + sessions_completed?: number | null + rating?: number | null + badges?: string[] | null + interests?: string[] | null + teach_subjects?: string[] | null + learn_subjects?: string[] | null + updated_at?: string | null + streak?: number + last_active?: string | null + restoration_used_today?: boolean + restoration_date?: string | null + learning_style?: string | null + availability?: string | null + preferred_language?: string | null + timezone?: string | null + } + Relationships: [] + } + resources: { + Row: { + id: string + title: string + description: string | null + file_url: string + file_size: number | null + tags: string[] | null + file_type: string + uploaded_by: string + created_at: string + } + Insert: { + id?: string + title: string + description?: string | null + file_url: string + file_size?: number | null + tags?: string[] | null + file_type: string + uploaded_by: string + created_at?: string + } + Update: { + id?: string + title?: string + description?: string | null + file_url?: string + file_size?: number | null + tags?: string[] | null + file_type?: string + uploaded_by?: string + created_at?: string + } + Relationships: [] + } + resource_votes: { + Row: { + id: string + resource_id: string + user_id: string + vote_type: number + created_at: string + } + Insert: { + id?: string + resource_id: string + user_id: string + vote_type: number + created_at?: string + } + Update: { + id?: string + resource_id?: string + user_id?: string + vote_type?: number + created_at?: string + } + Relationships: [] + } + saved_resources: { + Row: { + id: string + resource_id: string + user_id: string + created_at: string + } + Insert: { + id?: string + resource_id: string + user_id: string + created_at?: string + } + Update: { + id?: string + resource_id?: string + user_id?: string + created_at?: string + } + Relationships: [] + } + study_rooms: { + Row: { + id: string + topic: string + created_by: string | null + created_at: string + is_private: boolean + } + Insert: { + id?: string + topic: string + created_by?: string | null + created_at?: string + is_private?: boolean + } + Update: { + id?: string + topic?: string + created_by?: string | null + created_at?: string + is_private?: boolean + } + Relationships: [ + { + foreignKeyName: "study_rooms_created_by_fkey" + columns: ["created_by"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + } + ] + } + study_room_messages: { + Row: { + id: string + room_id: string | null + profile_id: string | null + content: string + created_at: string + } + Insert: { + id?: string + room_id?: string | null + profile_id?: string | null + content: string + created_at?: string + } + Update: { + id?: string + room_id?: string | null + profile_id?: string | null + content?: string + created_at?: string + } + Relationships: [ + { + foreignKeyName: "study_room_messages_profile_id_fkey" + columns: ["profile_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "study_room_messages_room_id_fkey" + columns: ["room_id"] + isOneToOne: false + referencedRelation: "study_rooms" + referencedColumns: ["id"] + } + ] + } + study_room_participants: { + Row: { + room_id: string + profile_id: string + joined_at: string + } + Insert: { + room_id: string + profile_id: string + joined_at?: string + } + Update: { + room_id?: string + profile_id?: string + joined_at?: string + } + Relationships: [ + { + foreignKeyName: "study_room_participants_profile_id_fkey" + columns: ["profile_id"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "study_room_participants_room_id_fkey" + columns: ["room_id"] + isOneToOne: false + referencedRelation: "study_rooms" + referencedColumns: ["id"] + } + ] + } + sessions: { + Row: { + created_at: string + description: string | null + id: number + scheduled_at: string | null + /** duration_minutes – NEW column added by session scheduling migration */ + duration_minutes: number + /** status values: 'scheduled' | 'live' | 'ended' */ + status: string + student_id: string | null + mentor_id: string | null + seat_limit: number | null + participants: number + title: string | null + tags: string[] | null + } + Insert: { + created_at?: string + description?: string | null + id?: number + scheduled_at?: string | null + duration_minutes?: number + status?: string + student_id?: string | null + mentor_id?: string | null + seat_limit?: number | null + participants?: number + title?: string | null + tags?: string[] | null + } + Update: { + created_at?: string + description?: string | null + id?: number + scheduled_at?: string | null + duration_minutes?: number + status?: string + student_id?: string | null + mentor_id?: string | null + seat_limit?: number | null + participants?: number + title?: string | null + tags?: string[] | null + } + Relationships: [] + } + users: { + Row: { + created_at: string | null + email: string | null + id: string + learning_goals: string | null + name: string | null + skills: string | null + } + Insert: { + created_at?: string | null + email?: string | null + id?: string + learning_goals?: string | null + name?: string | null + skills?: string | null + } + Update: { + created_at?: string | null + email?: string | null + id?: string + learning_goals?: string | null + name?: string | null + skills?: string | null + } + Relationships: [] + } + } + Views: { + [_ in never]: never + } + Functions: { + award_activity_xp: { + Args: { _activity_type: string } + Returns: undefined + } + get_user_rank: { + Args: { + p_user_id: string + p_filter?: string + } + Returns: number + } + has_role: { + Args: { + _role: string + _user_id: string + } + Returns: boolean + } + invite_to_study_room: { + Args: { + p_room_id: string + p_user_email: string + } + Returns: undefined + } + join_leaderboard: { + Args: { + _username: string + _avatar_url: string | null + } + Returns: undefined + } + join_public_study_room: { + Args: { p_room_id: string } + Returns: undefined + } + join_session: { + Args: { p_session_id: string } + Returns: undefined + } + mark_messages_as_read: { + Args: { message_ids: string[] } + Returns: undefined + } + tick_session_statuses: { + Args: Record + Returns: undefined + } + } + Enums: { + [_ in never]: never + } + CompositeTypes: { + [_ in never]: never + } + } +} + +type DatabaseWithoutInternals = Omit + +type DefaultSchema = DatabaseWithoutInternals[Extract] + +export type Tables< + DefaultSchemaTableNameOrOptions extends + | keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) + | { schema: keyof DatabaseWithoutInternals }, + TableName extends DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"]) + : never = never, +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends { + Row: infer R + } + ? R + : never + : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & + DefaultSchema["Views"]) + ? (DefaultSchema["Tables"] & + DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends { + Row: infer R + } + ? R + : never + : never + +export type TablesInsert< + DefaultSchemaTableNameOrOptions extends + | keyof DefaultSchema["Tables"] + | { schema: keyof DatabaseWithoutInternals }, + TableName extends DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Insert: infer I + } + ? I + : never + : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] + ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { + Insert: infer I + } + ? I + : never + : never + +export type TablesUpdate< + DefaultSchemaTableNameOrOptions extends + | keyof DefaultSchema["Tables"] + | { schema: keyof DatabaseWithoutInternals }, + TableName extends DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = DefaultSchemaTableNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Update: infer U + } + ? U + : never + : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] + ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { + Update: infer U + } + ? U + : never + : never + +export type Enums< + DefaultSchemaEnumNameOrOptions extends + | keyof DefaultSchema["Enums"] + | { schema: keyof DatabaseWithoutInternals }, + EnumName extends DefaultSchemaEnumNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"] + : never = never, +> = DefaultSchemaEnumNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName] + : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] + ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions] + : never + +export type CompositeTypes< + PublicCompositeTypeNameOrOptions extends + | keyof DefaultSchema["CompositeTypes"] + | { schema: keyof DatabaseWithoutInternals }, + CompositeTypeName extends PublicCompositeTypeNameOrOptions extends { + schema: keyof DatabaseWithoutInternals + } + ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] + : never = never, +> = PublicCompositeTypeNameOrOptions extends { + schema: keyof DatabaseWithoutInternals +} + ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] + : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] + ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] + : never + +export const Constants = { + public: { + Enums: {}, + }, +} as const From bc0b8709a029a4d64cc2871cb67c7ed698c9ff61 Mon Sep 17 00:00:00 2001 From: TanCodeX Date: Mon, 20 Jul 2026 16:17:13 +0530 Subject: [PATCH 2/2] feat: initialize Supabase type definitions and remove unnecessary ESLint disables from configuration and UI files --- src/pages/aipage.tsx | 2 +- supabase_types.ts | 17 ++++++++++++++++- tailwind.config.ts | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/pages/aipage.tsx b/src/pages/aipage.tsx index 39c2b808..d23ed674 100644 --- a/src/pages/aipage.tsx +++ b/src/pages/aipage.tsx @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ + import { useState } from "react"; import { Bot, Send, User } from "lucide-react"; import { supabase } from "@/integrations/supabase/client"; diff --git a/supabase_types.ts b/supabase_types.ts index fd42686e..d33e1a53 100644 --- a/supabase_types.ts +++ b/supabase_types.ts @@ -1 +1,16 @@ -{"_tag":"Error","error":{"code":"LegacyPlatformAuthRequiredError","message":"Access token not provided. Supply an access token by running `supabase login` or setting the SUPABASE_ACCESS_TOKEN environment variable."}} +export type Database = { + public: { + Tables: { + // Add your table definitions here + }; + Views: { + // Add your view definitions here + }; + Functions: { + // Add your function definitions here + }; + Enums: { + // Add your enum definitions here + }; + }; +}; diff --git a/tailwind.config.ts b/tailwind.config.ts index 8bc0aa2a..48c2753a 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type, no-unsafe-finally, @typescript-eslint/no-unused-expressions, @typescript-eslint/ban-ts-comment, @typescript-eslint/no-require-imports */ + import type { Config } from "tailwindcss"; export default {