MED-103: add booking functionality

This commit is contained in:
Helena
2025-09-17 18:11:13 +03:00
parent 7c92b787ce
commit 22f7fa134b
44 changed files with 1923 additions and 479 deletions

View File

@@ -4,8 +4,8 @@ import { cookies } from 'next/headers';
import { createServerClient } from '@supabase/ssr';
import { Database } from '../database.types';
import { getSupabaseClientKeys } from '../get-supabase-client-keys';
import { Database } from '../database.types';
/**
* @name getSupabaseServerClient

View File

@@ -198,6 +198,7 @@ export type Database = {
action: string
changed_by: string
created_at: string
extra_data: Json | null
id: number
}
Insert: {
@@ -205,6 +206,7 @@ export type Database = {
action: string
changed_by: string
created_at?: string
extra_data?: Json | null
id?: number
}
Update: {
@@ -212,6 +214,7 @@ export type Database = {
action?: string
changed_by?: string
created_at?: string
extra_data?: Json | null
id?: number
}
Relationships: []
@@ -221,7 +224,6 @@ export type Database = {
comment: string | null
created_at: string
id: number
personal_code: number | null
request_api: string
request_api_method: string
requested_end_date: string | null
@@ -229,12 +231,12 @@ export type Database = {
service_id: number | null
service_provider_id: number | null
status: Database["audit"]["Enums"]["request_status"]
user_id: string | null
}
Insert: {
comment?: string | null
created_at?: string
id?: number
personal_code?: number | null
request_api: string
request_api_method: string
requested_end_date?: string | null
@@ -242,12 +244,12 @@ export type Database = {
service_id?: number | null
service_provider_id?: number | null
status: Database["audit"]["Enums"]["request_status"]
user_id?: string | null
}
Update: {
comment?: string | null
created_at?: string
id?: number
personal_code?: number | null
request_api?: string
request_api_method?: string
requested_end_date?: string | null
@@ -255,6 +257,7 @@ export type Database = {
service_id?: number | null
service_provider_id?: number | null
status?: Database["audit"]["Enums"]["request_status"]
user_id?: string | null
}
Relationships: []
}
@@ -990,32 +993,76 @@ export type Database = {
}
Relationships: []
}
connected_online_locations: {
Row: {
address: string | null
clinic_id: number
created_at: string
id: number
name: string
sync_id: number
updated_at: string | null
}
Insert: {
address?: string | null
clinic_id: number
created_at?: string
id?: number
name: string
sync_id: number
updated_at?: string | null
}
Update: {
address?: string | null
clinic_id?: number
created_at?: string
id?: number
name?: string
sync_id?: number
updated_at?: string | null
}
Relationships: [
{
foreignKeyName: "connected_online_locations_clinic_id_fkey"
columns: ["clinic_id"]
isOneToOne: false
referencedRelation: "connected_online_providers"
referencedColumns: ["id"]
},
]
}
connected_online_providers: {
Row: {
address: string
can_select_worker: boolean
created_at: string
email: string | null
id: number
key: string
name: string
personal_code_required: boolean
phone_number: string | null
updated_at: string | null
}
Insert: {
address?: string
can_select_worker: boolean
created_at?: string
email?: string | null
id: number
key: string
name: string
personal_code_required: boolean
phone_number?: string | null
updated_at?: string | null
}
Update: {
address?: string
can_select_worker?: boolean
created_at?: string
email?: string | null
id?: number
key?: string
name?: string
personal_code_required?: boolean
phone_number?: string | null
@@ -1025,55 +1072,117 @@ export type Database = {
}
connected_online_reservation: {
Row: {
booking_code: string
booking_code: string | null
clinic_id: number
comments: string | null
created_at: string
discount_code: string | null
id: number
lang: string
requires_payment: boolean
location_sync_id: number | null
medusa_cart_line_item_id: string | null
requires_payment: boolean | null
service_id: number
service_user_id: number | null
service_user_id: number
start_time: string
status: Database["medreport"]["Enums"]["connected_online_order_status"]
sync_user_id: number
updated_at: string | null
user_id: string
}
Insert: {
booking_code: string
booking_code?: string | null
clinic_id: number
comments?: string | null
created_at?: string
discount_code?: string | null
id?: number
lang: string
requires_payment: boolean
location_sync_id?: number | null
medusa_cart_line_item_id?: string | null
requires_payment?: boolean | null
service_id: number
service_user_id?: number | null
service_user_id: number
start_time: string
status: Database["medreport"]["Enums"]["connected_online_order_status"]
sync_user_id: number
updated_at?: string | null
user_id: string
}
Update: {
booking_code?: string
booking_code?: string | null
clinic_id?: number
comments?: string | null
created_at?: string
discount_code?: string | null
id?: number
lang?: string
requires_payment?: boolean
location_sync_id?: number | null
medusa_cart_line_item_id?: string | null
requires_payment?: boolean | null
service_id?: number
service_user_id?: number | null
service_user_id?: number
start_time?: string
status?: Database["medreport"]["Enums"]["connected_online_order_status"]
sync_user_id?: number
updated_at?: string | null
user_id?: string
}
Relationships: []
}
connected_online_service_providers: {
Row: {
clinic_id: number
created_at: string
id: number
is_deleted: boolean | null
job_title_en: string | null
job_title_et: string | null
job_title_id: number | null
job_title_ru: string | null
name: string
prefix: string | null
spoken_languages: string[] | null
updated_at: string | null
}
Insert: {
clinic_id: number
created_at?: string
id: number
is_deleted?: boolean | null
job_title_en?: string | null
job_title_et?: string | null
job_title_id?: number | null
job_title_ru?: string | null
name: string
prefix?: string | null
spoken_languages?: string[] | null
updated_at?: string | null
}
Update: {
clinic_id?: number
created_at?: string
id?: number
is_deleted?: boolean | null
job_title_en?: string | null
job_title_et?: string | null
job_title_id?: number | null
job_title_ru?: string | null
name?: string
prefix?: string | null
spoken_languages?: string[] | null
updated_at?: string | null
}
Relationships: [
{
foreignKeyName: "connected_online_service_providers_clinic_id_fkey"
columns: ["clinic_id"]
isOneToOne: false
referencedRelation: "connected_online_providers"
referencedColumns: ["id"]
},
]
}
connected_online_services: {
Row: {
clinic_id: number
@@ -1091,7 +1200,7 @@ export type Database = {
price: number
price_periods: string | null
requires_payment: boolean
sync_id: string
sync_id: number
updated_at: string | null
}
Insert: {
@@ -1110,7 +1219,7 @@ export type Database = {
price: number
price_periods?: string | null
requires_payment: boolean
sync_id: string
sync_id: number
updated_at?: string | null
}
Update: {
@@ -1129,7 +1238,7 @@ export type Database = {
price?: number
price_periods?: string | null
requires_payment?: boolean
sync_id?: string
sync_id?: number
updated_at?: string | null
}
Relationships: [
@@ -1150,7 +1259,7 @@ export type Database = {
doctor_user_id: string | null
id: number
status: Database["medreport"]["Enums"]["analysis_feedback_status"]
updated_at: string
updated_at: string | null
updated_by: string | null
user_id: string
value: string | null
@@ -1162,7 +1271,7 @@ export type Database = {
doctor_user_id?: string | null
id?: number
status?: Database["medreport"]["Enums"]["analysis_feedback_status"]
updated_at?: string
updated_at?: string | null
updated_by?: string | null
user_id: string
value?: string | null
@@ -1174,7 +1283,7 @@ export type Database = {
doctor_user_id?: string | null
id?: number
status?: Database["medreport"]["Enums"]["analysis_feedback_status"]
updated_at?: string
updated_at?: string | null
updated_by?: string | null
user_id?: string
value?: string | null
@@ -1259,23 +1368,36 @@ export type Database = {
}
medipost_actions: {
Row: {
created_at: string
id: number
action: string
xml: string
created_at: string | null
has_analysis_results: boolean
medusa_order_id: string
response_xml: string
has_error: boolean
id: string
medusa_order_id: string | null
response_xml: string | null
xml: string | null
}
Insert: {
action: string
xml: string
has_analysis_results: boolean
medusa_order_id: string
response_xml: string
has_error: boolean
created_at?: string | null
has_analysis_results?: boolean
has_error?: boolean
id?: string
medusa_order_id?: string | null
response_xml?: string | null
xml?: string | null
}
Update: {
action?: string
created_at?: string | null
has_analysis_results?: boolean
has_error?: boolean
id?: string
medusa_order_id?: string | null
response_xml?: string | null
xml?: string | null
}
Relationships: []
}
medreport_product_groups: {
Row: {
@@ -1944,6 +2066,13 @@ export type Database = {
personal_code: string
}[]
}
get_latest_medipost_dispatch_state_for_order: {
Args: { medusa_order_id: string }
Returns: {
action_date: string
has_success: boolean
}[]
}
get_medipost_dispatch_tries: {
Args: { p_medusa_order_id: string }
Returns: number
@@ -2036,9 +2165,9 @@ export type Database = {
Args: { account_id: string; user_id: string }
Returns: boolean
}
medipost_retry_dispatch: {
Args: { order_id: string }
Returns: Json
order_has_medipost_dispatch_error: {
Args: { medusa_order_id: string }
Returns: boolean
}
revoke_nonce: {
Args: { p_id: string; p_reason?: string }
@@ -2065,16 +2194,26 @@ export type Database = {
Returns: undefined
}
update_account: {
Args: {
p_city: string
p_has_consent_personal_data: boolean
p_last_name: string
p_name: string
p_personal_code: string
p_phone: string
p_uid: string
p_email: string
}
Args:
| {
p_city: string
p_email: string
p_has_consent_personal_data: boolean
p_last_name: string
p_name: string
p_personal_code: string
p_phone: string
p_uid: string
}
| {
p_city: string
p_has_consent_personal_data: boolean
p_last_name: string
p_name: string
p_personal_code: string
p_phone: string
p_uid: string
}
Returns: undefined
}
update_analysis_order_status: {
@@ -2182,6 +2321,11 @@ export type Database = {
| "invites.manage"
application_role: "user" | "doctor" | "super_admin"
billing_provider: "stripe" | "lemon-squeezy" | "paddle" | "montonio"
connected_online_order_status:
| "PENDING"
| "CONFIRMED"
| "REJECTED"
| "CANCELLED"
locale: "en" | "et" | "ru"
notification_channel: "in_app" | "email"
notification_type: "info" | "warning" | "error"
@@ -8099,6 +8243,12 @@ export const Constants = {
],
application_role: ["user", "doctor", "super_admin"],
billing_provider: ["stripe", "lemon-squeezy", "paddle", "montonio"],
connected_online_order_status: [
"PENDING",
"CONFIRMED",
"REJECTED",
"CANCELLED",
],
locale: ["en", "et", "ru"],
notification_channel: ["in_app", "email"],
notification_type: ["info", "warning", "error"],