fix(edge-fn): use user.id instead of claims.sub; fixes 500s and false cert_required fix(migrations): drop broad reservations SELECT policy; add reservation_slots view with security_invoker=false fix(tests): correct weekSlot() keys from start/end to start_time/end_time fix(tests): spread overlap test slots across separate ISO weeks fix(tests): update e2e assertion to match actual authenticated home text fix(app): hide IonMenu before user is authenticated feat(dx): add test:all script running unit, integration, and e2e in sequence docs(claude-md): document SELinux fix, Edge Function auth pattern, security_invoker behaviour
400 lines
11 KiB
TypeScript
400 lines
11 KiB
TypeScript
export type Json =
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null
|
|
| { [key: string]: Json | undefined }
|
|
| Json[]
|
|
|
|
// Domain types
|
|
export type MemberRole = 'member' | 'skipper' | 'admin' | 'boatswain' | 'volunteer' | 'instructor'
|
|
export type ReservationStatus = 'pending' | 'tentative' | 'confirmed'
|
|
export interface Defect {
|
|
type: string
|
|
severity: string
|
|
description: string
|
|
detail?: string
|
|
}
|
|
// time_tuples shape: [[startHHMM, endHHMM], ...] e.g. [["08:00","12:00"]]
|
|
export type TimeTuple = [string, string]
|
|
|
|
export type Database = {
|
|
__InternalSupabase: {
|
|
PostgrestVersion: "14.4"
|
|
}
|
|
public: {
|
|
Tables: {
|
|
boats: {
|
|
Row: {
|
|
id: string
|
|
name: string
|
|
display_name: string | null
|
|
class: string | null
|
|
year: number | null
|
|
img_src: string | null
|
|
icon_src: string | null
|
|
booking_available: boolean
|
|
required_certs: string[]
|
|
max_passengers: number
|
|
defects: Defect[]
|
|
created_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
name: string
|
|
display_name?: string | null
|
|
class?: string | null
|
|
year?: number | null
|
|
img_src?: string | null
|
|
icon_src?: string | null
|
|
booking_available?: boolean
|
|
required_certs?: string[]
|
|
max_passengers?: number
|
|
defects?: Defect[]
|
|
created_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
name?: string
|
|
display_name?: string | null
|
|
class?: string | null
|
|
year?: number | null
|
|
img_src?: string | null
|
|
icon_src?: string | null
|
|
booking_available?: boolean
|
|
required_certs?: string[]
|
|
max_passengers?: number
|
|
defects?: Defect[]
|
|
created_at?: string
|
|
}
|
|
}
|
|
members: {
|
|
Row: {
|
|
id: string
|
|
user_id: string
|
|
first_name: string
|
|
last_name: string
|
|
email: string
|
|
slack_id: string | null
|
|
certifications: string[]
|
|
role: MemberRole
|
|
created_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
user_id: string
|
|
first_name?: string
|
|
last_name?: string
|
|
email: string
|
|
slack_id?: string | null
|
|
certifications?: string[]
|
|
role?: MemberRole
|
|
created_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
user_id?: string
|
|
first_name?: string
|
|
last_name?: string
|
|
email?: string
|
|
slack_id?: string | null
|
|
certifications?: string[]
|
|
role?: MemberRole
|
|
created_at?: string
|
|
}
|
|
}
|
|
interval_templates: {
|
|
Row: {
|
|
id: string
|
|
name: string
|
|
time_tuples: TimeTuple[]
|
|
created_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
name: string
|
|
time_tuples?: TimeTuple[]
|
|
created_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
name?: string
|
|
time_tuples?: TimeTuple[]
|
|
created_at?: string
|
|
}
|
|
}
|
|
intervals: {
|
|
Row: {
|
|
id: string
|
|
boat_id: string
|
|
start_time: string
|
|
end_time: string
|
|
user_id: string | null
|
|
created_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
boat_id: string
|
|
start_time: string
|
|
end_time: string
|
|
user_id?: string | null
|
|
created_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
boat_id?: string
|
|
start_time?: string
|
|
end_time?: string
|
|
user_id?: string | null
|
|
created_at?: string
|
|
}
|
|
}
|
|
reservations: {
|
|
Row: {
|
|
id: string
|
|
boat_id: string
|
|
user_id: string
|
|
start_time: string
|
|
end_time: string
|
|
status: ReservationStatus
|
|
reason: string
|
|
comment: string
|
|
member_ids: string[]
|
|
guest_ids: string[]
|
|
created_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
boat_id: string
|
|
user_id: string
|
|
start_time: string
|
|
end_time: string
|
|
status?: ReservationStatus
|
|
reason?: string
|
|
comment?: string
|
|
member_ids?: string[]
|
|
guest_ids?: string[]
|
|
created_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
boat_id?: string
|
|
user_id?: string
|
|
start_time?: string
|
|
end_time?: string
|
|
status?: ReservationStatus
|
|
reason?: string
|
|
comment?: string
|
|
member_ids?: string[]
|
|
guest_ids?: string[]
|
|
created_at?: string
|
|
}
|
|
}
|
|
booking_config: {
|
|
Row: {
|
|
key: string
|
|
value: Json
|
|
description: string | null
|
|
}
|
|
Insert: {
|
|
key: string
|
|
value: Json
|
|
description?: string | null
|
|
}
|
|
Update: {
|
|
key?: string
|
|
value?: Json
|
|
description?: string | null
|
|
}
|
|
}
|
|
holidays: {
|
|
Row: {
|
|
date: string
|
|
name: string
|
|
}
|
|
Insert: {
|
|
date: string
|
|
name: string
|
|
}
|
|
Update: {
|
|
date?: string
|
|
name?: string
|
|
}
|
|
}
|
|
reference_docs: {
|
|
Row: {
|
|
id: string
|
|
title: string
|
|
category: string
|
|
tags: string[]
|
|
subtitle: string | null
|
|
content: string
|
|
created_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
title: string
|
|
category: string
|
|
tags?: string[]
|
|
subtitle?: string | null
|
|
content: string
|
|
created_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
title?: string
|
|
category?: string
|
|
tags?: string[]
|
|
subtitle?: string | null
|
|
content?: string
|
|
created_at?: string
|
|
}
|
|
}
|
|
}
|
|
Views: {
|
|
reservation_slots: {
|
|
Row: {
|
|
id: string
|
|
boat_id: string
|
|
start_time: string
|
|
end_time: string
|
|
status: ReservationStatus
|
|
}
|
|
}
|
|
}
|
|
Functions: {
|
|
[_ in never]: never
|
|
}
|
|
Enums: {
|
|
member_role: MemberRole
|
|
reservation_status: ReservationStatus
|
|
}
|
|
CompositeTypes: {
|
|
[_ in never]: never
|
|
}
|
|
}
|
|
}
|
|
|
|
type DatabaseWithoutInternals = Omit<Database, "__InternalSupabase">
|
|
|
|
type DefaultSchema = DatabaseWithoutInternals[Extract<keyof Database, "public">]
|
|
|
|
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
|