32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import type { Database } from '@/utils/supabase/types';
|
|
export type { User } from '@supabase/supabase-js';
|
|
|
|
// Result type for API calls
|
|
export type Result<T> =
|
|
| { success: true; data: T }
|
|
| { success: false; error: string };
|
|
|
|
// Table row types
|
|
export type Profile = Database['public']['Tables']['profiles']['Row'];
|
|
export type Status = Database['public']['Tables']['statuses']['Row'];
|
|
|
|
// Insert types
|
|
export type ProfileInsert = Database['public']['Tables']['profiles']['Insert'];
|
|
export type StatusInsert = Database['public']['Tables']['statuses']['Insert'];
|
|
|
|
// Update types
|
|
export type ProfileUpdate = Database['public']['Tables']['profiles']['Update'];
|
|
export type StatusUpdate = Database['public']['Tables']['statuses']['Update'];
|
|
|
|
// Generic helper to get any table's row type
|
|
export type TableRow<T extends keyof Database['public']['Tables']> =
|
|
Database['public']['Tables'][T]['Row'];
|
|
|
|
// Generic helper to get any table's insert type
|
|
export type TableInsert<T extends keyof Database['public']['Tables']> =
|
|
Database['public']['Tables'][T]['Insert'];
|
|
|
|
// Generic helper to get any table's update type
|
|
export type TableUpdate<T extends keyof Database['public']['Tables']> =
|
|
Database['public']['Tables'][T]['Update'];
|