xtablo-source/api/src/database.types.ts

638 lines
18 KiB
TypeScript
Raw Normal View History

2025-10-17 21:03:51 +00:00
export type Json =
| string
| number
| boolean
| null
| { [key: string]: Json | undefined }
| Json[]
2025-07-01 20:28:49 +00:00
export type Database = {
2025-09-09 20:49:02 +00:00
// Allows to automatically instantiate createClient with right options
2025-07-16 20:28:20 +00:00
// instead of createClient<Database, { PostgrestVersion: 'XX' }>(URL, KEY)
__InternalSupabase: {
2025-10-17 21:03:51 +00:00
PostgrestVersion: "13.0.4"
}
2025-07-01 20:28:49 +00:00
public: {
Tables: {
2025-09-09 20:49:02 +00:00
availabilities: {
Row: {
2025-10-17 21:03:51 +00:00
availability_data: Json
created_at: string
exceptions: Json | null
id: number
updated_at: string
user_id: string
}
2025-09-09 20:49:02 +00:00
Insert: {
2025-10-17 21:03:51 +00:00
availability_data?: Json
created_at?: string
exceptions?: Json | null
id?: number
updated_at?: string
user_id: string
}
2025-09-09 20:49:02 +00:00
Update: {
2025-10-17 21:03:51 +00:00
availability_data?: Json
created_at?: string
exceptions?: Json | null
id?: number
updated_at?: string
user_id?: string
}
Relationships: []
}
2025-09-09 20:49:02 +00:00
calendar_subscriptions: {
Row: {
2025-10-17 21:03:51 +00:00
created_at: string | null
id: string
tablo_id: string
token: string
}
2025-09-09 20:49:02 +00:00
Insert: {
2025-10-17 21:03:51 +00:00
created_at?: string | null
id?: string
tablo_id: string
token: string
}
2025-09-09 20:49:02 +00:00
Update: {
2025-10-17 21:03:51 +00:00
created_at?: string | null
id?: string
tablo_id?: string
token?: string
}
2025-09-09 20:49:02 +00:00
Relationships: [
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "calendar_subscriptions_tablo_id_fkey"
columns: ["tablo_id"]
isOneToOne: true
referencedRelation: "events_and_tablos"
referencedColumns: ["tablo_id"]
2025-09-09 20:49:02 +00:00
},
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "calendar_subscriptions_tablo_id_fkey"
columns: ["tablo_id"]
isOneToOne: true
referencedRelation: "tablos"
referencedColumns: ["id"]
2025-09-09 20:49:02 +00:00
},
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "calendar_subscriptions_tablo_id_fkey"
columns: ["tablo_id"]
isOneToOne: true
referencedRelation: "user_tablos"
referencedColumns: ["id"]
2025-10-10 06:21:56 +00:00
},
2025-10-17 21:03:51 +00:00
]
}
2025-07-01 20:28:49 +00:00
devis: {
Row: {
2025-10-17 21:03:51 +00:00
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
}
2025-07-01 20:28:49 +00:00
Insert: {
2025-10-17 21:03:51 +00:00
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
}
2025-07-01 20:28:49 +00:00
Update: {
2025-10-17 21:03:51 +00:00
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: {
2025-10-17 21:03:51 +00:00
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: {
2025-10-17 21:03:51 +00:00
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: {
2025-10-17 21:03:51 +00:00
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: []
}
2025-07-06 20:41:02 +00:00
events: {
Row: {
2025-10-17 21:03:51 +00:00
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
}
2025-07-06 20:41:02 +00:00
Insert: {
2025-10-17 21:03:51 +00:00
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
}
2025-07-06 20:41:02 +00:00
Update: {
2025-10-17 21:03:51 +00:00
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
}
2025-07-06 20:41:02 +00:00
Relationships: [
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_events_tablo_id"
columns: ["tablo_id"]
isOneToOne: false
referencedRelation: "events_and_tablos"
referencedColumns: ["tablo_id"]
2025-07-06 20:41:02 +00:00
},
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_events_tablo_id"
columns: ["tablo_id"]
isOneToOne: false
referencedRelation: "tablos"
referencedColumns: ["id"]
2025-07-06 20:41:02 +00:00
},
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_events_tablo_id"
columns: ["tablo_id"]
isOneToOne: false
referencedRelation: "user_tablos"
referencedColumns: ["id"]
2025-10-10 06:21:56 +00:00
},
2025-10-17 21:03:51 +00:00
]
}
2025-07-01 20:28:49 +00:00
feedbacks: {
Row: {
2025-10-17 21:03:51 +00:00
created_at: string | null
fd_type: string
id: number
message: string
user_id: string
}
2025-07-01 20:28:49 +00:00
Insert: {
2025-10-17 21:03:51 +00:00
created_at?: string | null
fd_type: string
id?: number
message: string
user_id: string
}
2025-07-01 20:28:49 +00:00
Update: {
2025-10-17 21:03:51 +00:00
created_at?: string | null
fd_type?: string
id?: number
message?: string
user_id?: string
}
Relationships: []
}
2025-07-01 20:28:49 +00:00
profiles: {
Row: {
2025-10-17 21:03:51 +00:00
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
}
2025-07-01 20:28:49 +00:00
Insert: {
2025-10-17 21:03:51 +00:00
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
}
2025-07-01 20:28:49 +00:00
Update: {
2025-10-17 21:03:51 +00:00
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: {
2025-10-17 21:03:51 +00:00
created_at: string | null
granted_by: string
id: number
is_active: boolean | null
is_admin: boolean | null
tablo_id: string
user_id: string
}
Insert: {
2025-10-17 21:03:51 +00:00
created_at?: string | null
granted_by: string
id?: number
is_active?: boolean | null
is_admin?: boolean | null
tablo_id: string
user_id: string
}
Update: {
2025-10-17 21:03:51 +00:00
created_at?: string | null
granted_by?: string
id?: number
is_active?: boolean | null
is_admin?: boolean | null
tablo_id?: string
user_id?: string
}
Relationships: [
2025-07-06 20:41:02 +00:00
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_tablo_access_tablo_id"
columns: ["tablo_id"]
isOneToOne: false
referencedRelation: "events_and_tablos"
referencedColumns: ["tablo_id"]
2025-07-06 20:41:02 +00:00
},
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_tablo_access_tablo_id"
columns: ["tablo_id"]
isOneToOne: false
referencedRelation: "tablos"
referencedColumns: ["id"]
},
2025-07-05 17:01:41 +00:00
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_tablo_access_tablo_id"
columns: ["tablo_id"]
isOneToOne: false
referencedRelation: "user_tablos"
referencedColumns: ["id"]
2025-07-05 17:01:41 +00:00
},
2025-07-06 19:46:18 +00:00
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_tablo_access_user_id_from_profiles"
columns: ["user_id"]
isOneToOne: false
referencedRelation: "profiles"
referencedColumns: ["id"]
2025-10-10 06:21:56 +00:00
},
2025-10-17 21:03:51 +00:00
]
}
2025-07-03 19:42:49 +00:00
tablo_invites: {
2025-07-01 20:28:49 +00:00
Row: {
2025-10-17 21:03:51 +00:00
id: number
invite_token: string
invited_by: string
invited_email: string
tablo_id: string
}
2025-07-01 20:28:49 +00:00
Insert: {
2025-10-17 21:03:51 +00:00
id?: number
invite_token: string
invited_by: string
invited_email: string
tablo_id: string
}
2025-07-01 20:28:49 +00:00
Update: {
2025-10-17 21:03:51 +00:00
id?: number
invite_token?: string
invited_by?: string
invited_email?: string
tablo_id?: string
}
2025-07-01 20:28:49 +00:00
Relationships: [
2025-07-06 20:41:02 +00:00
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_tablo_invitations_tablo_id"
columns: ["tablo_id"]
isOneToOne: false
referencedRelation: "events_and_tablos"
referencedColumns: ["tablo_id"]
2025-07-06 20:41:02 +00:00
},
2025-07-01 20:28:49 +00:00
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_tablo_invitations_tablo_id"
columns: ["tablo_id"]
isOneToOne: false
referencedRelation: "tablos"
referencedColumns: ["id"]
},
2025-07-05 17:01:41 +00:00
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_tablo_invitations_tablo_id"
columns: ["tablo_id"]
isOneToOne: false
referencedRelation: "user_tablos"
referencedColumns: ["id"]
2025-10-10 06:21:56 +00:00
},
2025-10-17 21:03:51 +00:00
]
}
2025-07-01 20:28:49 +00:00
tablos: {
Row: {
2025-10-17 21:03:51 +00:00
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
}
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: []
}
user_introductions: {
Row: {
2025-10-18 08:55:49 +00:00
config: Json
2025-10-17 21:03:51 +00:00
created_at: string | null
updated_at: string | null
user_id: string
}
2025-07-01 20:28:49 +00:00
Insert: {
2025-10-18 08:55:49 +00:00
config?: Json
2025-10-17 21:03:51 +00:00
created_at?: string | null
updated_at?: string | null
user_id: string
}
2025-07-01 20:28:49 +00:00
Update: {
2025-10-18 08:55:49 +00:00
config?: Json
2025-10-17 21:03:51 +00:00
created_at?: string | null
updated_at?: string | null
user_id?: string
}
Relationships: []
}
}
2025-07-01 20:28:49 +00:00
Views: {
2025-07-06 20:41:02 +00:00
events_and_tablos: {
Row: {
2025-10-17 21:03:51 +00:00
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: []
}
2025-07-05 17:01:41 +00:00
user_tablos: {
Row: {
2025-10-17 21:03:51 +00:00
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
}
2025-07-06 19:46:18 +00:00
Relationships: [
{
2025-10-17 21:03:51 +00:00
foreignKeyName: "fk_tablo_access_user_id_from_profiles"
columns: ["user_id"]
isOneToOne: false
referencedRelation: "profiles"
referencedColumns: ["id"]
2025-10-10 06:21:56 +00:00
},
2025-10-17 21:03:51 +00:00
]
}
}
2025-07-01 20:28:49 +00:00
Functions: {
generate_random_string: {
2025-10-17 21:03:51 +00:00
Args: { length?: number }
Returns: string
}
}
2025-07-01 20:28:49 +00:00
Enums: {
2025-10-17 21:03:51 +00:00
devis_status: "draft" | "sent" | "accepted" | "rejected" | "expired"
}
2025-07-01 20:28:49 +00:00
CompositeTypes: {
2025-09-09 20:49:02 +00:00
time_range: {
2025-10-17 21:03:51 +00:00
start_time: string | null
end_time: string | null
}
}
}
}
2025-07-01 20:28:49 +00:00
2025-10-17 21:03:51 +00:00
type DatabaseWithoutInternals = Omit<Database, "__InternalSupabase">
2025-07-16 20:28:20 +00:00
2025-10-17 21:03:51 +00:00
type DefaultSchema = DatabaseWithoutInternals[Extract<keyof Database, "public">]
2025-07-01 20:28:49 +00:00
export type Tables<
DefaultSchemaTableNameOrOptions extends
| keyof (DefaultSchema["Tables"] & DefaultSchema["Views"])
2025-07-16 20:28:20 +00:00
| { schema: keyof DatabaseWithoutInternals },
2025-07-01 20:28:49 +00:00
TableName extends DefaultSchemaTableNameOrOptions extends {
2025-10-17 21:03:51 +00:00
schema: keyof DatabaseWithoutInternals
2025-07-01 20:28:49 +00:00
}
2025-07-16 20:28:20 +00:00
? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] &
DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])
2025-10-10 06:21:56 +00:00
: never = never,
2025-07-16 20:28:20 +00:00
> = DefaultSchemaTableNameOrOptions extends {
2025-10-17 21:03:51 +00:00
schema: keyof DatabaseWithoutInternals
2025-07-16 20:28:20 +00:00
}
? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] &
DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends {
2025-10-17 21:03:51 +00:00
Row: infer R
2025-07-01 20:28:49 +00:00
}
? R
: never
2025-10-17 21:03:51 +00:00
: DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] &
DefaultSchema["Views"])
? (DefaultSchema["Tables"] &
DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends {
Row: infer R
2025-10-10 06:21:56 +00:00
}
? R
: never
2025-10-17 21:03:51 +00:00
: never
2025-07-01 20:28:49 +00:00
export type TablesInsert<
DefaultSchemaTableNameOrOptions extends
| keyof DefaultSchema["Tables"]
2025-07-16 20:28:20 +00:00
| { schema: keyof DatabaseWithoutInternals },
2025-07-01 20:28:49 +00:00
TableName extends DefaultSchemaTableNameOrOptions extends {
2025-10-17 21:03:51 +00:00
schema: keyof DatabaseWithoutInternals
2025-07-01 20:28:49 +00:00
}
2025-07-16 20:28:20 +00:00
? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"]
2025-10-10 06:21:56 +00:00
: never = never,
2025-07-16 20:28:20 +00:00
> = DefaultSchemaTableNameOrOptions extends {
2025-10-17 21:03:51 +00:00
schema: keyof DatabaseWithoutInternals
2025-07-16 20:28:20 +00:00
}
? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
2025-10-17 21:03:51 +00:00
Insert: infer I
2025-07-01 20:28:49 +00:00
}
? I
: never
: DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"]
2025-10-10 06:21:56 +00:00
? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
2025-10-17 21:03:51 +00:00
Insert: infer I
2025-10-10 06:21:56 +00:00
}
? I
: never
2025-10-17 21:03:51 +00:00
: never
2025-07-01 20:28:49 +00:00
export type TablesUpdate<
DefaultSchemaTableNameOrOptions extends
| keyof DefaultSchema["Tables"]
2025-07-16 20:28:20 +00:00
| { schema: keyof DatabaseWithoutInternals },
2025-07-01 20:28:49 +00:00
TableName extends DefaultSchemaTableNameOrOptions extends {
2025-10-17 21:03:51 +00:00
schema: keyof DatabaseWithoutInternals
2025-07-01 20:28:49 +00:00
}
2025-07-16 20:28:20 +00:00
? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"]
2025-10-10 06:21:56 +00:00
: never = never,
2025-07-16 20:28:20 +00:00
> = DefaultSchemaTableNameOrOptions extends {
2025-10-17 21:03:51 +00:00
schema: keyof DatabaseWithoutInternals
2025-07-16 20:28:20 +00:00
}
? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
2025-10-17 21:03:51 +00:00
Update: infer U
2025-07-01 20:28:49 +00:00
}
? U
: never
: DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"]
2025-10-10 06:21:56 +00:00
? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
2025-10-17 21:03:51 +00:00
Update: infer U
2025-10-10 06:21:56 +00:00
}
? U
: never
2025-10-17 21:03:51 +00:00
: never
2025-07-01 20:28:49 +00:00
export type Enums<
DefaultSchemaEnumNameOrOptions extends
| keyof DefaultSchema["Enums"]
2025-07-16 20:28:20 +00:00
| { schema: keyof DatabaseWithoutInternals },
2025-07-01 20:28:49 +00:00
EnumName extends DefaultSchemaEnumNameOrOptions extends {
2025-10-17 21:03:51 +00:00
schema: keyof DatabaseWithoutInternals
2025-07-01 20:28:49 +00:00
}
2025-07-16 20:28:20 +00:00
? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"]
2025-10-10 06:21:56 +00:00
: never = never,
2025-07-16 20:28:20 +00:00
> = DefaultSchemaEnumNameOrOptions extends {
2025-10-17 21:03:51 +00:00
schema: keyof DatabaseWithoutInternals
2025-07-16 20:28:20 +00:00
}
? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName]
2025-07-01 20:28:49 +00:00
: DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"]
2025-10-10 06:21:56 +00:00
? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions]
2025-10-17 21:03:51 +00:00
: never
2025-07-01 20:28:49 +00:00
export type CompositeTypes<
PublicCompositeTypeNameOrOptions extends
| keyof DefaultSchema["CompositeTypes"]
2025-07-16 20:28:20 +00:00
| { schema: keyof DatabaseWithoutInternals },
2025-07-01 20:28:49 +00:00
CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
2025-10-17 21:03:51 +00:00
schema: keyof DatabaseWithoutInternals
2025-07-01 20:28:49 +00:00
}
2025-07-16 20:28:20 +00:00
? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"]
2025-10-10 06:21:56 +00:00
: never = never,
2025-07-16 20:28:20 +00:00
> = PublicCompositeTypeNameOrOptions extends {
2025-10-17 21:03:51 +00:00
schema: keyof DatabaseWithoutInternals
2025-07-16 20:28:20 +00:00
}
? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName]
2025-07-01 20:28:49 +00:00
: PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"]
2025-10-10 06:21:56 +00:00
? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions]
2025-10-17 21:03:51 +00:00
: never
2025-07-01 20:28:49 +00:00
export const Constants = {
public: {
Enums: {
devis_status: ["draft", "sent", "accepted", "rejected", "expired"],
},
},
2025-10-17 21:03:51 +00:00
} as const