From b6c5d1a6d32b6451364bbcecfc588300d1bc9c74 Mon Sep 17 00:00:00 2001 From: colinislit Date: Mon, 24 Nov 2025 14:37:36 +0100 Subject: [PATCH] fix: resolve build errors for Vercel deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TypeScript and ESLint fixes: - Fixed unescaped quotes in report-timeline.tsx (ESLint error) - Restored database.types.ts from git history (was empty) - Added reports table type definition to database.types.ts - Fixed missing getCookieHeader import in intakes/actions.ts - Fixed use-media-query.ts ternary operator (TypeScript error) - Simplified z.enum() in report.ts (removed unsupported error options) All type checking and linting now passes successfully. Build tested locally and ready for Vercel deployment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/epd/patients/[id]/intakes/actions.ts | 2 +- .../rapportage/components/report-timeline.tsx | 2 +- hooks/use-media-query.ts | 2 +- lib/supabase/database.types.ts | 1703 +++++++++++++++++ lib/types/report.ts | 4 +- 5 files changed, 1707 insertions(+), 6 deletions(-) diff --git a/app/epd/patients/[id]/intakes/actions.ts b/app/epd/patients/[id]/intakes/actions.ts index 183683b..88a2d5f 100644 --- a/app/epd/patients/[id]/intakes/actions.ts +++ b/app/epd/patients/[id]/intakes/actions.ts @@ -9,7 +9,7 @@ import { revalidatePath } from 'next/cache'; import { redirect } from 'next/navigation'; -import { authFetch, getBaseUrl } from '@/lib/server/api-client'; +import { authFetch, getBaseUrl, getCookieHeader } from '@/lib/server/api-client'; import type { Intake, CreateIntakeInput, diff --git a/app/epd/patients/[id]/rapportage/components/report-timeline.tsx b/app/epd/patients/[id]/rapportage/components/report-timeline.tsx index 3d312e1..1c7c136 100644 --- a/app/epd/patients/[id]/rapportage/components/report-timeline.tsx +++ b/app/epd/patients/[id]/rapportage/components/report-timeline.tsx @@ -63,7 +63,7 @@ export function ReportTimeline({

Nog geen rapportages

- Klik op "Nieuwe rapportage" in de header om de eerste rapportage vast te leggen. + Klik op “Nieuwe rapportage” in de header om de eerste rapportage vast te leggen.

); diff --git a/hooks/use-media-query.ts b/hooks/use-media-query.ts index 95dccaa..8ad0a7c 100644 --- a/hooks/use-media-query.ts +++ b/hooks/use-media-query.ts @@ -9,7 +9,7 @@ export function useMediaQuery(query: string) { if (typeof window === 'undefined') return; const mediaQuery = window.matchMedia(query); const handleChange = (event: MediaQueryListEvent | MediaQueryList) => { - setMatches('matches' in event ? event.matches : event.matches); + setMatches(event.matches); }; setMatches(mediaQuery.matches); diff --git a/lib/supabase/database.types.ts b/lib/supabase/database.types.ts index e69de29..c2b6e63 100644 --- a/lib/supabase/database.types.ts +++ b/lib/supabase/database.types.ts @@ -0,0 +1,1703 @@ +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: "13.0.5" + } + graphql_public: { + Tables: { + [_ in never]: never + } + Views: { + [_ in never]: never + } + Functions: { + graphql: { + Args: { + extensions?: Json + operationName?: string + query?: string + variables?: Json + } + Returns: Json + } + } + Enums: { + [_ in never]: never + } + CompositeTypes: { + [_ in never]: never + } + } + public: { + Tables: { + ai_events: { + Row: { + client_id: string | null + created_at: string + duration_ms: number + id: string + kind: string + note_id: string | null + request: Json + response: Json + } + Insert: { + client_id?: string | null + created_at?: string + duration_ms?: number + id?: string + kind: string + note_id?: string | null + request?: Json + response?: Json + } + Update: { + client_id?: string | null + created_at?: string + duration_ms?: number + id?: string + kind?: string + note_id?: string | null + request?: Json + response?: Json + } + Relationships: [ + { + foreignKeyName: "ai_events_client_id_fkey" + columns: ["client_id"] + isOneToOne: false + referencedRelation: "clients" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_events_note_id_fkey" + columns: ["note_id"] + isOneToOne: false + referencedRelation: "intake_notes" + referencedColumns: ["id"] + }, + ] + } + anamneses: { + Row: { + anamnese_date: string + anamnese_type: string + content: string + created_at: string | null + created_by: string | null + id: string + intake_id: string + notes: string | null + updated_at: string | null + } + Insert: { + anamnese_date?: string + anamnese_type: string + content: string + created_at?: string | null + created_by?: string | null + id?: string + intake_id: string + notes?: string | null + updated_at?: string | null + } + Update: { + anamnese_date?: string + anamnese_type?: string + content?: string + created_at?: string | null + created_by?: string | null + id?: string + intake_id?: string + notes?: string | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "anamneses_created_by_fkey" + columns: ["created_by"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + { + foreignKeyName: "anamneses_intake_id_fkey" + columns: ["intake_id"] + isOneToOne: false + referencedRelation: "active_intakes_overview" + referencedColumns: ["id"] + }, + { + foreignKeyName: "anamneses_intake_id_fkey" + columns: ["intake_id"] + isOneToOne: false + referencedRelation: "intakes" + referencedColumns: ["id"] + }, + ] + } + care_plans: { + Row: { + activities: Json | null + addresses_condition_ids: string[] | null + author_id: string | null + based_on_anamneses: string[] | null + based_on_examinations: string[] | null + based_on_intake_id: string | null + based_on_risk_assessments: string[] | null + care_team_ids: string[] | null + category_code: string | null + category_display: string | null + contributor_ids: string[] | null + created_at: string | null + created_date: string | null + description: string | null + encounter_id: string | null + goals: Json | null + id: string + identifier: string | null + intent: string + note: string | null + patient_id: string + period_end: string | null + period_start: string | null + status: Database["public"]["Enums"]["careplan_status"] + title: string + updated_at: string | null + } + Insert: { + activities?: Json | null + addresses_condition_ids?: string[] | null + author_id?: string | null + based_on_anamneses?: string[] | null + based_on_examinations?: string[] | null + based_on_intake_id?: string | null + based_on_risk_assessments?: string[] | null + care_team_ids?: string[] | null + category_code?: string | null + category_display?: string | null + contributor_ids?: string[] | null + created_at?: string | null + created_date?: string | null + description?: string | null + encounter_id?: string | null + goals?: Json | null + id?: string + identifier?: string | null + intent?: string + note?: string | null + patient_id: string + period_end?: string | null + period_start?: string | null + status?: Database["public"]["Enums"]["careplan_status"] + title: string + updated_at?: string | null + } + Update: { + activities?: Json | null + addresses_condition_ids?: string[] | null + author_id?: string | null + based_on_anamneses?: string[] | null + based_on_examinations?: string[] | null + based_on_intake_id?: string | null + based_on_risk_assessments?: string[] | null + care_team_ids?: string[] | null + category_code?: string | null + category_display?: string | null + contributor_ids?: string[] | null + created_at?: string | null + created_date?: string | null + description?: string | null + encounter_id?: string | null + goals?: Json | null + id?: string + identifier?: string | null + intent?: string + note?: string | null + patient_id?: string + period_end?: string | null + period_start?: string | null + status?: Database["public"]["Enums"]["careplan_status"] + title?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "care_plans_author_id_fkey" + columns: ["author_id"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + { + foreignKeyName: "care_plans_based_on_intake_id_fkey" + columns: ["based_on_intake_id"] + isOneToOne: false + referencedRelation: "active_intakes_overview" + referencedColumns: ["id"] + }, + { + foreignKeyName: "care_plans_based_on_intake_id_fkey" + columns: ["based_on_intake_id"] + isOneToOne: false + referencedRelation: "intakes" + referencedColumns: ["id"] + }, + { + foreignKeyName: "care_plans_encounter_id_fkey" + columns: ["encounter_id"] + isOneToOne: false + referencedRelation: "encounters" + referencedColumns: ["id"] + }, + { + foreignKeyName: "care_plans_patient_id_fkey" + columns: ["patient_id"] + isOneToOne: false + referencedRelation: "patients" + referencedColumns: ["id"] + }, + ] + } + clients: { + Row: { + birth_date: string + created_at: string + first_name: string + id: string + last_name: string + updated_at: string + } + Insert: { + birth_date: string + created_at?: string + first_name: string + id?: string + last_name: string + updated_at?: string + } + Update: { + birth_date?: string + created_at?: string + first_name?: string + id?: string + last_name?: string + updated_at?: string + } + Relationships: [] + } + conditions: { + Row: { + abatement_age: number | null + abatement_datetime: string | null + asserter_id: string | null + body_site_code: string | null + body_site_display: string | null + category: string + clinical_status: Database["public"]["Enums"]["condition_clinical_status"] + code_code: string + code_display: string + code_system: string + created_at: string | null + encounter_id: string | null + id: string + identifier: string | null + note: string | null + onset_age: number | null + onset_datetime: string | null + patient_id: string + recorded_date: string + recorder_id: string | null + severity_code: string | null + severity_display: string | null + updated_at: string | null + verification_status: Database["public"]["Enums"]["condition_verification_status"] + } + Insert: { + abatement_age?: number | null + abatement_datetime?: string | null + asserter_id?: string | null + body_site_code?: string | null + body_site_display?: string | null + category?: string + clinical_status?: Database["public"]["Enums"]["condition_clinical_status"] + code_code: string + code_display: string + code_system?: string + created_at?: string | null + encounter_id?: string | null + id?: string + identifier?: string | null + note?: string | null + onset_age?: number | null + onset_datetime?: string | null + patient_id: string + recorded_date?: string + recorder_id?: string | null + severity_code?: string | null + severity_display?: string | null + updated_at?: string | null + verification_status?: Database["public"]["Enums"]["condition_verification_status"] + } + Update: { + abatement_age?: number | null + abatement_datetime?: string | null + asserter_id?: string | null + body_site_code?: string | null + body_site_display?: string | null + category?: string + clinical_status?: Database["public"]["Enums"]["condition_clinical_status"] + code_code?: string + code_display?: string + code_system?: string + created_at?: string | null + encounter_id?: string | null + id?: string + identifier?: string | null + note?: string | null + onset_age?: number | null + onset_datetime?: string | null + patient_id?: string + recorded_date?: string + recorder_id?: string | null + severity_code?: string | null + severity_display?: string | null + updated_at?: string | null + verification_status?: Database["public"]["Enums"]["condition_verification_status"] + } + Relationships: [ + { + foreignKeyName: "conditions_asserter_id_fkey" + columns: ["asserter_id"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + { + foreignKeyName: "conditions_encounter_id_fkey" + columns: ["encounter_id"] + isOneToOne: false + referencedRelation: "encounters" + referencedColumns: ["id"] + }, + { + foreignKeyName: "conditions_patient_id_fkey" + columns: ["patient_id"] + isOneToOne: false + referencedRelation: "patients" + referencedColumns: ["id"] + }, + { + foreignKeyName: "conditions_recorder_id_fkey" + columns: ["recorder_id"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + ] + } + demo_users: { + Row: { + access_level: string + created_at: string + expires_at: string | null + id: string + last_login_at: string | null + notes: string | null + updated_at: string + usage_count: number | null + user_id: string | null + } + Insert: { + access_level?: string + created_at?: string + expires_at?: string | null + id?: string + last_login_at?: string | null + notes?: string | null + updated_at?: string + usage_count?: number | null + user_id?: string | null + } + Update: { + access_level?: string + created_at?: string + expires_at?: string | null + id?: string + last_login_at?: string | null + notes?: string | null + updated_at?: string + usage_count?: number | null + user_id?: string | null + } + Relationships: [] + } + encounters: { + Row: { + admission_source: string | null + class_code: string + class_display: string + created_at: string | null + discharge_disposition: string | null + id: string + identifier: string | null + intake_id: string | null + intake_note_id: string | null + notes: string | null + organization_id: string | null + patient_id: string + period_end: string | null + period_start: string + practitioner_id: string | null + priority_code: string | null + priority_display: string | null + reason_code: string[] | null + reason_display: string[] | null + status: Database["public"]["Enums"]["encounter_status"] + type_code: string + type_display: string + updated_at: string | null + } + Insert: { + admission_source?: string | null + class_code: string + class_display: string + created_at?: string | null + discharge_disposition?: string | null + id?: string + identifier?: string | null + intake_id?: string | null + intake_note_id?: string | null + notes?: string | null + organization_id?: string | null + patient_id: string + period_end?: string | null + period_start: string + practitioner_id?: string | null + priority_code?: string | null + priority_display?: string | null + reason_code?: string[] | null + reason_display?: string[] | null + status?: Database["public"]["Enums"]["encounter_status"] + type_code: string + type_display: string + updated_at?: string | null + } + Update: { + admission_source?: string | null + class_code?: string + class_display?: string + created_at?: string | null + discharge_disposition?: string | null + id?: string + identifier?: string | null + intake_id?: string | null + intake_note_id?: string | null + notes?: string | null + organization_id?: string | null + patient_id?: string + period_end?: string | null + period_start?: string + practitioner_id?: string | null + priority_code?: string | null + priority_display?: string | null + reason_code?: string[] | null + reason_display?: string[] | null + status?: Database["public"]["Enums"]["encounter_status"] + type_code?: string + type_display?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "encounters_intake_id_fkey" + columns: ["intake_id"] + isOneToOne: false + referencedRelation: "active_intakes_overview" + referencedColumns: ["id"] + }, + { + foreignKeyName: "encounters_intake_id_fkey" + columns: ["intake_id"] + isOneToOne: false + referencedRelation: "intakes" + referencedColumns: ["id"] + }, + { + foreignKeyName: "encounters_intake_note_id_fkey" + columns: ["intake_note_id"] + isOneToOne: false + referencedRelation: "intake_notes" + referencedColumns: ["id"] + }, + { + foreignKeyName: "encounters_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "encounters_patient_id_fkey" + columns: ["patient_id"] + isOneToOne: false + referencedRelation: "patients" + referencedColumns: ["id"] + }, + { + foreignKeyName: "encounters_practitioner_id_fkey" + columns: ["practitioner_id"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + ] + } + examinations: { + Row: { + created_at: string | null + created_by: string | null + document_url: string | null + examination_date: string + examination_type: string + findings: string + id: string + intake_id: string + notes: string | null + performed_by: string | null + reason: string | null + updated_at: string | null + } + Insert: { + created_at?: string | null + created_by?: string | null + document_url?: string | null + examination_date?: string + examination_type: string + findings: string + id?: string + intake_id: string + notes?: string | null + performed_by?: string | null + reason?: string | null + updated_at?: string | null + } + Update: { + created_at?: string | null + created_by?: string | null + document_url?: string | null + examination_date?: string + examination_type?: string + findings?: string + id?: string + intake_id?: string + notes?: string | null + performed_by?: string | null + reason?: string | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "examinations_created_by_fkey" + columns: ["created_by"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + { + foreignKeyName: "examinations_intake_id_fkey" + columns: ["intake_id"] + isOneToOne: false + referencedRelation: "active_intakes_overview" + referencedColumns: ["id"] + }, + { + foreignKeyName: "examinations_intake_id_fkey" + columns: ["intake_id"] + isOneToOne: false + referencedRelation: "intakes" + referencedColumns: ["id"] + }, + ] + } + intake_notes: { + Row: { + author: string | null + client_id: string + content_json: Json + content_text: string | null + created_at: string + id: string + tag: string | null + title: string | null + updated_at: string + } + Insert: { + author?: string | null + client_id: string + content_json?: Json + content_text?: string | null + created_at?: string + id?: string + tag?: string | null + title?: string | null + updated_at?: string + } + Update: { + author?: string | null + client_id?: string + content_json?: Json + content_text?: string | null + created_at?: string + id?: string + tag?: string | null + title?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "intake_notes_client_id_fkey" + columns: ["client_id"] + isOneToOne: false + referencedRelation: "clients" + referencedColumns: ["id"] + }, + ] + } + intakes: { + Row: { + created_at: string | null + department: string + end_date: string | null + id: string + kindcheck_data: Json | null + notes: string | null + patient_id: string + psychologist_id: string | null + start_date: string + status: string + title: string + treatment_advice: Json | null + updated_at: string | null + } + Insert: { + created_at?: string | null + department: string + end_date?: string | null + id?: string + kindcheck_data?: Json | null + notes?: string | null + patient_id: string + psychologist_id?: string | null + start_date?: string + status?: string + title: string + treatment_advice?: Json | null + updated_at?: string | null + } + Update: { + created_at?: string | null + department?: string + end_date?: string | null + id?: string + kindcheck_data?: Json | null + notes?: string | null + patient_id?: string + psychologist_id?: string | null + start_date?: string + status?: string + title?: string + treatment_advice?: Json | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "intakes_patient_id_fkey" + columns: ["patient_id"] + isOneToOne: false + referencedRelation: "patients" + referencedColumns: ["id"] + }, + { + foreignKeyName: "intakes_psychologist_id_fkey" + columns: ["psychologist_id"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + ] + } + observations: { + Row: { + body_site: string | null + category: string + code_code: string + code_display: string + code_system: string + created_at: string | null + effective_datetime: string + encounter_id: string | null + id: string + identifier: string | null + interpretation_code: string | null + interpretation_display: string | null + issued: string | null + method_code: string | null + method_display: string | null + note: string | null + patient_id: string + performer_id: string | null + reference_range_high: number | null + reference_range_low: number | null + reference_range_text: string | null + status: Database["public"]["Enums"]["observation_status"] + value_boolean: boolean | null + value_codeable_concept: Json | null + value_quantity_comparator: string | null + value_quantity_unit: string | null + value_quantity_value: number | null + value_string: string | null + value_type: string + } + Insert: { + body_site?: string | null + category: string + code_code: string + code_display: string + code_system: string + created_at?: string | null + effective_datetime: string + encounter_id?: string | null + id?: string + identifier?: string | null + interpretation_code?: string | null + interpretation_display?: string | null + issued?: string | null + method_code?: string | null + method_display?: string | null + note?: string | null + patient_id: string + performer_id?: string | null + reference_range_high?: number | null + reference_range_low?: number | null + reference_range_text?: string | null + status?: Database["public"]["Enums"]["observation_status"] + value_boolean?: boolean | null + value_codeable_concept?: Json | null + value_quantity_comparator?: string | null + value_quantity_unit?: string | null + value_quantity_value?: number | null + value_string?: string | null + value_type: string + } + Update: { + body_site?: string | null + category?: string + code_code?: string + code_display?: string + code_system?: string + created_at?: string | null + effective_datetime?: string + encounter_id?: string | null + id?: string + identifier?: string | null + interpretation_code?: string | null + interpretation_display?: string | null + issued?: string | null + method_code?: string | null + method_display?: string | null + note?: string | null + patient_id?: string + performer_id?: string | null + reference_range_high?: number | null + reference_range_low?: number | null + reference_range_text?: string | null + status?: Database["public"]["Enums"]["observation_status"] + value_boolean?: boolean | null + value_codeable_concept?: Json | null + value_quantity_comparator?: string | null + value_quantity_unit?: string | null + value_quantity_value?: number | null + value_string?: string | null + value_type?: string + } + Relationships: [ + { + foreignKeyName: "observations_encounter_id_fkey" + columns: ["encounter_id"] + isOneToOne: false + referencedRelation: "encounters" + referencedColumns: ["id"] + }, + { + foreignKeyName: "observations_patient_id_fkey" + columns: ["patient_id"] + isOneToOne: false + referencedRelation: "patients" + referencedColumns: ["id"] + }, + { + foreignKeyName: "observations_performer_id_fkey" + columns: ["performer_id"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + ] + } + organizations: { + Row: { + active: boolean | null + address_city: string | null + address_country: string | null + address_line: string[] | null + address_postal_code: string | null + alias: string[] | null + created_at: string | null + id: string + identifier_agb: string | null + identifier_kvk: string | null + name: string + telecom_email: string | null + telecom_phone: string | null + telecom_website: string | null + type_code: string | null + type_display: string | null + updated_at: string | null + } + Insert: { + active?: boolean | null + address_city?: string | null + address_country?: string | null + address_line?: string[] | null + address_postal_code?: string | null + alias?: string[] | null + created_at?: string | null + id?: string + identifier_agb?: string | null + identifier_kvk?: string | null + name: string + telecom_email?: string | null + telecom_phone?: string | null + telecom_website?: string | null + type_code?: string | null + type_display?: string | null + updated_at?: string | null + } + Update: { + active?: boolean | null + address_city?: string | null + address_country?: string | null + address_line?: string[] | null + address_postal_code?: string | null + alias?: string[] | null + created_at?: string | null + id?: string + identifier_agb?: string | null + identifier_kvk?: string | null + name?: string + telecom_email?: string | null + telecom_phone?: string | null + telecom_website?: string | null + type_code?: string | null + type_display?: string | null + updated_at?: string | null + } + Relationships: [] + } + patients: { + Row: { + active: boolean | null + address_city: string | null + address_country: string | null + address_line: string[] | null + address_postal_code: string | null + birth_date: string + created_at: string | null + emergency_contact_name: string | null + emergency_contact_phone: string | null + emergency_contact_relationship: string | null + gender: Database["public"]["Enums"]["gender_type"] + general_practitioner_agb: string | null + general_practitioner_name: string | null + id: string + identifier_bsn: string | null + identifier_client_number: string | null + insurance_company: string | null + insurance_number: string | null + is_john_doe: boolean | null + name_family: string + name_given: string[] + name_prefix: string | null + name_use: string | null + status: Database["public"]["Enums"]["episode_status"] | null + telecom_email: string | null + telecom_phone: string | null + updated_at: string | null + } + Insert: { + active?: boolean | null + address_city?: string | null + address_country?: string | null + address_line?: string[] | null + address_postal_code?: string | null + birth_date: string + created_at?: string | null + emergency_contact_name?: string | null + emergency_contact_phone?: string | null + emergency_contact_relationship?: string | null + gender: Database["public"]["Enums"]["gender_type"] + general_practitioner_agb?: string | null + general_practitioner_name?: string | null + id?: string + identifier_bsn?: string | null + identifier_client_number?: string | null + insurance_company?: string | null + insurance_number?: string | null + is_john_doe?: boolean | null + name_family: string + name_given: string[] + name_prefix?: string | null + name_use?: string | null + status?: Database["public"]["Enums"]["episode_status"] | null + telecom_email?: string | null + telecom_phone?: string | null + updated_at?: string | null + } + Update: { + active?: boolean | null + address_city?: string | null + address_country?: string | null + address_line?: string[] | null + address_postal_code?: string | null + birth_date?: string + created_at?: string | null + emergency_contact_name?: string | null + emergency_contact_phone?: string | null + emergency_contact_relationship?: string | null + gender?: Database["public"]["Enums"]["gender_type"] + general_practitioner_agb?: string | null + general_practitioner_name?: string | null + id?: string + identifier_bsn?: string | null + identifier_client_number?: string | null + insurance_company?: string | null + insurance_number?: string | null + is_john_doe?: boolean | null + name_family?: string + name_given?: string[] + name_prefix?: string | null + name_use?: string | null + status?: Database["public"]["Enums"]["episode_status"] | null + telecom_email?: string | null + telecom_phone?: string | null + updated_at?: string | null + } + Relationships: [] + } + practitioners: { + Row: { + active: boolean | null + created_at: string | null + id: string + identifier_agb: string | null + identifier_big: string | null + name_family: string + name_given: string[] + name_prefix: string | null + name_suffix: string | null + qualification: string[] | null + telecom_email: string | null + telecom_phone: string | null + updated_at: string | null + user_id: string | null + } + Insert: { + active?: boolean | null + created_at?: string | null + id?: string + identifier_agb?: string | null + identifier_big?: string | null + name_family: string + name_given: string[] + name_prefix?: string | null + name_suffix?: string | null + qualification?: string[] | null + telecom_email?: string | null + telecom_phone?: string | null + updated_at?: string | null + user_id?: string | null + } + Update: { + active?: boolean | null + created_at?: string | null + id?: string + identifier_agb?: string | null + identifier_big?: string | null + name_family?: string + name_given?: string[] + name_prefix?: string | null + name_suffix?: string | null + qualification?: string[] | null + telecom_email?: string | null + telecom_phone?: string | null + updated_at?: string | null + user_id?: string | null + } + Relationships: [] + } + problem_profiles: { + Row: { + category: string + client_id: string + created_at: string + id: string + remarks: string | null + severity: string + source_note_id: string | null + updated_at: string + } + Insert: { + category: string + client_id: string + created_at?: string + id?: string + remarks?: string | null + severity: string + source_note_id?: string | null + updated_at?: string + } + Update: { + category?: string + client_id?: string + created_at?: string + id?: string + remarks?: string | null + severity?: string + source_note_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "problem_profiles_client_id_fkey" + columns: ["client_id"] + isOneToOne: false + referencedRelation: "clients" + referencedColumns: ["id"] + }, + { + foreignKeyName: "problem_profiles_source_note_id_fkey" + columns: ["source_note_id"] + isOneToOne: false + referencedRelation: "intake_notes" + referencedColumns: ["id"] + }, + ] + } + risk_assessments: { + Row: { + assessment_date: string + created_at: string | null + created_by: string | null + evaluation_date: string | null + id: string + intake_id: string + measures: string | null + notes: string | null + rationale: string + risk_level: string + risk_type: string + updated_at: string | null + } + Insert: { + assessment_date?: string + created_at?: string | null + created_by?: string | null + evaluation_date?: string | null + id?: string + intake_id: string + measures?: string | null + notes?: string | null + rationale: string + risk_level: string + risk_type: string + updated_at?: string | null + } + Update: { + assessment_date?: string + created_at?: string | null + created_by?: string | null + evaluation_date?: string | null + id?: string + intake_id?: string + measures?: string | null + notes?: string | null + rationale?: string + risk_level?: string + risk_type?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "risk_assessments_created_by_fkey" + columns: ["created_by"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + { + foreignKeyName: "risk_assessments_intake_id_fkey" + columns: ["intake_id"] + isOneToOne: false + referencedRelation: "active_intakes_overview" + referencedColumns: ["id"] + }, + { + foreignKeyName: "risk_assessments_intake_id_fkey" + columns: ["intake_id"] + isOneToOne: false + referencedRelation: "intakes" + referencedColumns: ["id"] + }, + ] + } + screening_activities: { + Row: { + activity_text: string + created_at: string | null + created_by: string | null + created_by_name: string | null + id: string + screening_id: string + } + Insert: { + activity_text: string + created_at?: string | null + created_by?: string | null + created_by_name?: string | null + id?: string + screening_id: string + } + Update: { + activity_text?: string + created_at?: string | null + created_by?: string | null + created_by_name?: string | null + id?: string + screening_id?: string + } + Relationships: [ + { + foreignKeyName: "screening_activities_created_by_fkey" + columns: ["created_by"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + { + foreignKeyName: "screening_activities_screening_id_fkey" + columns: ["screening_id"] + isOneToOne: false + referencedRelation: "screenings" + referencedColumns: ["id"] + }, + ] + } + screening_documents: { + Row: { + document_type: string | null + file_name: string + file_path: string | null + file_size: number | null + file_type: string | null + id: string + screening_id: string + uploaded_at: string | null + uploaded_by: string | null + uploaded_by_name: string | null + } + Insert: { + document_type?: string | null + file_name: string + file_path?: string | null + file_size?: number | null + file_type?: string | null + id?: string + screening_id: string + uploaded_at?: string | null + uploaded_by?: string | null + uploaded_by_name?: string | null + } + Update: { + document_type?: string | null + file_name?: string + file_path?: string | null + file_size?: number | null + file_type?: string | null + id?: string + screening_id?: string + uploaded_at?: string | null + uploaded_by?: string | null + uploaded_by_name?: string | null + } + Relationships: [ + { + foreignKeyName: "screening_documents_screening_id_fkey" + columns: ["screening_id"] + isOneToOne: false + referencedRelation: "screenings" + referencedColumns: ["id"] + }, + { + foreignKeyName: "screening_documents_uploaded_by_fkey" + columns: ["uploaded_by"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + ] + } + screenings: { + Row: { + created_at: string | null + decision: string | null + decision_by: string | null + decision_date: string | null + decision_department: string | null + decision_notes: string | null + id: string + patient_id: string + request_for_help: string | null + updated_at: string | null + } + Insert: { + created_at?: string | null + decision?: string | null + decision_by?: string | null + decision_date?: string | null + decision_department?: string | null + decision_notes?: string | null + id?: string + patient_id: string + request_for_help?: string | null + updated_at?: string | null + } + Update: { + created_at?: string | null + decision?: string | null + decision_by?: string | null + decision_date?: string | null + decision_department?: string | null + decision_notes?: string | null + id?: string + patient_id?: string + request_for_help?: string | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "screenings_decision_by_fkey" + columns: ["decision_by"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + { + foreignKeyName: "screenings_patient_id_fkey" + columns: ["patient_id"] + isOneToOne: false + referencedRelation: "patients" + referencedColumns: ["id"] + }, + ] + } + treatment_plans: { + Row: { + client_id: string + created_at: string + created_by: string | null + id: string + plan: Json + published_at: string | null + status: string + updated_at: string + version: number + } + Insert: { + client_id: string + created_at?: string + created_by?: string | null + id?: string + plan?: Json + published_at?: string | null + status?: string + updated_at?: string + version?: number + } + Update: { + client_id?: string + created_at?: string + created_by?: string | null + id?: string + plan?: Json + published_at?: string | null + status?: string + updated_at?: string + version?: number + } + Relationships: [ + { + foreignKeyName: "treatment_plans_client_id_fkey" + columns: ["client_id"] + isOneToOne: false + referencedRelation: "clients" + referencedColumns: ["id"] + }, + ] + } + reports: { + Row: { + ai_confidence: number | null + ai_reasoning: string | null + audio_duration_seconds: number | null + audio_url: string | null + content: string + created_at: string + created_by: string | null + deleted_at: string | null + id: string + parent_report_id: string | null + patient_id: string + structured_data: Json + type: string + updated_at: string | null + updated_by: string | null + version: string | null + } + Insert: { + ai_confidence?: number | null + ai_reasoning?: string | null + audio_duration_seconds?: number | null + audio_url?: string | null + content: string + created_at?: string + created_by?: string | null + deleted_at?: string | null + id?: string + parent_report_id?: string | null + patient_id: string + structured_data?: Json + type: string + updated_at?: string | null + updated_by?: string | null + version?: string | null + } + Update: { + ai_confidence?: number | null + ai_reasoning?: string | null + audio_duration_seconds?: number | null + audio_url?: string | null + content?: string + created_at?: string + created_by?: string | null + deleted_at?: string | null + id?: string + parent_report_id?: string | null + patient_id?: string + structured_data?: Json + type?: string + updated_at?: string | null + updated_by?: string | null + version?: string | null + } + Relationships: [ + { + foreignKeyName: "reports_created_by_fkey" + columns: ["created_by"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + { + foreignKeyName: "reports_parent_report_id_fkey" + columns: ["parent_report_id"] + isOneToOne: false + referencedRelation: "reports" + referencedColumns: ["id"] + }, + { + foreignKeyName: "reports_patient_id_fkey" + columns: ["patient_id"] + isOneToOne: false + referencedRelation: "patients" + referencedColumns: ["id"] + }, + { + foreignKeyName: "reports_updated_by_fkey" + columns: ["updated_by"] + isOneToOne: false + referencedRelation: "practitioners" + referencedColumns: ["id"] + }, + ] + } + } + Views: { + active_intakes_overview: { + Row: { + birth_date: string | null + contact_count: number | null + department: string | null + diagnosis_count: number | null + end_date: string | null + id: string | null + name_family: string | null + name_given: string[] | null + psychologist_name: string | null + start_date: string | null + status: string | null + title: string | null + } + Relationships: [] + } + } + Functions: { + get_demo_access_level: { + Args: { check_user_id: string } + Returns: string + } + hook_check_duplicate_email: { Args: { event: Json }; Returns: Json } + is_demo_user: { Args: { check_user_id: string }; Returns: boolean } + } + Enums: { + careplan_status: + | "draft" + | "active" + | "on-hold" + | "revoked" + | "completed" + | "entered-in-error" + | "unknown" + condition_clinical_status: + | "active" + | "recurrence" + | "relapse" + | "inactive" + | "remission" + | "resolved" + | "unknown" + condition_verification_status: + | "unconfirmed" + | "provisional" + | "differential" + | "confirmed" + | "refuted" + | "entered-in-error" + encounter_status: + | "planned" + | "in-progress" + | "on-hold" + | "completed" + | "cancelled" + | "entered-in-error" + | "unknown" + episode_status: "planned" | "active" | "finished" | "cancelled" + gender_type: "male" | "female" | "other" | "unknown" + observation_status: + | "registered" + | "preliminary" + | "final" + | "amended" + | "corrected" + | "cancelled" + | "entered-in-error" + | "unknown" + } + 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 = { + graphql_public: { + Enums: {}, + }, + public: { + Enums: { + careplan_status: [ + "draft", + "active", + "on-hold", + "revoked", + "completed", + "entered-in-error", + "unknown", + ], + condition_clinical_status: [ + "active", + "recurrence", + "relapse", + "inactive", + "remission", + "resolved", + "unknown", + ], + condition_verification_status: [ + "unconfirmed", + "provisional", + "differential", + "confirmed", + "refuted", + "entered-in-error", + ], + encounter_status: [ + "planned", + "in-progress", + "on-hold", + "completed", + "cancelled", + "entered-in-error", + "unknown", + ], + episode_status: ["planned", "active", "finished", "cancelled"], + gender_type: ["male", "female", "other", "unknown"], + observation_status: [ + "registered", + "preliminary", + "final", + "amended", + "corrected", + "cancelled", + "entered-in-error", + "unknown", + ], + }, + }, +} as const diff --git a/lib/types/report.ts b/lib/types/report.ts index 8020e82..a9a07ea 100644 --- a/lib/types/report.ts +++ b/lib/types/report.ts @@ -10,9 +10,7 @@ export type ReportType = (typeof REPORT_TYPES)[number]; export const CreateReportSchema = z.object({ patient_id: z.string().uuid('Patient ID moet een geldige UUID zijn'), - type: z.enum(REPORT_TYPES, { - errorMap: () => ({ message: 'Type moet behandeladvies of vrije_notitie zijn' }), - }), + type: z.enum(REPORT_TYPES), content: z .string() .min(20, 'Rapportage moet minimaal 20 karakters bevatten')