Refactor versioning utility functions

This commit is contained in:
gpt-engineer-app[bot]
2025-10-15 17:47:14 +00:00
parent 4e7d528c64
commit 96a5d235e9
11 changed files with 1251 additions and 140 deletions

View File

@@ -331,6 +331,102 @@ export type Database = {
},
]
}
company_versions: {
Row: {
banner_image_id: string | null
banner_image_url: string | null
card_image_id: string | null
card_image_url: string | null
change_reason: string | null
change_type: Database["public"]["Enums"]["version_change_type"]
company_id: string
company_type: string
created_at: string
created_by: string | null
description: string | null
founded_date: string | null
founded_date_precision: string | null
founded_year: number | null
headquarters_location: string | null
is_current: boolean
logo_url: string | null
name: string
person_type: string | null
slug: string
submission_id: string | null
version_id: string
version_number: number
website_url: string | null
}
Insert: {
banner_image_id?: string | null
banner_image_url?: string | null
card_image_id?: string | null
card_image_url?: string | null
change_reason?: string | null
change_type?: Database["public"]["Enums"]["version_change_type"]
company_id: string
company_type: string
created_at?: string
created_by?: string | null
description?: string | null
founded_date?: string | null
founded_date_precision?: string | null
founded_year?: number | null
headquarters_location?: string | null
is_current?: boolean
logo_url?: string | null
name: string
person_type?: string | null
slug: string
submission_id?: string | null
version_id?: string
version_number: number
website_url?: string | null
}
Update: {
banner_image_id?: string | null
banner_image_url?: string | null
card_image_id?: string | null
card_image_url?: string | null
change_reason?: string | null
change_type?: Database["public"]["Enums"]["version_change_type"]
company_id?: string
company_type?: string
created_at?: string
created_by?: string | null
description?: string | null
founded_date?: string | null
founded_date_precision?: string | null
founded_year?: number | null
headquarters_location?: string | null
is_current?: boolean
logo_url?: string | null
name?: string
person_type?: string | null
slug?: string
submission_id?: string | null
version_id?: string
version_number?: number
website_url?: string | null
}
Relationships: [
{
foreignKeyName: "company_versions_company_id_fkey"
columns: ["company_id"]
isOneToOne: false
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "company_versions_submission_id_fkey"
columns: ["submission_id"]
isOneToOne: false
referencedRelation: "content_submissions"
referencedColumns: ["id"]
},
]
}
content_submissions: {
Row: {
approval_mode: string | null
@@ -1106,6 +1202,135 @@ export type Database = {
},
]
}
park_versions: {
Row: {
banner_image_id: string | null
banner_image_url: string | null
card_image_id: string | null
card_image_url: string | null
change_reason: string | null
change_type: Database["public"]["Enums"]["version_change_type"]
closing_date: string | null
closing_date_precision: string | null
created_at: string
created_by: string | null
description: string | null
email: string | null
is_current: boolean
location_id: string | null
name: string
opening_date: string | null
opening_date_precision: string | null
operator_id: string | null
park_id: string
park_type: string
phone: string | null
property_owner_id: string | null
slug: string
status: string
submission_id: string | null
version_id: string
version_number: number
website_url: string | null
}
Insert: {
banner_image_id?: string | null
banner_image_url?: string | null
card_image_id?: string | null
card_image_url?: string | null
change_reason?: string | null
change_type?: Database["public"]["Enums"]["version_change_type"]
closing_date?: string | null
closing_date_precision?: string | null
created_at?: string
created_by?: string | null
description?: string | null
email?: string | null
is_current?: boolean
location_id?: string | null
name: string
opening_date?: string | null
opening_date_precision?: string | null
operator_id?: string | null
park_id: string
park_type: string
phone?: string | null
property_owner_id?: string | null
slug: string
status: string
submission_id?: string | null
version_id?: string
version_number: number
website_url?: string | null
}
Update: {
banner_image_id?: string | null
banner_image_url?: string | null
card_image_id?: string | null
card_image_url?: string | null
change_reason?: string | null
change_type?: Database["public"]["Enums"]["version_change_type"]
closing_date?: string | null
closing_date_precision?: string | null
created_at?: string
created_by?: string | null
description?: string | null
email?: string | null
is_current?: boolean
location_id?: string | null
name?: string
opening_date?: string | null
opening_date_precision?: string | null
operator_id?: string | null
park_id?: string
park_type?: string
phone?: string | null
property_owner_id?: string | null
slug?: string
status?: string
submission_id?: string | null
version_id?: string
version_number?: number
website_url?: string | null
}
Relationships: [
{
foreignKeyName: "park_versions_location_id_fkey"
columns: ["location_id"]
isOneToOne: false
referencedRelation: "locations"
referencedColumns: ["id"]
},
{
foreignKeyName: "park_versions_operator_id_fkey"
columns: ["operator_id"]
isOneToOne: false
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "park_versions_park_id_fkey"
columns: ["park_id"]
isOneToOne: false
referencedRelation: "parks"
referencedColumns: ["id"]
},
{
foreignKeyName: "park_versions_property_owner_id_fkey"
columns: ["property_owner_id"]
isOneToOne: false
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "park_versions_submission_id_fkey"
columns: ["submission_id"]
isOneToOne: false
referencedRelation: "content_submissions"
referencedColumns: ["id"]
},
]
}
parks: {
Row: {
average_rating: number | null
@@ -1874,6 +2099,82 @@ export type Database = {
},
]
}
ride_model_versions: {
Row: {
category: string
change_reason: string | null
change_type: Database["public"]["Enums"]["version_change_type"]
created_at: string
created_by: string | null
description: string | null
is_current: boolean
manufacturer_id: string | null
name: string
ride_model_id: string
slug: string
submission_id: string | null
technical_specs: Json | null
version_id: string
version_number: number
}
Insert: {
category: string
change_reason?: string | null
change_type?: Database["public"]["Enums"]["version_change_type"]
created_at?: string
created_by?: string | null
description?: string | null
is_current?: boolean
manufacturer_id?: string | null
name: string
ride_model_id: string
slug: string
submission_id?: string | null
technical_specs?: Json | null
version_id?: string
version_number: number
}
Update: {
category?: string
change_reason?: string | null
change_type?: Database["public"]["Enums"]["version_change_type"]
created_at?: string
created_by?: string | null
description?: string | null
is_current?: boolean
manufacturer_id?: string | null
name?: string
ride_model_id?: string
slug?: string
submission_id?: string | null
technical_specs?: Json | null
version_id?: string
version_number?: number
}
Relationships: [
{
foreignKeyName: "ride_model_versions_manufacturer_id_fkey"
columns: ["manufacturer_id"]
isOneToOne: false
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "ride_model_versions_ride_model_id_fkey"
columns: ["ride_model_id"]
isOneToOne: false
referencedRelation: "ride_models"
referencedColumns: ["id"]
},
{
foreignKeyName: "ride_model_versions_submission_id_fkey"
columns: ["submission_id"]
isOneToOne: false
referencedRelation: "content_submissions"
referencedColumns: ["id"]
},
]
}
ride_models: {
Row: {
banner_image_id: string | null
@@ -2269,6 +2570,162 @@ export type Database = {
},
]
}
ride_versions: {
Row: {
angle_degrees: number | null
banner_image_id: string | null
banner_image_url: string | null
capacity_per_hour: number | null
card_image_id: string | null
card_image_url: string | null
category: string
change_reason: string | null
change_type: Database["public"]["Enums"]["version_change_type"]
closing_date: string | null
closing_date_precision: string | null
created_at: string
created_by: string | null
description: string | null
designer_id: string | null
drop_meters: number | null
duration_seconds: number | null
former_names: Json | null
gforce_max: number | null
height_meters: number | null
height_requirement_cm: number | null
inversions_count: number | null
is_current: boolean
length_meters: number | null
manufacturer_id: string | null
max_speed_kmh: number | null
name: string
opening_date: string | null
opening_date_precision: string | null
park_id: string | null
ride_id: string
ride_model_id: string | null
slug: string
status: string
submission_id: string | null
version_id: string
version_number: number
}
Insert: {
angle_degrees?: number | null
banner_image_id?: string | null
banner_image_url?: string | null
capacity_per_hour?: number | null
card_image_id?: string | null
card_image_url?: string | null
category: string
change_reason?: string | null
change_type?: Database["public"]["Enums"]["version_change_type"]
closing_date?: string | null
closing_date_precision?: string | null
created_at?: string
created_by?: string | null
description?: string | null
designer_id?: string | null
drop_meters?: number | null
duration_seconds?: number | null
former_names?: Json | null
gforce_max?: number | null
height_meters?: number | null
height_requirement_cm?: number | null
inversions_count?: number | null
is_current?: boolean
length_meters?: number | null
manufacturer_id?: string | null
max_speed_kmh?: number | null
name: string
opening_date?: string | null
opening_date_precision?: string | null
park_id?: string | null
ride_id: string
ride_model_id?: string | null
slug: string
status: string
submission_id?: string | null
version_id?: string
version_number: number
}
Update: {
angle_degrees?: number | null
banner_image_id?: string | null
banner_image_url?: string | null
capacity_per_hour?: number | null
card_image_id?: string | null
card_image_url?: string | null
category?: string
change_reason?: string | null
change_type?: Database["public"]["Enums"]["version_change_type"]
closing_date?: string | null
closing_date_precision?: string | null
created_at?: string
created_by?: string | null
description?: string | null
designer_id?: string | null
drop_meters?: number | null
duration_seconds?: number | null
former_names?: Json | null
gforce_max?: number | null
height_meters?: number | null
height_requirement_cm?: number | null
inversions_count?: number | null
is_current?: boolean
length_meters?: number | null
manufacturer_id?: string | null
max_speed_kmh?: number | null
name?: string
opening_date?: string | null
opening_date_precision?: string | null
park_id?: string | null
ride_id?: string
ride_model_id?: string | null
slug?: string
status?: string
submission_id?: string | null
version_id?: string
version_number?: number
}
Relationships: [
{
foreignKeyName: "ride_versions_designer_id_fkey"
columns: ["designer_id"]
isOneToOne: false
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "ride_versions_manufacturer_id_fkey"
columns: ["manufacturer_id"]
isOneToOne: false
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "ride_versions_park_id_fkey"
columns: ["park_id"]
isOneToOne: false
referencedRelation: "parks"
referencedColumns: ["id"]
},
{
foreignKeyName: "ride_versions_ride_id_fkey"
columns: ["ride_id"]
isOneToOne: false
referencedRelation: "rides"
referencedColumns: ["id"]
},
{
foreignKeyName: "ride_versions_submission_id_fkey"
columns: ["submission_id"]
isOneToOne: false
referencedRelation: "content_submissions"
referencedColumns: ["id"]
},
]
}
rides: {
Row: {
age_requirement: number | null
@@ -2992,6 +3449,10 @@ export type Database = {
Args: Record<PropertyKey, never>
Returns: undefined
}
cleanup_old_versions: {
Args: { entity_type: string; keep_versions?: number }
Returns: number
}
cleanup_rate_limits: {
Args: Record<PropertyKey, never>
Returns: undefined
@@ -3065,6 +3526,14 @@ export type Database = {
Args: { _user_id: string }
Returns: Json
}
get_version_diff: {
Args: {
p_entity_type: string
p_from_version_id: string
p_to_version_id: string
}
Returns: Json
}
has_aal2: {
Args: Record<PropertyKey, never>
Returns: boolean