From 87dfcf55e6559073ca7d8ece86b55ea4d45cc4e5 Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Tue, 15 Jul 2025 17:12:52 +0300 Subject: [PATCH 01/10] MED-105: create analysis results page --- .../_components/analysis-level-bar.tsx | 89 + .../analysis-results/_components/analysis.tsx | 84 + .../(dashboard)/analysis-results/page.tsx | 59 + .../(user)/_lib/server/load-user-analysis.ts | 22 + config/paths.config.ts | 2 +- lib/services/medipost.service.ts | 1 + package.json | 2 +- packages/features/accounts/package.json | 3 +- packages/features/accounts/src/server/api.ts | 48 + .../features/accounts/src/types/accounts.ts | 6 + .../medusa-storefront/src/lib/config.ts | 10 +- packages/supabase/src/database.types.ts | 5726 ++++++++++++++++- packages/ui/src/makerkit/page.tsx | 12 +- public/locales/en/account.json | 7 +- public/locales/et/account.json | 5 + public/locales/ru/account.json | 5 +- .../20250714093625_analysis_responses.sql | 3 + supabase/sql/analysis.sql | 146 + tsconfig.json | 8 +- 19 files changed, 6213 insertions(+), 25 deletions(-) create mode 100644 app/home/(user)/(dashboard)/analysis-results/_components/analysis-level-bar.tsx create mode 100644 app/home/(user)/(dashboard)/analysis-results/_components/analysis.tsx create mode 100644 app/home/(user)/(dashboard)/analysis-results/page.tsx create mode 100644 app/home/(user)/_lib/server/load-user-analysis.ts create mode 100644 packages/features/accounts/src/types/accounts.ts create mode 100644 supabase/migrations/20250714093625_analysis_responses.sql create mode 100644 supabase/sql/analysis.sql diff --git a/app/home/(user)/(dashboard)/analysis-results/_components/analysis-level-bar.tsx b/app/home/(user)/(dashboard)/analysis-results/_components/analysis-level-bar.tsx new file mode 100644 index 0000000..a46b9dd --- /dev/null +++ b/app/home/(user)/(dashboard)/analysis-results/_components/analysis-level-bar.tsx @@ -0,0 +1,89 @@ +import React from 'react'; + +import { ArrowDown } from 'lucide-react'; + +import { cn } from '@kit/ui/utils'; + +export enum AnalysisResultLevel { + VERY_LOW = 0, + LOW = 1, + NORMAL = 2, + HIGH = 3, + VERY_HIGH = 4, +} + +const Level = ({ + isActive = false, + color, + isFirst = false, + isLast = false, +}: { + isActive?: boolean; + color: 'destructive' | 'success' | 'warning'; + isFirst?: boolean; + isLast?: boolean; +}) => { + return ( +
+ {isActive && ( +
+ +
+ )} +
+ ); +}; + +const AnalysisLevelBar = ({ + normLowerIncluded = true, + normUpperIncluded = true, + level, +}: { + normLowerIncluded?: boolean; + normUpperIncluded?: boolean; + level: AnalysisResultLevel; +}) => { + return ( +
+ {normLowerIncluded && ( + <> + + + + )} + + + + {normUpperIncluded && ( + <> + + + + )} +
+ ); +}; + +export default AnalysisLevelBar; diff --git a/app/home/(user)/(dashboard)/analysis-results/_components/analysis.tsx b/app/home/(user)/(dashboard)/analysis-results/_components/analysis.tsx new file mode 100644 index 0000000..4cd02b6 --- /dev/null +++ b/app/home/(user)/(dashboard)/analysis-results/_components/analysis.tsx @@ -0,0 +1,84 @@ +import React from 'react'; + +import { Info } from 'lucide-react'; + +import AnalysisLevelBar, { AnalysisResultLevel } from './analysis-level-bar'; + +export enum AnalysisStatus { + NORMAL = 0, + MEDIUM = 1, + HIGH = 2, +} + +const Analysis = ({ + analysis: { + name, + status, + unit, + value, + normLowerIncluded, + normUpperIncluded, + normLower, + normUpper, + }, +}: { + analysis: { + name: string; + status: AnalysisStatus; + unit: string; + value: number; + normLowerIncluded: boolean; + normUpperIncluded: boolean; + normLower: number; + normUpper: number; + }; +}) => { + const isUnderNorm = value < normLower; + const getAnalysisResultLevel = () => { + if (isUnderNorm) { + switch (status) { + case AnalysisStatus.MEDIUM: + return AnalysisResultLevel.LOW; + default: + return AnalysisResultLevel.VERY_LOW; + } + } + switch (status) { + case AnalysisStatus.MEDIUM: + return AnalysisResultLevel.HIGH; + case AnalysisStatus.HIGH: + return AnalysisResultLevel.VERY_HIGH; + default: + return AnalysisResultLevel.NORMAL; + } + }; + + return ( +
+
+ {name} +
+ {' '} +
+ This text changes when you hover the box above. +
+
+
+
+
{value}
+
{unit}
+
+
+ {normLower} - {normUpper} +
Normaalne vahemik
+
+ +
+ ); +}; + +export default Analysis; diff --git a/app/home/(user)/(dashboard)/analysis-results/page.tsx b/app/home/(user)/(dashboard)/analysis-results/page.tsx new file mode 100644 index 0000000..23a79f8 --- /dev/null +++ b/app/home/(user)/(dashboard)/analysis-results/page.tsx @@ -0,0 +1,59 @@ +import { createI18nServerInstance } from '@/lib/i18n/i18n.server'; +import { withI18n } from '@/lib/i18n/with-i18n'; + +import { Trans } from '@kit/ui/makerkit/trans'; +import { PageBody } from '@kit/ui/page'; +import { Button } from '@kit/ui/shadcn/button'; + +import { loadUserAnalysis } from '../../_lib/server/load-user-analysis'; +import Analysis, { AnalysisStatus } from './_components/analysis'; + +export const generateMetadata = async () => { + const i18n = await createI18nServerInstance(); + const title = i18n.t('account:analysisResults.pageTitle'); + + return { + title, + }; +}; + +async function AnalysisResultsPage() { + const analysisList = await loadUserAnalysis(); + + return ( + +
+
+

+ +

+

+ +

+
+ +
+
+ {analysisList?.map((analysis, index) => ( + + ))} +
+
+ ); +} + +export default withI18n(AnalysisResultsPage); diff --git a/app/home/(user)/_lib/server/load-user-analysis.ts b/app/home/(user)/_lib/server/load-user-analysis.ts new file mode 100644 index 0000000..94d293b --- /dev/null +++ b/app/home/(user)/_lib/server/load-user-analysis.ts @@ -0,0 +1,22 @@ +import { cache } from 'react'; + +import { createAccountsApi } from '@kit/accounts/api'; +import { UserAnalysis } from '@kit/accounts/types/accounts'; +import { getSupabaseServerClient } from '@kit/supabase/server-client'; + +export type UserAccount = Awaited>; + +/** + * @name loadUserAccount + * @description + * Load the user account. It's a cached per-request function that fetches the user workspace data. + * It can be used across the server components to load the user workspace data. + */ +export const loadUserAnalysis = cache(analysisLoader); + +async function analysisLoader(): Promise { + const client = getSupabaseServerClient(); + const api = createAccountsApi(client); + + return api.getUserAnalysis(); +} diff --git a/config/paths.config.ts b/config/paths.config.ts index ebfcbea..e9c54ca 100644 --- a/config/paths.config.ts +++ b/config/paths.config.ts @@ -60,7 +60,7 @@ const pathsConfig = PathsSchema.parse({ // these routes are added as placeholders and can be changed when the pages are added booking: '/booking', myOrders: '/my-orders', - analysisResults: '/analysis-results', + analysisResults: '/home/analysis-results', orderAnalysisPackage: '/order-analysis-package', orderAnalysis: '/order-analysis', orderHealthAnalysis: '/order-health-analysis', diff --git a/lib/services/medipost.service.ts b/lib/services/medipost.service.ts index 7952634..775f870 100644 --- a/lib/services/medipost.service.ts +++ b/lib/services/medipost.service.ts @@ -617,6 +617,7 @@ export async function syncPrivateMessage( response_value: response.VastuseVaartus, unit: element.Mootyhik ?? null, original_response_element: element, + analysis_name: element.UuringNimi || element.KNimetus, })), ); } diff --git a/package.json b/package.json index ce946e8..0ef234e 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "supabase:test": "supabase db test", "supabase:db:reset": "supabase db reset", "supabase:db:lint": "supabase db lint", - "supabase:db:diff": "supabase db diff", + "supabase:db:diff": "supabase db diff --schema auth --schema audit --schema medreport", "supabase:deploy": "supabase link --project-ref $SUPABASE_PROJECT_REF && supabase db push", "supabase:typegen": "supabase gen types typescript --local > ./packages/supabase/src/database.types.ts", "supabase:db:dump:local": "supabase db dump --local --data-only", diff --git a/packages/features/accounts/package.json b/packages/features/accounts/package.json index 148e428..fd32c4f 100644 --- a/packages/features/accounts/package.json +++ b/packages/features/accounts/package.json @@ -14,7 +14,8 @@ "./personal-account-settings": "./src/components/personal-account-settings/index.ts", "./components": "./src/components/index.ts", "./hooks/*": "./src/hooks/*.ts", - "./api": "./src/server/api.ts" + "./api": "./src/server/api.ts", + "./types/*": "./src/types/*.ts" }, "dependencies": { "nanoid": "^5.1.5" diff --git a/packages/features/accounts/src/server/api.ts b/packages/features/accounts/src/server/api.ts index fd0c9d1..62c25d9 100644 --- a/packages/features/accounts/src/server/api.ts +++ b/packages/features/accounts/src/server/api.ts @@ -2,6 +2,8 @@ import { SupabaseClient } from '@supabase/supabase-js'; import { Database } from '@kit/supabase/database'; +import { UserAnalysis } from '../types/accounts'; + /** * Class representing an API for interacting with user accounts. * @constructor @@ -117,6 +119,7 @@ class AccountsApi { */ async getSubscription(accountId: string) { const response = await this.client + .schema('medreport') .from('subscriptions') .select('*, items: subscription_items !inner (*)') .eq('account_id', accountId) @@ -168,6 +171,51 @@ class AccountsApi { return response.data?.customer_id; } + + async getUserAnalysis(): Promise { + const authUser = await this.client.auth.getUser(); + const { data, error: userError } = authUser; + + if (userError) { + console.error('Failed to get user', userError); + throw userError; + } + + const { user } = data; + + const { data: analysisResponses } = await this.client + .schema('medreport') + .from('analysis_responses') + .select('*') + .eq('user_id', user.id); + + if (!analysisResponses) { + return null; + } + + const analysisResponseIds = analysisResponses.map((r) => r.id); + + const { data: analysisResponseElements } = await this.client + .schema('medreport') + .from('analysis_response_elements') + .select('*') + .in('analysis_response_id', analysisResponseIds); + + if (!analysisResponseElements) { + return null; + } + + const elementMap = new Map( + analysisResponseElements.map((e) => [e.analysis_response_id, e]), + ); + + return analysisResponses + .filter((r) => elementMap.has(r.id)) + .map((r) => ({ + ...r, + element: elementMap.get(r.id)!, + })); + } } export function createAccountsApi(client: SupabaseClient) { diff --git a/packages/features/accounts/src/types/accounts.ts b/packages/features/accounts/src/types/accounts.ts new file mode 100644 index 0000000..459b53d --- /dev/null +++ b/packages/features/accounts/src/types/accounts.ts @@ -0,0 +1,6 @@ +import { Database } from '@kit/supabase/database'; + +export type UserAnalysis = + (Database['medreport']['Tables']['analysis_responses']['Row'] & { + element: Database['medreport']['Tables']['analysis_response_elements']['Row']; + })[]; diff --git a/packages/features/medusa-storefront/src/lib/config.ts b/packages/features/medusa-storefront/src/lib/config.ts index 47c46b1..72d8dbb 100644 --- a/packages/features/medusa-storefront/src/lib/config.ts +++ b/packages/features/medusa-storefront/src/lib/config.ts @@ -1,14 +1,14 @@ -import Medusa from "@medusajs/js-sdk" +import Medusa from "@medusajs/js-sdk"; // Defaults to standard port for Medusa server -let MEDUSA_BACKEND_URL = "http://localhost:9000" +let MEDUSA_BACKEND_URL = "http://localhost:9000"; if (process.env.MEDUSA_BACKEND_URL) { - MEDUSA_BACKEND_URL = process.env.MEDUSA_BACKEND_URL + MEDUSA_BACKEND_URL = process.env.MEDUSA_BACKEND_URL; } - +console.log("MEDUSA_BACKEND_URL", MEDUSA_BACKEND_URL); export const sdk = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, debug: process.env.NODE_ENV === "development", publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY, -}) +}); diff --git a/packages/supabase/src/database.types.ts b/packages/supabase/src/database.types.ts index 053c4fc..e56b522 100644 --- a/packages/supabase/src/database.types.ts +++ b/packages/supabase/src/database.types.ts @@ -459,6 +459,7 @@ export type Database = { analysis_response_elements: { Row: { analysis_element_original_id: string + analysis_name: string | null analysis_response_id: number created_at: string id: number @@ -469,12 +470,13 @@ export type Database = { norm_upper_included: boolean | null original_response_element: Json response_time: string - response_value: Json + response_value: number unit: string | null updated_at: string | null } Insert: { analysis_element_original_id: string + analysis_name?: string | null analysis_response_id: number created_at?: string id?: number @@ -485,12 +487,13 @@ export type Database = { norm_upper_included?: boolean | null original_response_element: Json response_time: string - response_value: Json + response_value: number unit?: string | null updated_at?: string | null } Update: { analysis_element_original_id?: string + analysis_name?: string | null analysis_response_id?: number created_at?: string id?: number @@ -501,7 +504,7 @@ export type Database = { norm_upper_included?: boolean | null original_response_element?: Json response_time?: string - response_value?: Json + response_value?: number unit?: string | null updated_at?: string | null } @@ -1757,7 +1760,5681 @@ export type Database = { } public: { Tables: { - [_ in never]: never + account_holder: { + Row: { + created_at: string + data: Json + deleted_at: string | null + email: string | null + external_id: string + id: string + metadata: Json | null + provider_id: string + updated_at: string + } + Insert: { + created_at?: string + data?: Json + deleted_at?: string | null + email?: string | null + external_id: string + id: string + metadata?: Json | null + provider_id: string + updated_at?: string + } + Update: { + created_at?: string + data?: Json + deleted_at?: string | null + email?: string | null + external_id?: string + id?: string + metadata?: Json | null + provider_id?: string + updated_at?: string + } + Relationships: [] + } + api_key: { + Row: { + created_at: string + created_by: string + deleted_at: string | null + id: string + last_used_at: string | null + redacted: string + revoked_at: string | null + revoked_by: string | null + salt: string + title: string + token: string + type: string + updated_at: string + } + Insert: { + created_at?: string + created_by: string + deleted_at?: string | null + id: string + last_used_at?: string | null + redacted: string + revoked_at?: string | null + revoked_by?: string | null + salt: string + title: string + token: string + type: string + updated_at?: string + } + Update: { + created_at?: string + created_by?: string + deleted_at?: string | null + id?: string + last_used_at?: string | null + redacted?: string + revoked_at?: string | null + revoked_by?: string | null + salt?: string + title?: string + token?: string + type?: string + updated_at?: string + } + Relationships: [] + } + application_method_buy_rules: { + Row: { + application_method_id: string + promotion_rule_id: string + } + Insert: { + application_method_id: string + promotion_rule_id: string + } + Update: { + application_method_id?: string + promotion_rule_id?: string + } + Relationships: [ + { + foreignKeyName: "application_method_buy_rules_application_method_id_foreign" + columns: ["application_method_id"] + isOneToOne: false + referencedRelation: "promotion_application_method" + referencedColumns: ["id"] + }, + { + foreignKeyName: "application_method_buy_rules_promotion_rule_id_foreign" + columns: ["promotion_rule_id"] + isOneToOne: false + referencedRelation: "promotion_rule" + referencedColumns: ["id"] + }, + ] + } + application_method_target_rules: { + Row: { + application_method_id: string + promotion_rule_id: string + } + Insert: { + application_method_id: string + promotion_rule_id: string + } + Update: { + application_method_id?: string + promotion_rule_id?: string + } + Relationships: [ + { + foreignKeyName: "application_method_target_rules_application_method_id_foreign" + columns: ["application_method_id"] + isOneToOne: false + referencedRelation: "promotion_application_method" + referencedColumns: ["id"] + }, + { + foreignKeyName: "application_method_target_rules_promotion_rule_id_foreign" + columns: ["promotion_rule_id"] + isOneToOne: false + referencedRelation: "promotion_rule" + referencedColumns: ["id"] + }, + ] + } + auth_identity: { + Row: { + app_metadata: Json | null + created_at: string + deleted_at: string | null + id: string + updated_at: string + } + Insert: { + app_metadata?: Json | null + created_at?: string + deleted_at?: string | null + id: string + updated_at?: string + } + Update: { + app_metadata?: Json | null + created_at?: string + deleted_at?: string | null + id?: string + updated_at?: string + } + Relationships: [] + } + capture: { + Row: { + amount: number + created_at: string + created_by: string | null + deleted_at: string | null + id: string + metadata: Json | null + payment_id: string + raw_amount: Json + updated_at: string + } + Insert: { + amount: number + created_at?: string + created_by?: string | null + deleted_at?: string | null + id: string + metadata?: Json | null + payment_id: string + raw_amount: Json + updated_at?: string + } + Update: { + amount?: number + created_at?: string + created_by?: string | null + deleted_at?: string | null + id?: string + metadata?: Json | null + payment_id?: string + raw_amount?: Json + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "capture_payment_id_foreign" + columns: ["payment_id"] + isOneToOne: false + referencedRelation: "payment" + referencedColumns: ["id"] + }, + ] + } + cart: { + Row: { + billing_address_id: string | null + completed_at: string | null + created_at: string + currency_code: string + customer_id: string | null + deleted_at: string | null + email: string | null + id: string + metadata: Json | null + region_id: string | null + sales_channel_id: string | null + shipping_address_id: string | null + updated_at: string + } + Insert: { + billing_address_id?: string | null + completed_at?: string | null + created_at?: string + currency_code: string + customer_id?: string | null + deleted_at?: string | null + email?: string | null + id: string + metadata?: Json | null + region_id?: string | null + sales_channel_id?: string | null + shipping_address_id?: string | null + updated_at?: string + } + Update: { + billing_address_id?: string | null + completed_at?: string | null + created_at?: string + currency_code?: string + customer_id?: string | null + deleted_at?: string | null + email?: string | null + id?: string + metadata?: Json | null + region_id?: string | null + sales_channel_id?: string | null + shipping_address_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "cart_billing_address_id_foreign" + columns: ["billing_address_id"] + isOneToOne: false + referencedRelation: "cart_address" + referencedColumns: ["id"] + }, + { + foreignKeyName: "cart_shipping_address_id_foreign" + columns: ["shipping_address_id"] + isOneToOne: false + referencedRelation: "cart_address" + referencedColumns: ["id"] + }, + ] + } + cart_address: { + Row: { + address_1: string | null + address_2: string | null + city: string | null + company: string | null + country_code: string | null + created_at: string + customer_id: string | null + deleted_at: string | null + first_name: string | null + id: string + last_name: string | null + metadata: Json | null + phone: string | null + postal_code: string | null + province: string | null + updated_at: string + } + Insert: { + address_1?: string | null + address_2?: string | null + city?: string | null + company?: string | null + country_code?: string | null + created_at?: string + customer_id?: string | null + deleted_at?: string | null + first_name?: string | null + id: string + last_name?: string | null + metadata?: Json | null + phone?: string | null + postal_code?: string | null + province?: string | null + updated_at?: string + } + Update: { + address_1?: string | null + address_2?: string | null + city?: string | null + company?: string | null + country_code?: string | null + created_at?: string + customer_id?: string | null + deleted_at?: string | null + first_name?: string | null + id?: string + last_name?: string | null + metadata?: Json | null + phone?: string | null + postal_code?: string | null + province?: string | null + updated_at?: string + } + Relationships: [] + } + cart_line_item: { + Row: { + cart_id: string + compare_at_unit_price: number | null + created_at: string + deleted_at: string | null + id: string + is_custom_price: boolean + is_discountable: boolean + is_giftcard: boolean + is_tax_inclusive: boolean + metadata: Json | null + product_collection: string | null + product_description: string | null + product_handle: string | null + product_id: string | null + product_subtitle: string | null + product_title: string | null + product_type: string | null + product_type_id: string | null + quantity: number + raw_compare_at_unit_price: Json | null + raw_unit_price: Json + requires_shipping: boolean + subtitle: string | null + thumbnail: string | null + title: string + unit_price: number + updated_at: string + variant_barcode: string | null + variant_id: string | null + variant_option_values: Json | null + variant_sku: string | null + variant_title: string | null + } + Insert: { + cart_id: string + compare_at_unit_price?: number | null + created_at?: string + deleted_at?: string | null + id: string + is_custom_price?: boolean + is_discountable?: boolean + is_giftcard?: boolean + is_tax_inclusive?: boolean + metadata?: Json | null + product_collection?: string | null + product_description?: string | null + product_handle?: string | null + product_id?: string | null + product_subtitle?: string | null + product_title?: string | null + product_type?: string | null + product_type_id?: string | null + quantity: number + raw_compare_at_unit_price?: Json | null + raw_unit_price: Json + requires_shipping?: boolean + subtitle?: string | null + thumbnail?: string | null + title: string + unit_price: number + updated_at?: string + variant_barcode?: string | null + variant_id?: string | null + variant_option_values?: Json | null + variant_sku?: string | null + variant_title?: string | null + } + Update: { + cart_id?: string + compare_at_unit_price?: number | null + created_at?: string + deleted_at?: string | null + id?: string + is_custom_price?: boolean + is_discountable?: boolean + is_giftcard?: boolean + is_tax_inclusive?: boolean + metadata?: Json | null + product_collection?: string | null + product_description?: string | null + product_handle?: string | null + product_id?: string | null + product_subtitle?: string | null + product_title?: string | null + product_type?: string | null + product_type_id?: string | null + quantity?: number + raw_compare_at_unit_price?: Json | null + raw_unit_price?: Json + requires_shipping?: boolean + subtitle?: string | null + thumbnail?: string | null + title?: string + unit_price?: number + updated_at?: string + variant_barcode?: string | null + variant_id?: string | null + variant_option_values?: Json | null + variant_sku?: string | null + variant_title?: string | null + } + Relationships: [ + { + foreignKeyName: "cart_line_item_cart_id_foreign" + columns: ["cart_id"] + isOneToOne: false + referencedRelation: "cart" + referencedColumns: ["id"] + }, + ] + } + cart_line_item_adjustment: { + Row: { + amount: number + code: string | null + created_at: string + deleted_at: string | null + description: string | null + id: string + is_tax_inclusive: boolean + item_id: string | null + metadata: Json | null + promotion_id: string | null + provider_id: string | null + raw_amount: Json + updated_at: string + } + Insert: { + amount: number + code?: string | null + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + is_tax_inclusive?: boolean + item_id?: string | null + metadata?: Json | null + promotion_id?: string | null + provider_id?: string | null + raw_amount: Json + updated_at?: string + } + Update: { + amount?: number + code?: string | null + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + is_tax_inclusive?: boolean + item_id?: string | null + metadata?: Json | null + promotion_id?: string | null + provider_id?: string | null + raw_amount?: Json + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "cart_line_item_adjustment_item_id_foreign" + columns: ["item_id"] + isOneToOne: false + referencedRelation: "cart_line_item" + referencedColumns: ["id"] + }, + ] + } + cart_line_item_tax_line: { + Row: { + code: string + created_at: string + deleted_at: string | null + description: string | null + id: string + item_id: string | null + metadata: Json | null + provider_id: string | null + rate: number + tax_rate_id: string | null + updated_at: string + } + Insert: { + code: string + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + item_id?: string | null + metadata?: Json | null + provider_id?: string | null + rate: number + tax_rate_id?: string | null + updated_at?: string + } + Update: { + code?: string + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + item_id?: string | null + metadata?: Json | null + provider_id?: string | null + rate?: number + tax_rate_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "cart_line_item_tax_line_item_id_foreign" + columns: ["item_id"] + isOneToOne: false + referencedRelation: "cart_line_item" + referencedColumns: ["id"] + }, + ] + } + cart_payment_collection: { + Row: { + cart_id: string + created_at: string + deleted_at: string | null + id: string + payment_collection_id: string + updated_at: string + } + Insert: { + cart_id: string + created_at?: string + deleted_at?: string | null + id: string + payment_collection_id: string + updated_at?: string + } + Update: { + cart_id?: string + created_at?: string + deleted_at?: string | null + id?: string + payment_collection_id?: string + updated_at?: string + } + Relationships: [] + } + cart_promotion: { + Row: { + cart_id: string + created_at: string + deleted_at: string | null + id: string + promotion_id: string + updated_at: string + } + Insert: { + cart_id: string + created_at?: string + deleted_at?: string | null + id: string + promotion_id: string + updated_at?: string + } + Update: { + cart_id?: string + created_at?: string + deleted_at?: string | null + id?: string + promotion_id?: string + updated_at?: string + } + Relationships: [] + } + cart_shipping_method: { + Row: { + amount: number + cart_id: string + created_at: string + data: Json | null + deleted_at: string | null + description: Json | null + id: string + is_tax_inclusive: boolean + metadata: Json | null + name: string + raw_amount: Json + shipping_option_id: string | null + updated_at: string + } + Insert: { + amount: number + cart_id: string + created_at?: string + data?: Json | null + deleted_at?: string | null + description?: Json | null + id: string + is_tax_inclusive?: boolean + metadata?: Json | null + name: string + raw_amount: Json + shipping_option_id?: string | null + updated_at?: string + } + Update: { + amount?: number + cart_id?: string + created_at?: string + data?: Json | null + deleted_at?: string | null + description?: Json | null + id?: string + is_tax_inclusive?: boolean + metadata?: Json | null + name?: string + raw_amount?: Json + shipping_option_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "cart_shipping_method_cart_id_foreign" + columns: ["cart_id"] + isOneToOne: false + referencedRelation: "cart" + referencedColumns: ["id"] + }, + ] + } + cart_shipping_method_adjustment: { + Row: { + amount: number + code: string | null + created_at: string + deleted_at: string | null + description: string | null + id: string + metadata: Json | null + promotion_id: string | null + provider_id: string | null + raw_amount: Json + shipping_method_id: string | null + updated_at: string + } + Insert: { + amount: number + code?: string | null + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + metadata?: Json | null + promotion_id?: string | null + provider_id?: string | null + raw_amount: Json + shipping_method_id?: string | null + updated_at?: string + } + Update: { + amount?: number + code?: string | null + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + metadata?: Json | null + promotion_id?: string | null + provider_id?: string | null + raw_amount?: Json + shipping_method_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "cart_shipping_method_adjustment_shipping_method_id_foreign" + columns: ["shipping_method_id"] + isOneToOne: false + referencedRelation: "cart_shipping_method" + referencedColumns: ["id"] + }, + ] + } + cart_shipping_method_tax_line: { + Row: { + code: string + created_at: string + deleted_at: string | null + description: string | null + id: string + metadata: Json | null + provider_id: string | null + rate: number + shipping_method_id: string | null + tax_rate_id: string | null + updated_at: string + } + Insert: { + code: string + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + metadata?: Json | null + provider_id?: string | null + rate: number + shipping_method_id?: string | null + tax_rate_id?: string | null + updated_at?: string + } + Update: { + code?: string + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + metadata?: Json | null + provider_id?: string | null + rate?: number + shipping_method_id?: string | null + tax_rate_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "cart_shipping_method_tax_line_shipping_method_id_foreign" + columns: ["shipping_method_id"] + isOneToOne: false + referencedRelation: "cart_shipping_method" + referencedColumns: ["id"] + }, + ] + } + credit_line: { + Row: { + amount: number + cart_id: string + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + raw_amount: Json + reference: string | null + reference_id: string | null + updated_at: string + } + Insert: { + amount: number + cart_id: string + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + raw_amount: Json + reference?: string | null + reference_id?: string | null + updated_at?: string + } + Update: { + amount?: number + cart_id?: string + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + raw_amount?: Json + reference?: string | null + reference_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "credit_line_cart_id_foreign" + columns: ["cart_id"] + isOneToOne: false + referencedRelation: "cart" + referencedColumns: ["id"] + }, + ] + } + currency: { + Row: { + code: string + created_at: string + decimal_digits: number + deleted_at: string | null + name: string + raw_rounding: Json + rounding: number + symbol: string + symbol_native: string + updated_at: string + } + Insert: { + code: string + created_at?: string + decimal_digits?: number + deleted_at?: string | null + name: string + raw_rounding: Json + rounding?: number + symbol: string + symbol_native: string + updated_at?: string + } + Update: { + code?: string + created_at?: string + decimal_digits?: number + deleted_at?: string | null + name?: string + raw_rounding?: Json + rounding?: number + symbol?: string + symbol_native?: string + updated_at?: string + } + Relationships: [] + } + customer: { + Row: { + company_name: string | null + created_at: string + created_by: string | null + deleted_at: string | null + email: string | null + first_name: string | null + has_account: boolean + id: string + last_name: string | null + metadata: Json | null + phone: string | null + updated_at: string + } + Insert: { + company_name?: string | null + created_at?: string + created_by?: string | null + deleted_at?: string | null + email?: string | null + first_name?: string | null + has_account?: boolean + id: string + last_name?: string | null + metadata?: Json | null + phone?: string | null + updated_at?: string + } + Update: { + company_name?: string | null + created_at?: string + created_by?: string | null + deleted_at?: string | null + email?: string | null + first_name?: string | null + has_account?: boolean + id?: string + last_name?: string | null + metadata?: Json | null + phone?: string | null + updated_at?: string + } + Relationships: [] + } + customer_account_holder: { + Row: { + account_holder_id: string + created_at: string + customer_id: string + deleted_at: string | null + id: string + updated_at: string + } + Insert: { + account_holder_id: string + created_at?: string + customer_id: string + deleted_at?: string | null + id: string + updated_at?: string + } + Update: { + account_holder_id?: string + created_at?: string + customer_id?: string + deleted_at?: string | null + id?: string + updated_at?: string + } + Relationships: [] + } + customer_address: { + Row: { + address_1: string | null + address_2: string | null + address_name: string | null + city: string | null + company: string | null + country_code: string | null + created_at: string + customer_id: string + deleted_at: string | null + first_name: string | null + id: string + is_default_billing: boolean + is_default_shipping: boolean + last_name: string | null + metadata: Json | null + phone: string | null + postal_code: string | null + province: string | null + updated_at: string + } + Insert: { + address_1?: string | null + address_2?: string | null + address_name?: string | null + city?: string | null + company?: string | null + country_code?: string | null + created_at?: string + customer_id: string + deleted_at?: string | null + first_name?: string | null + id: string + is_default_billing?: boolean + is_default_shipping?: boolean + last_name?: string | null + metadata?: Json | null + phone?: string | null + postal_code?: string | null + province?: string | null + updated_at?: string + } + Update: { + address_1?: string | null + address_2?: string | null + address_name?: string | null + city?: string | null + company?: string | null + country_code?: string | null + created_at?: string + customer_id?: string + deleted_at?: string | null + first_name?: string | null + id?: string + is_default_billing?: boolean + is_default_shipping?: boolean + last_name?: string | null + metadata?: Json | null + phone?: string | null + postal_code?: string | null + province?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "customer_address_customer_id_foreign" + columns: ["customer_id"] + isOneToOne: false + referencedRelation: "customer" + referencedColumns: ["id"] + }, + ] + } + customer_group: { + Row: { + created_at: string + created_by: string | null + deleted_at: string | null + id: string + metadata: Json | null + name: string + updated_at: string + } + Insert: { + created_at?: string + created_by?: string | null + deleted_at?: string | null + id: string + metadata?: Json | null + name: string + updated_at?: string + } + Update: { + created_at?: string + created_by?: string | null + deleted_at?: string | null + id?: string + metadata?: Json | null + name?: string + updated_at?: string + } + Relationships: [] + } + customer_group_customer: { + Row: { + created_at: string + created_by: string | null + customer_group_id: string + customer_id: string + deleted_at: string | null + id: string + metadata: Json | null + updated_at: string + } + Insert: { + created_at?: string + created_by?: string | null + customer_group_id: string + customer_id: string + deleted_at?: string | null + id: string + metadata?: Json | null + updated_at?: string + } + Update: { + created_at?: string + created_by?: string | null + customer_group_id?: string + customer_id?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "customer_group_customer_customer_group_id_foreign" + columns: ["customer_group_id"] + isOneToOne: false + referencedRelation: "customer_group" + referencedColumns: ["id"] + }, + { + foreignKeyName: "customer_group_customer_customer_id_foreign" + columns: ["customer_id"] + isOneToOne: false + referencedRelation: "customer" + referencedColumns: ["id"] + }, + ] + } + fulfillment: { + Row: { + canceled_at: string | null + created_at: string + created_by: string | null + data: Json | null + deleted_at: string | null + delivered_at: string | null + delivery_address_id: string | null + id: string + location_id: string + marked_shipped_by: string | null + metadata: Json | null + packed_at: string | null + provider_id: string | null + requires_shipping: boolean + shipped_at: string | null + shipping_option_id: string | null + updated_at: string + } + Insert: { + canceled_at?: string | null + created_at?: string + created_by?: string | null + data?: Json | null + deleted_at?: string | null + delivered_at?: string | null + delivery_address_id?: string | null + id: string + location_id: string + marked_shipped_by?: string | null + metadata?: Json | null + packed_at?: string | null + provider_id?: string | null + requires_shipping?: boolean + shipped_at?: string | null + shipping_option_id?: string | null + updated_at?: string + } + Update: { + canceled_at?: string | null + created_at?: string + created_by?: string | null + data?: Json | null + deleted_at?: string | null + delivered_at?: string | null + delivery_address_id?: string | null + id?: string + location_id?: string + marked_shipped_by?: string | null + metadata?: Json | null + packed_at?: string | null + provider_id?: string | null + requires_shipping?: boolean + shipped_at?: string | null + shipping_option_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "fulfillment_delivery_address_id_foreign" + columns: ["delivery_address_id"] + isOneToOne: false + referencedRelation: "fulfillment_address" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fulfillment_provider_id_foreign" + columns: ["provider_id"] + isOneToOne: false + referencedRelation: "fulfillment_provider" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fulfillment_shipping_option_id_foreign" + columns: ["shipping_option_id"] + isOneToOne: false + referencedRelation: "shipping_option" + referencedColumns: ["id"] + }, + ] + } + fulfillment_address: { + Row: { + address_1: string | null + address_2: string | null + city: string | null + company: string | null + country_code: string | null + created_at: string + deleted_at: string | null + first_name: string | null + id: string + last_name: string | null + metadata: Json | null + phone: string | null + postal_code: string | null + province: string | null + updated_at: string + } + Insert: { + address_1?: string | null + address_2?: string | null + city?: string | null + company?: string | null + country_code?: string | null + created_at?: string + deleted_at?: string | null + first_name?: string | null + id: string + last_name?: string | null + metadata?: Json | null + phone?: string | null + postal_code?: string | null + province?: string | null + updated_at?: string + } + Update: { + address_1?: string | null + address_2?: string | null + city?: string | null + company?: string | null + country_code?: string | null + created_at?: string + deleted_at?: string | null + first_name?: string | null + id?: string + last_name?: string | null + metadata?: Json | null + phone?: string | null + postal_code?: string | null + province?: string | null + updated_at?: string + } + Relationships: [] + } + fulfillment_item: { + Row: { + barcode: string + created_at: string + deleted_at: string | null + fulfillment_id: string + id: string + inventory_item_id: string | null + line_item_id: string | null + quantity: number + raw_quantity: Json + sku: string + title: string + updated_at: string + } + Insert: { + barcode: string + created_at?: string + deleted_at?: string | null + fulfillment_id: string + id: string + inventory_item_id?: string | null + line_item_id?: string | null + quantity: number + raw_quantity: Json + sku: string + title: string + updated_at?: string + } + Update: { + barcode?: string + created_at?: string + deleted_at?: string | null + fulfillment_id?: string + id?: string + inventory_item_id?: string | null + line_item_id?: string | null + quantity?: number + raw_quantity?: Json + sku?: string + title?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "fulfillment_item_fulfillment_id_foreign" + columns: ["fulfillment_id"] + isOneToOne: false + referencedRelation: "fulfillment" + referencedColumns: ["id"] + }, + ] + } + fulfillment_label: { + Row: { + created_at: string + deleted_at: string | null + fulfillment_id: string + id: string + label_url: string + tracking_number: string + tracking_url: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + fulfillment_id: string + id: string + label_url: string + tracking_number: string + tracking_url: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + fulfillment_id?: string + id?: string + label_url?: string + tracking_number?: string + tracking_url?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "fulfillment_label_fulfillment_id_foreign" + columns: ["fulfillment_id"] + isOneToOne: false + referencedRelation: "fulfillment" + referencedColumns: ["id"] + }, + ] + } + fulfillment_provider: { + Row: { + created_at: string + deleted_at: string | null + id: string + is_enabled: boolean + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + is_enabled?: boolean + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + is_enabled?: boolean + updated_at?: string + } + Relationships: [] + } + fulfillment_set: { + Row: { + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + name: string + type: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + name: string + type: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + name?: string + type?: string + updated_at?: string + } + Relationships: [] + } + geo_zone: { + Row: { + city: string | null + country_code: string + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + postal_expression: Json | null + province_code: string | null + service_zone_id: string + type: string + updated_at: string + } + Insert: { + city?: string | null + country_code: string + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + postal_expression?: Json | null + province_code?: string | null + service_zone_id: string + type?: string + updated_at?: string + } + Update: { + city?: string | null + country_code?: string + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + postal_expression?: Json | null + province_code?: string | null + service_zone_id?: string + type?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "geo_zone_service_zone_id_foreign" + columns: ["service_zone_id"] + isOneToOne: false + referencedRelation: "service_zone" + referencedColumns: ["id"] + }, + ] + } + image: { + Row: { + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + product_id: string + rank: number + updated_at: string + url: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + product_id: string + rank?: number + updated_at?: string + url: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + product_id?: string + rank?: number + updated_at?: string + url?: string + } + Relationships: [ + { + foreignKeyName: "image_product_id_foreign" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "product" + referencedColumns: ["id"] + }, + ] + } + inventory_item: { + Row: { + created_at: string + deleted_at: string | null + description: string | null + height: number | null + hs_code: string | null + id: string + length: number | null + material: string | null + metadata: Json | null + mid_code: string | null + origin_country: string | null + requires_shipping: boolean + sku: string | null + thumbnail: string | null + title: string | null + updated_at: string + weight: number | null + width: number | null + } + Insert: { + created_at?: string + deleted_at?: string | null + description?: string | null + height?: number | null + hs_code?: string | null + id: string + length?: number | null + material?: string | null + metadata?: Json | null + mid_code?: string | null + origin_country?: string | null + requires_shipping?: boolean + sku?: string | null + thumbnail?: string | null + title?: string | null + updated_at?: string + weight?: number | null + width?: number | null + } + Update: { + created_at?: string + deleted_at?: string | null + description?: string | null + height?: number | null + hs_code?: string | null + id?: string + length?: number | null + material?: string | null + metadata?: Json | null + mid_code?: string | null + origin_country?: string | null + requires_shipping?: boolean + sku?: string | null + thumbnail?: string | null + title?: string | null + updated_at?: string + weight?: number | null + width?: number | null + } + Relationships: [] + } + inventory_level: { + Row: { + created_at: string + deleted_at: string | null + id: string + incoming_quantity: number + inventory_item_id: string + location_id: string + metadata: Json | null + raw_incoming_quantity: Json | null + raw_reserved_quantity: Json | null + raw_stocked_quantity: Json | null + reserved_quantity: number + stocked_quantity: number + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + incoming_quantity?: number + inventory_item_id: string + location_id: string + metadata?: Json | null + raw_incoming_quantity?: Json | null + raw_reserved_quantity?: Json | null + raw_stocked_quantity?: Json | null + reserved_quantity?: number + stocked_quantity?: number + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + incoming_quantity?: number + inventory_item_id?: string + location_id?: string + metadata?: Json | null + raw_incoming_quantity?: Json | null + raw_reserved_quantity?: Json | null + raw_stocked_quantity?: Json | null + reserved_quantity?: number + stocked_quantity?: number + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "inventory_level_inventory_item_id_foreign" + columns: ["inventory_item_id"] + isOneToOne: false + referencedRelation: "inventory_item" + referencedColumns: ["id"] + }, + ] + } + invite: { + Row: { + accepted: boolean + created_at: string + deleted_at: string | null + email: string + expires_at: string + id: string + metadata: Json | null + token: string + updated_at: string + } + Insert: { + accepted?: boolean + created_at?: string + deleted_at?: string | null + email: string + expires_at: string + id: string + metadata?: Json | null + token: string + updated_at?: string + } + Update: { + accepted?: boolean + created_at?: string + deleted_at?: string | null + email?: string + expires_at?: string + id?: string + metadata?: Json | null + token?: string + updated_at?: string + } + Relationships: [] + } + link_module_migrations: { + Row: { + created_at: string | null + id: number + link_descriptor: Json + table_name: string + } + Insert: { + created_at?: string | null + id?: number + link_descriptor?: Json + table_name: string + } + Update: { + created_at?: string | null + id?: number + link_descriptor?: Json + table_name?: string + } + Relationships: [] + } + location_fulfillment_provider: { + Row: { + created_at: string + deleted_at: string | null + fulfillment_provider_id: string + id: string + stock_location_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + fulfillment_provider_id: string + id: string + stock_location_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + fulfillment_provider_id?: string + id?: string + stock_location_id?: string + updated_at?: string + } + Relationships: [] + } + location_fulfillment_set: { + Row: { + created_at: string + deleted_at: string | null + fulfillment_set_id: string + id: string + stock_location_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + fulfillment_set_id: string + id: string + stock_location_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + fulfillment_set_id?: string + id?: string + stock_location_id?: string + updated_at?: string + } + Relationships: [] + } + mikro_orm_migrations: { + Row: { + executed_at: string | null + id: number + name: string | null + } + Insert: { + executed_at?: string | null + id?: number + name?: string | null + } + Update: { + executed_at?: string | null + id?: number + name?: string | null + } + Relationships: [] + } + notification: { + Row: { + channel: string + created_at: string + data: Json | null + deleted_at: string | null + external_id: string | null + id: string + idempotency_key: string | null + original_notification_id: string | null + provider_id: string | null + receiver_id: string | null + resource_id: string | null + resource_type: string | null + status: string + template: string + to: string + trigger_type: string | null + updated_at: string + } + Insert: { + channel: string + created_at?: string + data?: Json | null + deleted_at?: string | null + external_id?: string | null + id: string + idempotency_key?: string | null + original_notification_id?: string | null + provider_id?: string | null + receiver_id?: string | null + resource_id?: string | null + resource_type?: string | null + status?: string + template: string + to: string + trigger_type?: string | null + updated_at?: string + } + Update: { + channel?: string + created_at?: string + data?: Json | null + deleted_at?: string | null + external_id?: string | null + id?: string + idempotency_key?: string | null + original_notification_id?: string | null + provider_id?: string | null + receiver_id?: string | null + resource_id?: string | null + resource_type?: string | null + status?: string + template?: string + to?: string + trigger_type?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "notification_provider_id_foreign" + columns: ["provider_id"] + isOneToOne: false + referencedRelation: "notification_provider" + referencedColumns: ["id"] + }, + ] + } + notification_provider: { + Row: { + channels: string[] + created_at: string + deleted_at: string | null + handle: string + id: string + is_enabled: boolean + name: string + updated_at: string + } + Insert: { + channels?: string[] + created_at?: string + deleted_at?: string | null + handle: string + id: string + is_enabled?: boolean + name: string + updated_at?: string + } + Update: { + channels?: string[] + created_at?: string + deleted_at?: string | null + handle?: string + id?: string + is_enabled?: boolean + name?: string + updated_at?: string + } + Relationships: [] + } + order: { + Row: { + billing_address_id: string | null + canceled_at: string | null + created_at: string + currency_code: string + customer_id: string | null + deleted_at: string | null + display_id: number | null + email: string | null + id: string + is_draft_order: boolean + metadata: Json | null + no_notification: boolean | null + region_id: string | null + sales_channel_id: string | null + shipping_address_id: string | null + status: Database["public"]["Enums"]["order_status_enum"] + updated_at: string + version: number + } + Insert: { + billing_address_id?: string | null + canceled_at?: string | null + created_at?: string + currency_code: string + customer_id?: string | null + deleted_at?: string | null + display_id?: number | null + email?: string | null + id: string + is_draft_order?: boolean + metadata?: Json | null + no_notification?: boolean | null + region_id?: string | null + sales_channel_id?: string | null + shipping_address_id?: string | null + status?: Database["public"]["Enums"]["order_status_enum"] + updated_at?: string + version?: number + } + Update: { + billing_address_id?: string | null + canceled_at?: string | null + created_at?: string + currency_code?: string + customer_id?: string | null + deleted_at?: string | null + display_id?: number | null + email?: string | null + id?: string + is_draft_order?: boolean + metadata?: Json | null + no_notification?: boolean | null + region_id?: string | null + sales_channel_id?: string | null + shipping_address_id?: string | null + status?: Database["public"]["Enums"]["order_status_enum"] + updated_at?: string + version?: number + } + Relationships: [ + { + foreignKeyName: "order_billing_address_id_foreign" + columns: ["billing_address_id"] + isOneToOne: false + referencedRelation: "order_address" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_shipping_address_id_foreign" + columns: ["shipping_address_id"] + isOneToOne: false + referencedRelation: "order_address" + referencedColumns: ["id"] + }, + ] + } + order_address: { + Row: { + address_1: string | null + address_2: string | null + city: string | null + company: string | null + country_code: string | null + created_at: string + customer_id: string | null + deleted_at: string | null + first_name: string | null + id: string + last_name: string | null + metadata: Json | null + phone: string | null + postal_code: string | null + province: string | null + updated_at: string + } + Insert: { + address_1?: string | null + address_2?: string | null + city?: string | null + company?: string | null + country_code?: string | null + created_at?: string + customer_id?: string | null + deleted_at?: string | null + first_name?: string | null + id: string + last_name?: string | null + metadata?: Json | null + phone?: string | null + postal_code?: string | null + province?: string | null + updated_at?: string + } + Update: { + address_1?: string | null + address_2?: string | null + city?: string | null + company?: string | null + country_code?: string | null + created_at?: string + customer_id?: string | null + deleted_at?: string | null + first_name?: string | null + id?: string + last_name?: string | null + metadata?: Json | null + phone?: string | null + postal_code?: string | null + province?: string | null + updated_at?: string + } + Relationships: [] + } + order_cart: { + Row: { + cart_id: string + created_at: string + deleted_at: string | null + id: string + order_id: string + updated_at: string + } + Insert: { + cart_id: string + created_at?: string + deleted_at?: string | null + id: string + order_id: string + updated_at?: string + } + Update: { + cart_id?: string + created_at?: string + deleted_at?: string | null + id?: string + order_id?: string + updated_at?: string + } + Relationships: [] + } + order_change: { + Row: { + canceled_at: string | null + canceled_by: string | null + change_type: string | null + claim_id: string | null + confirmed_at: string | null + confirmed_by: string | null + created_at: string + created_by: string | null + declined_at: string | null + declined_by: string | null + declined_reason: string | null + deleted_at: string | null + description: string | null + exchange_id: string | null + id: string + internal_note: string | null + metadata: Json | null + order_id: string + requested_at: string | null + requested_by: string | null + return_id: string | null + status: string + updated_at: string + version: number + } + Insert: { + canceled_at?: string | null + canceled_by?: string | null + change_type?: string | null + claim_id?: string | null + confirmed_at?: string | null + confirmed_by?: string | null + created_at?: string + created_by?: string | null + declined_at?: string | null + declined_by?: string | null + declined_reason?: string | null + deleted_at?: string | null + description?: string | null + exchange_id?: string | null + id: string + internal_note?: string | null + metadata?: Json | null + order_id: string + requested_at?: string | null + requested_by?: string | null + return_id?: string | null + status?: string + updated_at?: string + version: number + } + Update: { + canceled_at?: string | null + canceled_by?: string | null + change_type?: string | null + claim_id?: string | null + confirmed_at?: string | null + confirmed_by?: string | null + created_at?: string + created_by?: string | null + declined_at?: string | null + declined_by?: string | null + declined_reason?: string | null + deleted_at?: string | null + description?: string | null + exchange_id?: string | null + id?: string + internal_note?: string | null + metadata?: Json | null + order_id?: string + requested_at?: string | null + requested_by?: string | null + return_id?: string | null + status?: string + updated_at?: string + version?: number + } + Relationships: [ + { + foreignKeyName: "order_change_order_id_foreign" + columns: ["order_id"] + isOneToOne: false + referencedRelation: "order" + referencedColumns: ["id"] + }, + ] + } + order_change_action: { + Row: { + action: string + amount: number | null + applied: boolean + claim_id: string | null + created_at: string + deleted_at: string | null + details: Json | null + exchange_id: string | null + id: string + internal_note: string | null + order_change_id: string | null + order_id: string | null + ordering: number + raw_amount: Json | null + reference: string | null + reference_id: string | null + return_id: string | null + updated_at: string + version: number | null + } + Insert: { + action: string + amount?: number | null + applied?: boolean + claim_id?: string | null + created_at?: string + deleted_at?: string | null + details?: Json | null + exchange_id?: string | null + id: string + internal_note?: string | null + order_change_id?: string | null + order_id?: string | null + ordering?: number + raw_amount?: Json | null + reference?: string | null + reference_id?: string | null + return_id?: string | null + updated_at?: string + version?: number | null + } + Update: { + action?: string + amount?: number | null + applied?: boolean + claim_id?: string | null + created_at?: string + deleted_at?: string | null + details?: Json | null + exchange_id?: string | null + id?: string + internal_note?: string | null + order_change_id?: string | null + order_id?: string | null + ordering?: number + raw_amount?: Json | null + reference?: string | null + reference_id?: string | null + return_id?: string | null + updated_at?: string + version?: number | null + } + Relationships: [ + { + foreignKeyName: "order_change_action_order_change_id_foreign" + columns: ["order_change_id"] + isOneToOne: false + referencedRelation: "order_change" + referencedColumns: ["id"] + }, + ] + } + order_claim: { + Row: { + canceled_at: string | null + created_at: string + created_by: string | null + deleted_at: string | null + display_id: number + id: string + metadata: Json | null + no_notification: boolean | null + order_id: string + order_version: number + raw_refund_amount: Json | null + refund_amount: number | null + return_id: string | null + type: Database["public"]["Enums"]["order_claim_type_enum"] + updated_at: string + } + Insert: { + canceled_at?: string | null + created_at?: string + created_by?: string | null + deleted_at?: string | null + display_id?: number + id: string + metadata?: Json | null + no_notification?: boolean | null + order_id: string + order_version: number + raw_refund_amount?: Json | null + refund_amount?: number | null + return_id?: string | null + type: Database["public"]["Enums"]["order_claim_type_enum"] + updated_at?: string + } + Update: { + canceled_at?: string | null + created_at?: string + created_by?: string | null + deleted_at?: string | null + display_id?: number + id?: string + metadata?: Json | null + no_notification?: boolean | null + order_id?: string + order_version?: number + raw_refund_amount?: Json | null + refund_amount?: number | null + return_id?: string | null + type?: Database["public"]["Enums"]["order_claim_type_enum"] + updated_at?: string + } + Relationships: [] + } + order_claim_item: { + Row: { + claim_id: string + created_at: string + deleted_at: string | null + id: string + is_additional_item: boolean + item_id: string + metadata: Json | null + note: string | null + quantity: number + raw_quantity: Json + reason: Database["public"]["Enums"]["claim_reason_enum"] | null + updated_at: string + } + Insert: { + claim_id: string + created_at?: string + deleted_at?: string | null + id: string + is_additional_item?: boolean + item_id: string + metadata?: Json | null + note?: string | null + quantity: number + raw_quantity: Json + reason?: Database["public"]["Enums"]["claim_reason_enum"] | null + updated_at?: string + } + Update: { + claim_id?: string + created_at?: string + deleted_at?: string | null + id?: string + is_additional_item?: boolean + item_id?: string + metadata?: Json | null + note?: string | null + quantity?: number + raw_quantity?: Json + reason?: Database["public"]["Enums"]["claim_reason_enum"] | null + updated_at?: string + } + Relationships: [] + } + order_claim_item_image: { + Row: { + claim_item_id: string + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + updated_at: string + url: string + } + Insert: { + claim_item_id: string + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + updated_at?: string + url: string + } + Update: { + claim_item_id?: string + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + updated_at?: string + url?: string + } + Relationships: [] + } + order_credit_line: { + Row: { + amount: number + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + order_id: string + raw_amount: Json + reference: string | null + reference_id: string | null + updated_at: string + } + Insert: { + amount: number + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + order_id: string + raw_amount: Json + reference?: string | null + reference_id?: string | null + updated_at?: string + } + Update: { + amount?: number + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + order_id?: string + raw_amount?: Json + reference?: string | null + reference_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "order_credit_line_order_id_foreign" + columns: ["order_id"] + isOneToOne: false + referencedRelation: "order" + referencedColumns: ["id"] + }, + ] + } + order_exchange: { + Row: { + allow_backorder: boolean + canceled_at: string | null + created_at: string + created_by: string | null + deleted_at: string | null + difference_due: number | null + display_id: number + id: string + metadata: Json | null + no_notification: boolean | null + order_id: string + order_version: number + raw_difference_due: Json | null + return_id: string | null + updated_at: string + } + Insert: { + allow_backorder?: boolean + canceled_at?: string | null + created_at?: string + created_by?: string | null + deleted_at?: string | null + difference_due?: number | null + display_id?: number + id: string + metadata?: Json | null + no_notification?: boolean | null + order_id: string + order_version: number + raw_difference_due?: Json | null + return_id?: string | null + updated_at?: string + } + Update: { + allow_backorder?: boolean + canceled_at?: string | null + created_at?: string + created_by?: string | null + deleted_at?: string | null + difference_due?: number | null + display_id?: number + id?: string + metadata?: Json | null + no_notification?: boolean | null + order_id?: string + order_version?: number + raw_difference_due?: Json | null + return_id?: string | null + updated_at?: string + } + Relationships: [] + } + order_exchange_item: { + Row: { + created_at: string + deleted_at: string | null + exchange_id: string + id: string + item_id: string + metadata: Json | null + note: string | null + quantity: number + raw_quantity: Json + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + exchange_id: string + id: string + item_id: string + metadata?: Json | null + note?: string | null + quantity: number + raw_quantity: Json + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + exchange_id?: string + id?: string + item_id?: string + metadata?: Json | null + note?: string | null + quantity?: number + raw_quantity?: Json + updated_at?: string + } + Relationships: [] + } + order_fulfillment: { + Row: { + created_at: string + deleted_at: string | null + fulfillment_id: string + id: string + order_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + fulfillment_id: string + id: string + order_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + fulfillment_id?: string + id?: string + order_id?: string + updated_at?: string + } + Relationships: [] + } + order_item: { + Row: { + compare_at_unit_price: number | null + created_at: string + deleted_at: string | null + delivered_quantity: number + fulfilled_quantity: number + id: string + item_id: string + metadata: Json | null + order_id: string + quantity: number + raw_compare_at_unit_price: Json | null + raw_delivered_quantity: Json + raw_fulfilled_quantity: Json + raw_quantity: Json + raw_return_dismissed_quantity: Json + raw_return_received_quantity: Json + raw_return_requested_quantity: Json + raw_shipped_quantity: Json + raw_unit_price: Json | null + raw_written_off_quantity: Json + return_dismissed_quantity: number + return_received_quantity: number + return_requested_quantity: number + shipped_quantity: number + unit_price: number | null + updated_at: string + version: number + written_off_quantity: number + } + Insert: { + compare_at_unit_price?: number | null + created_at?: string + deleted_at?: string | null + delivered_quantity?: number + fulfilled_quantity: number + id: string + item_id: string + metadata?: Json | null + order_id: string + quantity: number + raw_compare_at_unit_price?: Json | null + raw_delivered_quantity: Json + raw_fulfilled_quantity: Json + raw_quantity: Json + raw_return_dismissed_quantity: Json + raw_return_received_quantity: Json + raw_return_requested_quantity: Json + raw_shipped_quantity: Json + raw_unit_price?: Json | null + raw_written_off_quantity: Json + return_dismissed_quantity: number + return_received_quantity: number + return_requested_quantity: number + shipped_quantity: number + unit_price?: number | null + updated_at?: string + version: number + written_off_quantity: number + } + Update: { + compare_at_unit_price?: number | null + created_at?: string + deleted_at?: string | null + delivered_quantity?: number + fulfilled_quantity?: number + id?: string + item_id?: string + metadata?: Json | null + order_id?: string + quantity?: number + raw_compare_at_unit_price?: Json | null + raw_delivered_quantity?: Json + raw_fulfilled_quantity?: Json + raw_quantity?: Json + raw_return_dismissed_quantity?: Json + raw_return_received_quantity?: Json + raw_return_requested_quantity?: Json + raw_shipped_quantity?: Json + raw_unit_price?: Json | null + raw_written_off_quantity?: Json + return_dismissed_quantity?: number + return_received_quantity?: number + return_requested_quantity?: number + shipped_quantity?: number + unit_price?: number | null + updated_at?: string + version?: number + written_off_quantity?: number + } + Relationships: [ + { + foreignKeyName: "order_item_item_id_foreign" + columns: ["item_id"] + isOneToOne: false + referencedRelation: "order_line_item" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_item_order_id_foreign" + columns: ["order_id"] + isOneToOne: false + referencedRelation: "order" + referencedColumns: ["id"] + }, + ] + } + order_line_item: { + Row: { + compare_at_unit_price: number | null + created_at: string + deleted_at: string | null + id: string + is_custom_price: boolean + is_discountable: boolean + is_giftcard: boolean + is_tax_inclusive: boolean + metadata: Json | null + product_collection: string | null + product_description: string | null + product_handle: string | null + product_id: string | null + product_subtitle: string | null + product_title: string | null + product_type: string | null + product_type_id: string | null + raw_compare_at_unit_price: Json | null + raw_unit_price: Json + requires_shipping: boolean + subtitle: string | null + thumbnail: string | null + title: string + totals_id: string | null + unit_price: number + updated_at: string + variant_barcode: string | null + variant_id: string | null + variant_option_values: Json | null + variant_sku: string | null + variant_title: string | null + } + Insert: { + compare_at_unit_price?: number | null + created_at?: string + deleted_at?: string | null + id: string + is_custom_price?: boolean + is_discountable?: boolean + is_giftcard?: boolean + is_tax_inclusive?: boolean + metadata?: Json | null + product_collection?: string | null + product_description?: string | null + product_handle?: string | null + product_id?: string | null + product_subtitle?: string | null + product_title?: string | null + product_type?: string | null + product_type_id?: string | null + raw_compare_at_unit_price?: Json | null + raw_unit_price: Json + requires_shipping?: boolean + subtitle?: string | null + thumbnail?: string | null + title: string + totals_id?: string | null + unit_price: number + updated_at?: string + variant_barcode?: string | null + variant_id?: string | null + variant_option_values?: Json | null + variant_sku?: string | null + variant_title?: string | null + } + Update: { + compare_at_unit_price?: number | null + created_at?: string + deleted_at?: string | null + id?: string + is_custom_price?: boolean + is_discountable?: boolean + is_giftcard?: boolean + is_tax_inclusive?: boolean + metadata?: Json | null + product_collection?: string | null + product_description?: string | null + product_handle?: string | null + product_id?: string | null + product_subtitle?: string | null + product_title?: string | null + product_type?: string | null + product_type_id?: string | null + raw_compare_at_unit_price?: Json | null + raw_unit_price?: Json + requires_shipping?: boolean + subtitle?: string | null + thumbnail?: string | null + title?: string + totals_id?: string | null + unit_price?: number + updated_at?: string + variant_barcode?: string | null + variant_id?: string | null + variant_option_values?: Json | null + variant_sku?: string | null + variant_title?: string | null + } + Relationships: [ + { + foreignKeyName: "order_line_item_totals_id_foreign" + columns: ["totals_id"] + isOneToOne: false + referencedRelation: "order_item" + referencedColumns: ["id"] + }, + ] + } + order_line_item_adjustment: { + Row: { + amount: number + code: string | null + created_at: string + deleted_at: string | null + description: string | null + id: string + item_id: string + promotion_id: string | null + provider_id: string | null + raw_amount: Json + updated_at: string + } + Insert: { + amount: number + code?: string | null + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + item_id: string + promotion_id?: string | null + provider_id?: string | null + raw_amount: Json + updated_at?: string + } + Update: { + amount?: number + code?: string | null + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + item_id?: string + promotion_id?: string | null + provider_id?: string | null + raw_amount?: Json + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "order_line_item_adjustment_item_id_foreign" + columns: ["item_id"] + isOneToOne: false + referencedRelation: "order_line_item" + referencedColumns: ["id"] + }, + ] + } + order_line_item_tax_line: { + Row: { + code: string + created_at: string + deleted_at: string | null + description: string | null + id: string + item_id: string + provider_id: string | null + rate: number + raw_rate: Json + tax_rate_id: string | null + updated_at: string + } + Insert: { + code: string + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + item_id: string + provider_id?: string | null + rate: number + raw_rate: Json + tax_rate_id?: string | null + updated_at?: string + } + Update: { + code?: string + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + item_id?: string + provider_id?: string | null + rate?: number + raw_rate?: Json + tax_rate_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "order_line_item_tax_line_item_id_foreign" + columns: ["item_id"] + isOneToOne: false + referencedRelation: "order_line_item" + referencedColumns: ["id"] + }, + ] + } + order_payment_collection: { + Row: { + created_at: string + deleted_at: string | null + id: string + order_id: string + payment_collection_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + order_id: string + payment_collection_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + order_id?: string + payment_collection_id?: string + updated_at?: string + } + Relationships: [] + } + order_promotion: { + Row: { + created_at: string + deleted_at: string | null + id: string + order_id: string + promotion_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + order_id: string + promotion_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + order_id?: string + promotion_id?: string + updated_at?: string + } + Relationships: [] + } + order_shipping: { + Row: { + claim_id: string | null + created_at: string + deleted_at: string | null + exchange_id: string | null + id: string + order_id: string + return_id: string | null + shipping_method_id: string + updated_at: string + version: number + } + Insert: { + claim_id?: string | null + created_at?: string + deleted_at?: string | null + exchange_id?: string | null + id: string + order_id: string + return_id?: string | null + shipping_method_id: string + updated_at?: string + version: number + } + Update: { + claim_id?: string | null + created_at?: string + deleted_at?: string | null + exchange_id?: string | null + id?: string + order_id?: string + return_id?: string | null + shipping_method_id?: string + updated_at?: string + version?: number + } + Relationships: [ + { + foreignKeyName: "order_shipping_order_id_foreign" + columns: ["order_id"] + isOneToOne: false + referencedRelation: "order" + referencedColumns: ["id"] + }, + ] + } + order_shipping_method: { + Row: { + amount: number + created_at: string + data: Json | null + deleted_at: string | null + description: Json | null + id: string + is_custom_amount: boolean + is_tax_inclusive: boolean + metadata: Json | null + name: string + raw_amount: Json + shipping_option_id: string | null + updated_at: string + } + Insert: { + amount: number + created_at?: string + data?: Json | null + deleted_at?: string | null + description?: Json | null + id: string + is_custom_amount?: boolean + is_tax_inclusive?: boolean + metadata?: Json | null + name: string + raw_amount: Json + shipping_option_id?: string | null + updated_at?: string + } + Update: { + amount?: number + created_at?: string + data?: Json | null + deleted_at?: string | null + description?: Json | null + id?: string + is_custom_amount?: boolean + is_tax_inclusive?: boolean + metadata?: Json | null + name?: string + raw_amount?: Json + shipping_option_id?: string | null + updated_at?: string + } + Relationships: [] + } + order_shipping_method_adjustment: { + Row: { + amount: number + code: string | null + created_at: string + deleted_at: string | null + description: string | null + id: string + promotion_id: string | null + provider_id: string | null + raw_amount: Json + shipping_method_id: string + updated_at: string + } + Insert: { + amount: number + code?: string | null + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + promotion_id?: string | null + provider_id?: string | null + raw_amount: Json + shipping_method_id: string + updated_at?: string + } + Update: { + amount?: number + code?: string | null + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + promotion_id?: string | null + provider_id?: string | null + raw_amount?: Json + shipping_method_id?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "order_shipping_method_adjustment_shipping_method_id_foreign" + columns: ["shipping_method_id"] + isOneToOne: false + referencedRelation: "order_shipping_method" + referencedColumns: ["id"] + }, + ] + } + order_shipping_method_tax_line: { + Row: { + code: string + created_at: string + deleted_at: string | null + description: string | null + id: string + provider_id: string | null + rate: number + raw_rate: Json + shipping_method_id: string + tax_rate_id: string | null + updated_at: string + } + Insert: { + code: string + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + provider_id?: string | null + rate: number + raw_rate: Json + shipping_method_id: string + tax_rate_id?: string | null + updated_at?: string + } + Update: { + code?: string + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + provider_id?: string | null + rate?: number + raw_rate?: Json + shipping_method_id?: string + tax_rate_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "order_shipping_method_tax_line_shipping_method_id_foreign" + columns: ["shipping_method_id"] + isOneToOne: false + referencedRelation: "order_shipping_method" + referencedColumns: ["id"] + }, + ] + } + order_summary: { + Row: { + created_at: string + deleted_at: string | null + id: string + order_id: string + totals: Json | null + updated_at: string + version: number + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + order_id: string + totals?: Json | null + updated_at?: string + version?: number + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + order_id?: string + totals?: Json | null + updated_at?: string + version?: number + } + Relationships: [ + { + foreignKeyName: "order_summary_order_id_foreign" + columns: ["order_id"] + isOneToOne: false + referencedRelation: "order" + referencedColumns: ["id"] + }, + ] + } + order_transaction: { + Row: { + amount: number + claim_id: string | null + created_at: string + currency_code: string + deleted_at: string | null + exchange_id: string | null + id: string + order_id: string + raw_amount: Json + reference: string | null + reference_id: string | null + return_id: string | null + updated_at: string + version: number + } + Insert: { + amount: number + claim_id?: string | null + created_at?: string + currency_code: string + deleted_at?: string | null + exchange_id?: string | null + id: string + order_id: string + raw_amount: Json + reference?: string | null + reference_id?: string | null + return_id?: string | null + updated_at?: string + version?: number + } + Update: { + amount?: number + claim_id?: string | null + created_at?: string + currency_code?: string + deleted_at?: string | null + exchange_id?: string | null + id?: string + order_id?: string + raw_amount?: Json + reference?: string | null + reference_id?: string | null + return_id?: string | null + updated_at?: string + version?: number + } + Relationships: [ + { + foreignKeyName: "order_transaction_order_id_foreign" + columns: ["order_id"] + isOneToOne: false + referencedRelation: "order" + referencedColumns: ["id"] + }, + ] + } + payment: { + Row: { + amount: number + canceled_at: string | null + captured_at: string | null + created_at: string + currency_code: string + data: Json | null + deleted_at: string | null + id: string + metadata: Json | null + payment_collection_id: string + payment_session_id: string + provider_id: string + raw_amount: Json + updated_at: string + } + Insert: { + amount: number + canceled_at?: string | null + captured_at?: string | null + created_at?: string + currency_code: string + data?: Json | null + deleted_at?: string | null + id: string + metadata?: Json | null + payment_collection_id: string + payment_session_id: string + provider_id: string + raw_amount: Json + updated_at?: string + } + Update: { + amount?: number + canceled_at?: string | null + captured_at?: string | null + created_at?: string + currency_code?: string + data?: Json | null + deleted_at?: string | null + id?: string + metadata?: Json | null + payment_collection_id?: string + payment_session_id?: string + provider_id?: string + raw_amount?: Json + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "payment_payment_collection_id_foreign" + columns: ["payment_collection_id"] + isOneToOne: false + referencedRelation: "payment_collection" + referencedColumns: ["id"] + }, + ] + } + payment_collection: { + Row: { + amount: number + authorized_amount: number | null + captured_amount: number | null + completed_at: string | null + created_at: string + currency_code: string + deleted_at: string | null + id: string + metadata: Json | null + raw_amount: Json + raw_authorized_amount: Json | null + raw_captured_amount: Json | null + raw_refunded_amount: Json | null + refunded_amount: number | null + status: string + updated_at: string + } + Insert: { + amount: number + authorized_amount?: number | null + captured_amount?: number | null + completed_at?: string | null + created_at?: string + currency_code: string + deleted_at?: string | null + id: string + metadata?: Json | null + raw_amount: Json + raw_authorized_amount?: Json | null + raw_captured_amount?: Json | null + raw_refunded_amount?: Json | null + refunded_amount?: number | null + status?: string + updated_at?: string + } + Update: { + amount?: number + authorized_amount?: number | null + captured_amount?: number | null + completed_at?: string | null + created_at?: string + currency_code?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + raw_amount?: Json + raw_authorized_amount?: Json | null + raw_captured_amount?: Json | null + raw_refunded_amount?: Json | null + refunded_amount?: number | null + status?: string + updated_at?: string + } + Relationships: [] + } + payment_collection_payment_providers: { + Row: { + payment_collection_id: string + payment_provider_id: string + } + Insert: { + payment_collection_id: string + payment_provider_id: string + } + Update: { + payment_collection_id?: string + payment_provider_id?: string + } + Relationships: [ + { + foreignKeyName: "payment_collection_payment_providers_payment_col_aa276_foreign" + columns: ["payment_collection_id"] + isOneToOne: false + referencedRelation: "payment_collection" + referencedColumns: ["id"] + }, + { + foreignKeyName: "payment_collection_payment_providers_payment_pro_2d555_foreign" + columns: ["payment_provider_id"] + isOneToOne: false + referencedRelation: "payment_provider" + referencedColumns: ["id"] + }, + ] + } + payment_provider: { + Row: { + created_at: string + deleted_at: string | null + id: string + is_enabled: boolean + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + is_enabled?: boolean + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + is_enabled?: boolean + updated_at?: string + } + Relationships: [] + } + payment_session: { + Row: { + amount: number + authorized_at: string | null + context: Json | null + created_at: string + currency_code: string + data: Json + deleted_at: string | null + id: string + metadata: Json | null + payment_collection_id: string + provider_id: string + raw_amount: Json + status: string + updated_at: string + } + Insert: { + amount: number + authorized_at?: string | null + context?: Json | null + created_at?: string + currency_code: string + data?: Json + deleted_at?: string | null + id: string + metadata?: Json | null + payment_collection_id: string + provider_id: string + raw_amount: Json + status?: string + updated_at?: string + } + Update: { + amount?: number + authorized_at?: string | null + context?: Json | null + created_at?: string + currency_code?: string + data?: Json + deleted_at?: string | null + id?: string + metadata?: Json | null + payment_collection_id?: string + provider_id?: string + raw_amount?: Json + status?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "payment_session_payment_collection_id_foreign" + columns: ["payment_collection_id"] + isOneToOne: false + referencedRelation: "payment_collection" + referencedColumns: ["id"] + }, + ] + } + price: { + Row: { + amount: number + created_at: string + currency_code: string + deleted_at: string | null + id: string + max_quantity: number | null + min_quantity: number | null + price_list_id: string | null + price_set_id: string + raw_amount: Json + rules_count: number | null + title: string | null + updated_at: string + } + Insert: { + amount: number + created_at?: string + currency_code: string + deleted_at?: string | null + id: string + max_quantity?: number | null + min_quantity?: number | null + price_list_id?: string | null + price_set_id: string + raw_amount: Json + rules_count?: number | null + title?: string | null + updated_at?: string + } + Update: { + amount?: number + created_at?: string + currency_code?: string + deleted_at?: string | null + id?: string + max_quantity?: number | null + min_quantity?: number | null + price_list_id?: string | null + price_set_id?: string + raw_amount?: Json + rules_count?: number | null + title?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "price_price_list_id_foreign" + columns: ["price_list_id"] + isOneToOne: false + referencedRelation: "price_list" + referencedColumns: ["id"] + }, + { + foreignKeyName: "price_price_set_id_foreign" + columns: ["price_set_id"] + isOneToOne: false + referencedRelation: "price_set" + referencedColumns: ["id"] + }, + ] + } + price_list: { + Row: { + created_at: string + deleted_at: string | null + description: string + ends_at: string | null + id: string + rules_count: number | null + starts_at: string | null + status: string + title: string + type: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + description: string + ends_at?: string | null + id: string + rules_count?: number | null + starts_at?: string | null + status?: string + title: string + type?: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + description?: string + ends_at?: string | null + id?: string + rules_count?: number | null + starts_at?: string | null + status?: string + title?: string + type?: string + updated_at?: string + } + Relationships: [] + } + price_list_rule: { + Row: { + attribute: string + created_at: string + deleted_at: string | null + id: string + price_list_id: string + updated_at: string + value: Json | null + } + Insert: { + attribute?: string + created_at?: string + deleted_at?: string | null + id: string + price_list_id: string + updated_at?: string + value?: Json | null + } + Update: { + attribute?: string + created_at?: string + deleted_at?: string | null + id?: string + price_list_id?: string + updated_at?: string + value?: Json | null + } + Relationships: [ + { + foreignKeyName: "price_list_rule_price_list_id_foreign" + columns: ["price_list_id"] + isOneToOne: false + referencedRelation: "price_list" + referencedColumns: ["id"] + }, + ] + } + price_preference: { + Row: { + attribute: string + created_at: string + deleted_at: string | null + id: string + is_tax_inclusive: boolean + updated_at: string + value: string | null + } + Insert: { + attribute: string + created_at?: string + deleted_at?: string | null + id: string + is_tax_inclusive?: boolean + updated_at?: string + value?: string | null + } + Update: { + attribute?: string + created_at?: string + deleted_at?: string | null + id?: string + is_tax_inclusive?: boolean + updated_at?: string + value?: string | null + } + Relationships: [] + } + price_rule: { + Row: { + attribute: string + created_at: string + deleted_at: string | null + id: string + operator: string + price_id: string + priority: number + updated_at: string + value: string + } + Insert: { + attribute?: string + created_at?: string + deleted_at?: string | null + id: string + operator?: string + price_id: string + priority?: number + updated_at?: string + value: string + } + Update: { + attribute?: string + created_at?: string + deleted_at?: string | null + id?: string + operator?: string + price_id?: string + priority?: number + updated_at?: string + value?: string + } + Relationships: [ + { + foreignKeyName: "price_rule_price_id_foreign" + columns: ["price_id"] + isOneToOne: false + referencedRelation: "price" + referencedColumns: ["id"] + }, + ] + } + price_set: { + Row: { + created_at: string + deleted_at: string | null + id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + updated_at?: string + } + Relationships: [] + } + product: { + Row: { + collection_id: string | null + created_at: string + deleted_at: string | null + description: string | null + discountable: boolean + external_id: string | null + handle: string + height: string | null + hs_code: string | null + id: string + is_giftcard: boolean + length: string | null + material: string | null + metadata: Json | null + mid_code: string | null + origin_country: string | null + status: string + subtitle: string | null + thumbnail: string | null + title: string + type_id: string | null + updated_at: string + weight: string | null + width: string | null + } + Insert: { + collection_id?: string | null + created_at?: string + deleted_at?: string | null + description?: string | null + discountable?: boolean + external_id?: string | null + handle: string + height?: string | null + hs_code?: string | null + id: string + is_giftcard?: boolean + length?: string | null + material?: string | null + metadata?: Json | null + mid_code?: string | null + origin_country?: string | null + status?: string + subtitle?: string | null + thumbnail?: string | null + title: string + type_id?: string | null + updated_at?: string + weight?: string | null + width?: string | null + } + Update: { + collection_id?: string | null + created_at?: string + deleted_at?: string | null + description?: string | null + discountable?: boolean + external_id?: string | null + handle?: string + height?: string | null + hs_code?: string | null + id?: string + is_giftcard?: boolean + length?: string | null + material?: string | null + metadata?: Json | null + mid_code?: string | null + origin_country?: string | null + status?: string + subtitle?: string | null + thumbnail?: string | null + title?: string + type_id?: string | null + updated_at?: string + weight?: string | null + width?: string | null + } + Relationships: [ + { + foreignKeyName: "product_collection_id_foreign" + columns: ["collection_id"] + isOneToOne: false + referencedRelation: "product_collection" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_type_id_foreign" + columns: ["type_id"] + isOneToOne: false + referencedRelation: "product_type" + referencedColumns: ["id"] + }, + ] + } + product_category: { + Row: { + created_at: string + deleted_at: string | null + description: string + handle: string + id: string + is_active: boolean + is_internal: boolean + metadata: Json | null + mpath: string + name: string + parent_category_id: string | null + rank: number + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + description?: string + handle: string + id: string + is_active?: boolean + is_internal?: boolean + metadata?: Json | null + mpath: string + name: string + parent_category_id?: string | null + rank?: number + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + description?: string + handle?: string + id?: string + is_active?: boolean + is_internal?: boolean + metadata?: Json | null + mpath?: string + name?: string + parent_category_id?: string | null + rank?: number + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "product_category_parent_category_id_foreign" + columns: ["parent_category_id"] + isOneToOne: false + referencedRelation: "product_category" + referencedColumns: ["id"] + }, + ] + } + product_category_product: { + Row: { + product_category_id: string + product_id: string + } + Insert: { + product_category_id: string + product_id: string + } + Update: { + product_category_id?: string + product_id?: string + } + Relationships: [ + { + foreignKeyName: "product_category_product_product_category_id_foreign" + columns: ["product_category_id"] + isOneToOne: false + referencedRelation: "product_category" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_product_product_id_foreign" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "product" + referencedColumns: ["id"] + }, + ] + } + product_collection: { + Row: { + created_at: string + deleted_at: string | null + handle: string + id: string + metadata: Json | null + title: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + handle: string + id: string + metadata?: Json | null + title: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + handle?: string + id?: string + metadata?: Json | null + title?: string + updated_at?: string + } + Relationships: [] + } + product_option: { + Row: { + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + product_id: string + title: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + product_id: string + title: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + product_id?: string + title?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "product_option_product_id_foreign" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "product" + referencedColumns: ["id"] + }, + ] + } + product_option_value: { + Row: { + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + option_id: string | null + updated_at: string + value: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + option_id?: string | null + updated_at?: string + value: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + option_id?: string | null + updated_at?: string + value?: string + } + Relationships: [ + { + foreignKeyName: "product_option_value_option_id_foreign" + columns: ["option_id"] + isOneToOne: false + referencedRelation: "product_option" + referencedColumns: ["id"] + }, + ] + } + product_sales_channel: { + Row: { + created_at: string + deleted_at: string | null + id: string + product_id: string + sales_channel_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + product_id: string + sales_channel_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + product_id?: string + sales_channel_id?: string + updated_at?: string + } + Relationships: [] + } + product_shipping_profile: { + Row: { + created_at: string + deleted_at: string | null + id: string + product_id: string + shipping_profile_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + product_id: string + shipping_profile_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + product_id?: string + shipping_profile_id?: string + updated_at?: string + } + Relationships: [] + } + product_tag: { + Row: { + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + updated_at: string + value: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + updated_at?: string + value: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + updated_at?: string + value?: string + } + Relationships: [] + } + product_tags: { + Row: { + product_id: string + product_tag_id: string + } + Insert: { + product_id: string + product_tag_id: string + } + Update: { + product_id?: string + product_tag_id?: string + } + Relationships: [ + { + foreignKeyName: "product_tags_product_id_foreign" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "product" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_tag_id_foreign" + columns: ["product_tag_id"] + isOneToOne: false + referencedRelation: "product_tag" + referencedColumns: ["id"] + }, + ] + } + product_type: { + Row: { + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + updated_at: string + value: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + updated_at?: string + value: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + updated_at?: string + value?: string + } + Relationships: [] + } + product_variant: { + Row: { + allow_backorder: boolean + barcode: string | null + created_at: string + deleted_at: string | null + ean: string | null + height: number | null + hs_code: string | null + id: string + length: number | null + manage_inventory: boolean + material: string | null + metadata: Json | null + mid_code: string | null + origin_country: string | null + product_id: string | null + sku: string | null + title: string + upc: string | null + updated_at: string + variant_rank: number | null + weight: number | null + width: number | null + } + Insert: { + allow_backorder?: boolean + barcode?: string | null + created_at?: string + deleted_at?: string | null + ean?: string | null + height?: number | null + hs_code?: string | null + id: string + length?: number | null + manage_inventory?: boolean + material?: string | null + metadata?: Json | null + mid_code?: string | null + origin_country?: string | null + product_id?: string | null + sku?: string | null + title: string + upc?: string | null + updated_at?: string + variant_rank?: number | null + weight?: number | null + width?: number | null + } + Update: { + allow_backorder?: boolean + barcode?: string | null + created_at?: string + deleted_at?: string | null + ean?: string | null + height?: number | null + hs_code?: string | null + id?: string + length?: number | null + manage_inventory?: boolean + material?: string | null + metadata?: Json | null + mid_code?: string | null + origin_country?: string | null + product_id?: string | null + sku?: string | null + title?: string + upc?: string | null + updated_at?: string + variant_rank?: number | null + weight?: number | null + width?: number | null + } + Relationships: [ + { + foreignKeyName: "product_variant_product_id_foreign" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "product" + referencedColumns: ["id"] + }, + ] + } + product_variant_inventory_item: { + Row: { + created_at: string + deleted_at: string | null + id: string + inventory_item_id: string + required_quantity: number + updated_at: string + variant_id: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + inventory_item_id: string + required_quantity?: number + updated_at?: string + variant_id: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + inventory_item_id?: string + required_quantity?: number + updated_at?: string + variant_id?: string + } + Relationships: [] + } + product_variant_option: { + Row: { + option_value_id: string + variant_id: string + } + Insert: { + option_value_id: string + variant_id: string + } + Update: { + option_value_id?: string + variant_id?: string + } + Relationships: [ + { + foreignKeyName: "product_variant_option_option_value_id_foreign" + columns: ["option_value_id"] + isOneToOne: false + referencedRelation: "product_option_value" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variant_option_variant_id_foreign" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variant" + referencedColumns: ["id"] + }, + ] + } + product_variant_price_set: { + Row: { + created_at: string + deleted_at: string | null + id: string + price_set_id: string + updated_at: string + variant_id: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + price_set_id: string + updated_at?: string + variant_id: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + price_set_id?: string + updated_at?: string + variant_id?: string + } + Relationships: [] + } + promotion: { + Row: { + campaign_id: string | null + code: string + created_at: string + deleted_at: string | null + id: string + is_automatic: boolean + is_tax_inclusive: boolean + status: string + type: string + updated_at: string + } + Insert: { + campaign_id?: string | null + code: string + created_at?: string + deleted_at?: string | null + id: string + is_automatic?: boolean + is_tax_inclusive?: boolean + status?: string + type: string + updated_at?: string + } + Update: { + campaign_id?: string | null + code?: string + created_at?: string + deleted_at?: string | null + id?: string + is_automatic?: boolean + is_tax_inclusive?: boolean + status?: string + type?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "promotion_campaign_id_foreign" + columns: ["campaign_id"] + isOneToOne: false + referencedRelation: "promotion_campaign" + referencedColumns: ["id"] + }, + ] + } + promotion_application_method: { + Row: { + allocation: string | null + apply_to_quantity: number | null + buy_rules_min_quantity: number | null + created_at: string + currency_code: string | null + deleted_at: string | null + id: string + max_quantity: number | null + promotion_id: string + raw_value: Json | null + target_type: string + type: string + updated_at: string + value: number | null + } + Insert: { + allocation?: string | null + apply_to_quantity?: number | null + buy_rules_min_quantity?: number | null + created_at?: string + currency_code?: string | null + deleted_at?: string | null + id: string + max_quantity?: number | null + promotion_id: string + raw_value?: Json | null + target_type: string + type: string + updated_at?: string + value?: number | null + } + Update: { + allocation?: string | null + apply_to_quantity?: number | null + buy_rules_min_quantity?: number | null + created_at?: string + currency_code?: string | null + deleted_at?: string | null + id?: string + max_quantity?: number | null + promotion_id?: string + raw_value?: Json | null + target_type?: string + type?: string + updated_at?: string + value?: number | null + } + Relationships: [ + { + foreignKeyName: "promotion_application_method_promotion_id_foreign" + columns: ["promotion_id"] + isOneToOne: false + referencedRelation: "promotion" + referencedColumns: ["id"] + }, + ] + } + promotion_campaign: { + Row: { + campaign_identifier: string + created_at: string + deleted_at: string | null + description: string | null + ends_at: string | null + id: string + name: string + starts_at: string | null + updated_at: string + } + Insert: { + campaign_identifier: string + created_at?: string + deleted_at?: string | null + description?: string | null + ends_at?: string | null + id: string + name: string + starts_at?: string | null + updated_at?: string + } + Update: { + campaign_identifier?: string + created_at?: string + deleted_at?: string | null + description?: string | null + ends_at?: string | null + id?: string + name?: string + starts_at?: string | null + updated_at?: string + } + Relationships: [] + } + promotion_campaign_budget: { + Row: { + campaign_id: string + created_at: string + currency_code: string | null + deleted_at: string | null + id: string + limit: number | null + raw_limit: Json | null + raw_used: Json + type: string + updated_at: string + used: number + } + Insert: { + campaign_id: string + created_at?: string + currency_code?: string | null + deleted_at?: string | null + id: string + limit?: number | null + raw_limit?: Json | null + raw_used: Json + type: string + updated_at?: string + used?: number + } + Update: { + campaign_id?: string + created_at?: string + currency_code?: string | null + deleted_at?: string | null + id?: string + limit?: number | null + raw_limit?: Json | null + raw_used?: Json + type?: string + updated_at?: string + used?: number + } + Relationships: [ + { + foreignKeyName: "promotion_campaign_budget_campaign_id_foreign" + columns: ["campaign_id"] + isOneToOne: false + referencedRelation: "promotion_campaign" + referencedColumns: ["id"] + }, + ] + } + promotion_promotion_rule: { + Row: { + promotion_id: string + promotion_rule_id: string + } + Insert: { + promotion_id: string + promotion_rule_id: string + } + Update: { + promotion_id?: string + promotion_rule_id?: string + } + Relationships: [ + { + foreignKeyName: "promotion_promotion_rule_promotion_id_foreign" + columns: ["promotion_id"] + isOneToOne: false + referencedRelation: "promotion" + referencedColumns: ["id"] + }, + { + foreignKeyName: "promotion_promotion_rule_promotion_rule_id_foreign" + columns: ["promotion_rule_id"] + isOneToOne: false + referencedRelation: "promotion_rule" + referencedColumns: ["id"] + }, + ] + } + promotion_rule: { + Row: { + attribute: string + created_at: string + deleted_at: string | null + description: string | null + id: string + operator: string + updated_at: string + } + Insert: { + attribute: string + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + operator: string + updated_at?: string + } + Update: { + attribute?: string + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + operator?: string + updated_at?: string + } + Relationships: [] + } + promotion_rule_value: { + Row: { + created_at: string + deleted_at: string | null + id: string + promotion_rule_id: string + updated_at: string + value: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + promotion_rule_id: string + updated_at?: string + value: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + promotion_rule_id?: string + updated_at?: string + value?: string + } + Relationships: [ + { + foreignKeyName: "promotion_rule_value_promotion_rule_id_foreign" + columns: ["promotion_rule_id"] + isOneToOne: false + referencedRelation: "promotion_rule" + referencedColumns: ["id"] + }, + ] + } + provider_identity: { + Row: { + auth_identity_id: string + created_at: string + deleted_at: string | null + entity_id: string + id: string + provider: string + provider_metadata: Json | null + updated_at: string + user_metadata: Json | null + } + Insert: { + auth_identity_id: string + created_at?: string + deleted_at?: string | null + entity_id: string + id: string + provider: string + provider_metadata?: Json | null + updated_at?: string + user_metadata?: Json | null + } + Update: { + auth_identity_id?: string + created_at?: string + deleted_at?: string | null + entity_id?: string + id?: string + provider?: string + provider_metadata?: Json | null + updated_at?: string + user_metadata?: Json | null + } + Relationships: [ + { + foreignKeyName: "provider_identity_auth_identity_id_foreign" + columns: ["auth_identity_id"] + isOneToOne: false + referencedRelation: "auth_identity" + referencedColumns: ["id"] + }, + ] + } + publishable_api_key_sales_channel: { + Row: { + created_at: string + deleted_at: string | null + id: string + publishable_key_id: string + sales_channel_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + publishable_key_id: string + sales_channel_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + publishable_key_id?: string + sales_channel_id?: string + updated_at?: string + } + Relationships: [] + } + refund: { + Row: { + amount: number + created_at: string + created_by: string | null + deleted_at: string | null + id: string + metadata: Json | null + note: string | null + payment_id: string + raw_amount: Json + refund_reason_id: string | null + updated_at: string + } + Insert: { + amount: number + created_at?: string + created_by?: string | null + deleted_at?: string | null + id: string + metadata?: Json | null + note?: string | null + payment_id: string + raw_amount: Json + refund_reason_id?: string | null + updated_at?: string + } + Update: { + amount?: number + created_at?: string + created_by?: string | null + deleted_at?: string | null + id?: string + metadata?: Json | null + note?: string | null + payment_id?: string + raw_amount?: Json + refund_reason_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "refund_payment_id_foreign" + columns: ["payment_id"] + isOneToOne: false + referencedRelation: "payment" + referencedColumns: ["id"] + }, + ] + } + refund_reason: { + Row: { + created_at: string + deleted_at: string | null + description: string | null + id: string + label: string + metadata: Json | null + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + label: string + metadata?: Json | null + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + label?: string + metadata?: Json | null + updated_at?: string + } + Relationships: [] + } + region: { + Row: { + automatic_taxes: boolean + created_at: string + currency_code: string + deleted_at: string | null + id: string + metadata: Json | null + name: string + updated_at: string + } + Insert: { + automatic_taxes?: boolean + created_at?: string + currency_code: string + deleted_at?: string | null + id: string + metadata?: Json | null + name: string + updated_at?: string + } + Update: { + automatic_taxes?: boolean + created_at?: string + currency_code?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + name?: string + updated_at?: string + } + Relationships: [] + } + region_country: { + Row: { + created_at: string + deleted_at: string | null + display_name: string + iso_2: string + iso_3: string + metadata: Json | null + name: string + num_code: string + region_id: string | null + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + display_name: string + iso_2: string + iso_3: string + metadata?: Json | null + name: string + num_code: string + region_id?: string | null + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + display_name?: string + iso_2?: string + iso_3?: string + metadata?: Json | null + name?: string + num_code?: string + region_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "region_country_region_id_foreign" + columns: ["region_id"] + isOneToOne: false + referencedRelation: "region" + referencedColumns: ["id"] + }, + ] + } + region_payment_provider: { + Row: { + created_at: string + deleted_at: string | null + id: string + payment_provider_id: string + region_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + payment_provider_id: string + region_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + payment_provider_id?: string + region_id?: string + updated_at?: string + } + Relationships: [] + } + reservation_item: { + Row: { + allow_backorder: boolean | null + created_at: string + created_by: string | null + deleted_at: string | null + description: string | null + external_id: string | null + id: string + inventory_item_id: string + line_item_id: string | null + location_id: string + metadata: Json | null + quantity: number + raw_quantity: Json | null + updated_at: string + } + Insert: { + allow_backorder?: boolean | null + created_at?: string + created_by?: string | null + deleted_at?: string | null + description?: string | null + external_id?: string | null + id: string + inventory_item_id: string + line_item_id?: string | null + location_id: string + metadata?: Json | null + quantity: number + raw_quantity?: Json | null + updated_at?: string + } + Update: { + allow_backorder?: boolean | null + created_at?: string + created_by?: string | null + deleted_at?: string | null + description?: string | null + external_id?: string | null + id?: string + inventory_item_id?: string + line_item_id?: string | null + location_id?: string + metadata?: Json | null + quantity?: number + raw_quantity?: Json | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "reservation_item_inventory_item_id_foreign" + columns: ["inventory_item_id"] + isOneToOne: false + referencedRelation: "inventory_item" + referencedColumns: ["id"] + }, + ] + } + return: { + Row: { + canceled_at: string | null + claim_id: string | null + created_at: string + created_by: string | null + deleted_at: string | null + display_id: number + exchange_id: string | null + id: string + location_id: string | null + metadata: Json | null + no_notification: boolean | null + order_id: string + order_version: number + raw_refund_amount: Json | null + received_at: string | null + refund_amount: number | null + requested_at: string | null + status: Database["public"]["Enums"]["return_status_enum"] + updated_at: string + } + Insert: { + canceled_at?: string | null + claim_id?: string | null + created_at?: string + created_by?: string | null + deleted_at?: string | null + display_id?: number + exchange_id?: string | null + id: string + location_id?: string | null + metadata?: Json | null + no_notification?: boolean | null + order_id: string + order_version: number + raw_refund_amount?: Json | null + received_at?: string | null + refund_amount?: number | null + requested_at?: string | null + status?: Database["public"]["Enums"]["return_status_enum"] + updated_at?: string + } + Update: { + canceled_at?: string | null + claim_id?: string | null + created_at?: string + created_by?: string | null + deleted_at?: string | null + display_id?: number + exchange_id?: string | null + id?: string + location_id?: string | null + metadata?: Json | null + no_notification?: boolean | null + order_id?: string + order_version?: number + raw_refund_amount?: Json | null + received_at?: string | null + refund_amount?: number | null + requested_at?: string | null + status?: Database["public"]["Enums"]["return_status_enum"] + updated_at?: string + } + Relationships: [] + } + return_fulfillment: { + Row: { + created_at: string + deleted_at: string | null + fulfillment_id: string + id: string + return_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + fulfillment_id: string + id: string + return_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + fulfillment_id?: string + id?: string + return_id?: string + updated_at?: string + } + Relationships: [] + } + return_item: { + Row: { + created_at: string + damaged_quantity: number + deleted_at: string | null + id: string + item_id: string + metadata: Json | null + note: string | null + quantity: number + raw_damaged_quantity: Json + raw_quantity: Json + raw_received_quantity: Json + reason_id: string | null + received_quantity: number + return_id: string + updated_at: string + } + Insert: { + created_at?: string + damaged_quantity?: number + deleted_at?: string | null + id: string + item_id: string + metadata?: Json | null + note?: string | null + quantity: number + raw_damaged_quantity: Json + raw_quantity: Json + raw_received_quantity: Json + reason_id?: string | null + received_quantity?: number + return_id: string + updated_at?: string + } + Update: { + created_at?: string + damaged_quantity?: number + deleted_at?: string | null + id?: string + item_id?: string + metadata?: Json | null + note?: string | null + quantity?: number + raw_damaged_quantity?: Json + raw_quantity?: Json + raw_received_quantity?: Json + reason_id?: string | null + received_quantity?: number + return_id?: string + updated_at?: string + } + Relationships: [] + } + return_reason: { + Row: { + created_at: string + deleted_at: string | null + description: string | null + id: string + label: string + metadata: Json | null + parent_return_reason_id: string | null + updated_at: string + value: string + } + Insert: { + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + label: string + metadata?: Json | null + parent_return_reason_id?: string | null + updated_at?: string + value: string + } + Update: { + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + label?: string + metadata?: Json | null + parent_return_reason_id?: string | null + updated_at?: string + value?: string + } + Relationships: [ + { + foreignKeyName: "return_reason_parent_return_reason_id_foreign" + columns: ["parent_return_reason_id"] + isOneToOne: false + referencedRelation: "return_reason" + referencedColumns: ["id"] + }, + ] + } + sales_channel: { + Row: { + created_at: string + deleted_at: string | null + description: string | null + id: string + is_disabled: boolean + metadata: Json | null + name: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + is_disabled?: boolean + metadata?: Json | null + name: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + is_disabled?: boolean + metadata?: Json | null + name?: string + updated_at?: string + } + Relationships: [] + } + sales_channel_stock_location: { + Row: { + created_at: string + deleted_at: string | null + id: string + sales_channel_id: string + stock_location_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + sales_channel_id: string + stock_location_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + sales_channel_id?: string + stock_location_id?: string + updated_at?: string + } + Relationships: [] + } + script_migrations: { + Row: { + created_at: string | null + finished_at: string | null + id: number + script_name: string + } + Insert: { + created_at?: string | null + finished_at?: string | null + id?: number + script_name: string + } + Update: { + created_at?: string | null + finished_at?: string | null + id?: number + script_name?: string + } + Relationships: [] + } + service_zone: { + Row: { + created_at: string + deleted_at: string | null + fulfillment_set_id: string + id: string + metadata: Json | null + name: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + fulfillment_set_id: string + id: string + metadata?: Json | null + name: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + fulfillment_set_id?: string + id?: string + metadata?: Json | null + name?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "service_zone_fulfillment_set_id_foreign" + columns: ["fulfillment_set_id"] + isOneToOne: false + referencedRelation: "fulfillment_set" + referencedColumns: ["id"] + }, + ] + } + shipping_option: { + Row: { + created_at: string + data: Json | null + deleted_at: string | null + id: string + metadata: Json | null + name: string + price_type: string + provider_id: string | null + service_zone_id: string + shipping_option_type_id: string + shipping_profile_id: string | null + updated_at: string + } + Insert: { + created_at?: string + data?: Json | null + deleted_at?: string | null + id: string + metadata?: Json | null + name: string + price_type?: string + provider_id?: string | null + service_zone_id: string + shipping_option_type_id: string + shipping_profile_id?: string | null + updated_at?: string + } + Update: { + created_at?: string + data?: Json | null + deleted_at?: string | null + id?: string + metadata?: Json | null + name?: string + price_type?: string + provider_id?: string | null + service_zone_id?: string + shipping_option_type_id?: string + shipping_profile_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "shipping_option_provider_id_foreign" + columns: ["provider_id"] + isOneToOne: false + referencedRelation: "fulfillment_provider" + referencedColumns: ["id"] + }, + { + foreignKeyName: "shipping_option_service_zone_id_foreign" + columns: ["service_zone_id"] + isOneToOne: false + referencedRelation: "service_zone" + referencedColumns: ["id"] + }, + { + foreignKeyName: "shipping_option_shipping_option_type_id_foreign" + columns: ["shipping_option_type_id"] + isOneToOne: false + referencedRelation: "shipping_option_type" + referencedColumns: ["id"] + }, + { + foreignKeyName: "shipping_option_shipping_profile_id_foreign" + columns: ["shipping_profile_id"] + isOneToOne: false + referencedRelation: "shipping_profile" + referencedColumns: ["id"] + }, + ] + } + shipping_option_price_set: { + Row: { + created_at: string + deleted_at: string | null + id: string + price_set_id: string + shipping_option_id: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + price_set_id: string + shipping_option_id: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + price_set_id?: string + shipping_option_id?: string + updated_at?: string + } + Relationships: [] + } + shipping_option_rule: { + Row: { + attribute: string + created_at: string + deleted_at: string | null + id: string + operator: string + shipping_option_id: string + updated_at: string + value: Json | null + } + Insert: { + attribute: string + created_at?: string + deleted_at?: string | null + id: string + operator: string + shipping_option_id: string + updated_at?: string + value?: Json | null + } + Update: { + attribute?: string + created_at?: string + deleted_at?: string | null + id?: string + operator?: string + shipping_option_id?: string + updated_at?: string + value?: Json | null + } + Relationships: [ + { + foreignKeyName: "shipping_option_rule_shipping_option_id_foreign" + columns: ["shipping_option_id"] + isOneToOne: false + referencedRelation: "shipping_option" + referencedColumns: ["id"] + }, + ] + } + shipping_option_type: { + Row: { + code: string + created_at: string + deleted_at: string | null + description: string | null + id: string + label: string + updated_at: string + } + Insert: { + code: string + created_at?: string + deleted_at?: string | null + description?: string | null + id: string + label: string + updated_at?: string + } + Update: { + code?: string + created_at?: string + deleted_at?: string | null + description?: string | null + id?: string + label?: string + updated_at?: string + } + Relationships: [] + } + shipping_profile: { + Row: { + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + name: string + type: string + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + name: string + type: string + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + name?: string + type?: string + updated_at?: string + } + Relationships: [] + } + stock_location: { + Row: { + address_id: string | null + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + name: string + updated_at: string + } + Insert: { + address_id?: string | null + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + name: string + updated_at?: string + } + Update: { + address_id?: string | null + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + name?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "stock_location_address_id_foreign" + columns: ["address_id"] + isOneToOne: false + referencedRelation: "stock_location_address" + referencedColumns: ["id"] + }, + ] + } + stock_location_address: { + Row: { + address_1: string + address_2: string | null + city: string | null + company: string | null + country_code: string + created_at: string + deleted_at: string | null + id: string + metadata: Json | null + phone: string | null + postal_code: string | null + province: string | null + updated_at: string + } + Insert: { + address_1: string + address_2?: string | null + city?: string | null + company?: string | null + country_code: string + created_at?: string + deleted_at?: string | null + id: string + metadata?: Json | null + phone?: string | null + postal_code?: string | null + province?: string | null + updated_at?: string + } + Update: { + address_1?: string + address_2?: string | null + city?: string | null + company?: string | null + country_code?: string + created_at?: string + deleted_at?: string | null + id?: string + metadata?: Json | null + phone?: string | null + postal_code?: string | null + province?: string | null + updated_at?: string + } + Relationships: [] + } + store: { + Row: { + created_at: string + default_location_id: string | null + default_region_id: string | null + default_sales_channel_id: string | null + deleted_at: string | null + id: string + metadata: Json | null + name: string + updated_at: string + } + Insert: { + created_at?: string + default_location_id?: string | null + default_region_id?: string | null + default_sales_channel_id?: string | null + deleted_at?: string | null + id: string + metadata?: Json | null + name?: string + updated_at?: string + } + Update: { + created_at?: string + default_location_id?: string | null + default_region_id?: string | null + default_sales_channel_id?: string | null + deleted_at?: string | null + id?: string + metadata?: Json | null + name?: string + updated_at?: string + } + Relationships: [] + } + store_currency: { + Row: { + created_at: string + currency_code: string + deleted_at: string | null + id: string + is_default: boolean + store_id: string | null + updated_at: string + } + Insert: { + created_at?: string + currency_code: string + deleted_at?: string | null + id: string + is_default?: boolean + store_id?: string | null + updated_at?: string + } + Update: { + created_at?: string + currency_code?: string + deleted_at?: string | null + id?: string + is_default?: boolean + store_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "store_currency_store_id_foreign" + columns: ["store_id"] + isOneToOne: false + referencedRelation: "store" + referencedColumns: ["id"] + }, + ] + } + tax_provider: { + Row: { + created_at: string + deleted_at: string | null + id: string + is_enabled: boolean + updated_at: string + } + Insert: { + created_at?: string + deleted_at?: string | null + id: string + is_enabled?: boolean + updated_at?: string + } + Update: { + created_at?: string + deleted_at?: string | null + id?: string + is_enabled?: boolean + updated_at?: string + } + Relationships: [] + } + tax_rate: { + Row: { + code: string + created_at: string + created_by: string | null + deleted_at: string | null + id: string + is_combinable: boolean + is_default: boolean + metadata: Json | null + name: string + rate: number | null + tax_region_id: string + updated_at: string + } + Insert: { + code: string + created_at?: string + created_by?: string | null + deleted_at?: string | null + id: string + is_combinable?: boolean + is_default?: boolean + metadata?: Json | null + name: string + rate?: number | null + tax_region_id: string + updated_at?: string + } + Update: { + code?: string + created_at?: string + created_by?: string | null + deleted_at?: string | null + id?: string + is_combinable?: boolean + is_default?: boolean + metadata?: Json | null + name?: string + rate?: number | null + tax_region_id?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "FK_tax_rate_tax_region_id" + columns: ["tax_region_id"] + isOneToOne: false + referencedRelation: "tax_region" + referencedColumns: ["id"] + }, + ] + } + tax_rate_rule: { + Row: { + created_at: string + created_by: string | null + deleted_at: string | null + id: string + metadata: Json | null + reference: string + reference_id: string + tax_rate_id: string + updated_at: string + } + Insert: { + created_at?: string + created_by?: string | null + deleted_at?: string | null + id: string + metadata?: Json | null + reference: string + reference_id: string + tax_rate_id: string + updated_at?: string + } + Update: { + created_at?: string + created_by?: string | null + deleted_at?: string | null + id?: string + metadata?: Json | null + reference?: string + reference_id?: string + tax_rate_id?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "FK_tax_rate_rule_tax_rate_id" + columns: ["tax_rate_id"] + isOneToOne: false + referencedRelation: "tax_rate" + referencedColumns: ["id"] + }, + ] + } + tax_region: { + Row: { + country_code: string + created_at: string + created_by: string | null + deleted_at: string | null + id: string + metadata: Json | null + parent_id: string | null + provider_id: string | null + province_code: string | null + updated_at: string + } + Insert: { + country_code: string + created_at?: string + created_by?: string | null + deleted_at?: string | null + id: string + metadata?: Json | null + parent_id?: string | null + provider_id?: string | null + province_code?: string | null + updated_at?: string + } + Update: { + country_code?: string + created_at?: string + created_by?: string | null + deleted_at?: string | null + id?: string + metadata?: Json | null + parent_id?: string | null + provider_id?: string | null + province_code?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "FK_tax_region_parent_id" + columns: ["parent_id"] + isOneToOne: false + referencedRelation: "tax_region" + referencedColumns: ["id"] + }, + { + foreignKeyName: "FK_tax_region_provider_id" + columns: ["provider_id"] + isOneToOne: false + referencedRelation: "tax_provider" + referencedColumns: ["id"] + }, + ] + } + user: { + Row: { + avatar_url: string | null + created_at: string + deleted_at: string | null + email: string + first_name: string | null + id: string + last_name: string | null + metadata: Json | null + updated_at: string + } + Insert: { + avatar_url?: string | null + created_at?: string + deleted_at?: string | null + email: string + first_name?: string | null + id: string + last_name?: string | null + metadata?: Json | null + updated_at?: string + } + Update: { + avatar_url?: string | null + created_at?: string + deleted_at?: string | null + email?: string + first_name?: string | null + id?: string + last_name?: string | null + metadata?: Json | null + updated_at?: string + } + Relationships: [] + } + workflow_execution: { + Row: { + context: Json | null + created_at: string + deleted_at: string | null + execution: Json | null + id: string + retention_time: number | null + run_id: string + state: string + transaction_id: string + updated_at: string + workflow_id: string + } + Insert: { + context?: Json | null + created_at?: string + deleted_at?: string | null + execution?: Json | null + id: string + retention_time?: number | null + run_id?: string + state: string + transaction_id: string + updated_at?: string + workflow_id: string + } + Update: { + context?: Json | null + created_at?: string + deleted_at?: string | null + execution?: Json | null + id?: string + retention_time?: number | null + run_id?: string + state?: string + transaction_id?: string + updated_at?: string + workflow_id?: string + } + Relationships: [] + } } Views: { [_ in never]: never @@ -1795,6 +7472,25 @@ export type Database = { | "settings.manage" | "members.manage" | "invites.manage" + claim_reason_enum: + | "missing_item" + | "wrong_item" + | "production_failure" + | "other" + order_claim_type_enum: "refund" | "replace" + order_status_enum: + | "pending" + | "completed" + | "draft" + | "archived" + | "canceled" + | "requires_action" + return_status_enum: + | "open" + | "requested" + | "received" + | "partially_received" + | "canceled" } CompositeTypes: { invitation: { @@ -1964,6 +7660,28 @@ export const Constants = { "members.manage", "invites.manage", ], + claim_reason_enum: [ + "missing_item", + "wrong_item", + "production_failure", + "other", + ], + order_claim_type_enum: ["refund", "replace"], + order_status_enum: [ + "pending", + "completed", + "draft", + "archived", + "canceled", + "requires_action", + ], + return_status_enum: [ + "open", + "requested", + "received", + "partially_received", + "canceled", + ], }, }, } as const diff --git a/packages/ui/src/makerkit/page.tsx b/packages/ui/src/makerkit/page.tsx index f9cf333..9f27a50 100644 --- a/packages/ui/src/makerkit/page.tsx +++ b/packages/ui/src/makerkit/page.tsx @@ -37,16 +37,12 @@ function PageWithSidebar(props: PageProps) {
{MobileNavigation} -
+
{Children}
@@ -75,7 +71,7 @@ function PageWithHeader(props: PageProps) { const { Navigation, Children, MobileNavigation } = getSlotsFromPage(props); return ( -
+
Date: Tue, 15 Jul 2025 17:13:12 +0300 Subject: [PATCH 02/10] Update Supabase configuration in development and production environment files --- .env.development | 7 +++---- .env.production | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.env.development b/.env.development index c22cdb6..5d8bb47 100644 --- a/.env.development +++ b/.env.development @@ -1,10 +1,9 @@ # This file is used to define environment variables for the development environment. # These values are only used when running the app in development mode. -# SUPABASE -NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 -NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 -SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU +# SUPABASE DEVELOPMENT +NEXT_PUBLIC_SUPABASE_URL=https://oqsdacktkhmbylmzstjq.supabase.co +NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9xc2RhY2t0a2htYnlsbXpzdGpxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDY1MjgxMjMsImV4cCI6MjA2MjEwNDEyM30.LdHCTWxijFmhXdnT9KVuLRAVbtSwY7OO-oLtpd8GmO0 ## THIS IS FOR DEVELOPMENT ONLY - DO NOT USE IN PRODUCTION SUPABASE_DB_WEBHOOK_SECRET=WEBHOOKSECRET diff --git a/.env.production b/.env.production index 417308e..ab3719d 100644 --- a/.env.production +++ b/.env.production @@ -6,7 +6,9 @@ ## PUBLIC KEYS OR CONFIGURATION ARE OKAY TO BE PLACED HERE. # SUPABASE -NEXT_PUBLIC_SUPABASE_URL= +NEXT_PUBLIC_SUPABASE_URL=https://oqsdacktkhmbylmzstjq.supabase.co +NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9xc2RhY2t0a2htYnlsbXpzdGpxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDY1MjgxMjMsImV4cCI6MjA2MjEwNDEyM30.LdHCTWxijFmhXdnT9KVuLRAVbtSwY7OO-oLtpd8GmO0 +SUPABASE_SERVICE_ROLE_KEY= # STRIPE NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY= From 571637f96a0ff028a65ad58c32ebdd61ff1302a3 Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Wed, 16 Jul 2025 10:16:47 +0300 Subject: [PATCH 03/10] Add .env.production copy to Dockerfile for environment configuration --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index be22dd3..293cbe4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ RUN npm install -g pnpm@9 COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ COPY packages packages COPY tooling tooling +COPY .env.production .env # Install all dependencies RUN pnpm install --frozen-lockfile From 4e0ef7b9de44460197124b4b59efe80cd3999426 Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Wed, 16 Jul 2025 11:21:08 +0300 Subject: [PATCH 04/10] Fix environment variable configuration in .env and .env.production files --- .env | 5 +---- .env.production | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.env b/.env index d26da95..f279691 100644 --- a/.env +++ b/.env @@ -51,7 +51,4 @@ LOGGER=pino NEXT_PUBLIC_DEFAULT_LOCALE=et NEXT_PUBLIC_TEAM_NAVIGATION_STYLE=custom -NEXT_PUBLIC_USER_NAVIGATION_STYLE=custom - -# MEDUSA -NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY= \ No newline at end of file +NEXT_PUBLIC_USER_NAVIGATION_STYLE=custom \ No newline at end of file diff --git a/.env.production b/.env.production index ab3719d..12abfe6 100644 --- a/.env.production +++ b/.env.production @@ -8,7 +8,6 @@ # SUPABASE NEXT_PUBLIC_SUPABASE_URL=https://oqsdacktkhmbylmzstjq.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9xc2RhY2t0a2htYnlsbXpzdGpxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDY1MjgxMjMsImV4cCI6MjA2MjEwNDEyM30.LdHCTWxijFmhXdnT9KVuLRAVbtSwY7OO-oLtpd8GmO0 -SUPABASE_SERVICE_ROLE_KEY= # STRIPE NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY= From d572ba52a8dba2e9bfa1e8a4350d037bec2d37b3 Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Wed, 16 Jul 2025 12:09:14 +0300 Subject: [PATCH 05/10] Refactor Dockerfile for improved build and runtime stages --- Dockerfile | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 293cbe4..e419ec3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,34 @@ +# --- Stage 1: Build --- FROM node:20-alpine as builder WORKDIR /app RUN npm install -g pnpm@9 -# Copy necessary files for workspace resolution COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ COPY packages packages COPY tooling tooling COPY .env.production .env -# Install all dependencies RUN pnpm install --frozen-lockfile COPY . . -RUN pnpm build \ No newline at end of file +RUN pnpm build + + +# --- Stage 2: Runtime --- +FROM node:20-alpine + +WORKDIR /app + +COPY --from=builder /app ./ + +RUN npm install -g pnpm@9 \ + && pnpm install --prod --frozen-lockfile + +ENV NODE_ENV=production + +EXPOSE 3000 + +CMD ["pnpm", "start"] From b028aae1ba3877700e01a4af26226f299d83f9d4 Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Wed, 16 Jul 2025 13:29:29 +0300 Subject: [PATCH 06/10] Fix environment variable copying in Dockerfile for runtime stage --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index e419ec3..5ce1781 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,7 @@ FROM node:20-alpine WORKDIR /app COPY --from=builder /app ./ +COPY .env.production .env RUN npm install -g pnpm@9 \ && pnpm install --prod --frozen-lockfile From 6232ffc50d46fd785a4362117748c0e9ce759df4 Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Wed, 16 Jul 2025 13:35:01 +0300 Subject: [PATCH 07/10] Remove unused Stripe publishable key from development and production environment files --- .env.development | 2 -- .env.production | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.env.development b/.env.development index 5d8bb47..7599ba1 100644 --- a/.env.development +++ b/.env.development @@ -13,8 +13,6 @@ SUPABASE_DB_WEBHOOK_SECRET=WEBHOOKSECRET # CONTACT FORM CONTACT_EMAIL=test@makerkit.dev -# STRIPE -NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY= # MAILER MAILER_PROVIDER=nodemailer diff --git a/.env.production b/.env.production index 12abfe6..593d99f 100644 --- a/.env.production +++ b/.env.production @@ -9,5 +9,4 @@ NEXT_PUBLIC_SUPABASE_URL=https://oqsdacktkhmbylmzstjq.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9xc2RhY2t0a2htYnlsbXpzdGpxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDY1MjgxMjMsImV4cCI6MjA2MjEwNDEyM30.LdHCTWxijFmhXdnT9KVuLRAVbtSwY7OO-oLtpd8GmO0 -# STRIPE -NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY= + From 2689b879773546d898770df9dfda928904e76092 Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Wed, 16 Jul 2025 14:48:18 +0300 Subject: [PATCH 08/10] add logs --- Dockerfile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5ce1781..c5ec454 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,16 +4,26 @@ FROM node:20-alpine as builder WORKDIR /app RUN npm install -g pnpm@9 +RUN npm install -g dotenv-cli COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ COPY packages packages COPY tooling tooling -COPY .env.production .env +COPY .env.production .env.production +# Load env file and echo a specific variable +# RUN dotenv -e .env -- printenv | grep 'SUPABASE' || true RUN pnpm install --frozen-lockfile COPY . . +ENV NODE_ENV=production + +# 🔍 Optional: Log key envs for debug +RUN echo "📄 .env.production contents:" && cat .env.production \ + && echo "🔧 Current ENV available to Next.js build:" && printenv | grep -E 'SUPABASE|STRIPE|NEXT|NODE_ENV' || true + + RUN pnpm build @@ -23,13 +33,17 @@ FROM node:20-alpine WORKDIR /app COPY --from=builder /app ./ -COPY .env.production .env RUN npm install -g pnpm@9 \ && pnpm install --prod --frozen-lockfile ENV NODE_ENV=production +# 🔍 Optional: Log key envs for debug +RUN echo "📄 .env.production contents:" && cat .env.production \ + && echo "🔧 Current ENV available to Next.js build:" && printenv | grep -E 'SUPABASE|STRIPE|NEXT|NODE_ENV' || true + + EXPOSE 3000 CMD ["pnpm", "start"] From 79b6652748ed85a13dddc293a731e5c6bddc8d35 Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Wed, 16 Jul 2025 16:07:27 +0300 Subject: [PATCH 09/10] Add missing .env file copy in Dockerfile for build stage --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index c5ec454..5ad66b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ RUN npm install -g dotenv-cli COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ COPY packages packages COPY tooling tooling +COPY .env .env COPY .env.production .env.production # Load env file and echo a specific variable From dca5f047399c05a53dbea3968206130bd6d7ddfa Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Thu, 17 Jul 2025 12:39:21 +0300 Subject: [PATCH 10/10] add env logging --- Dockerfile | 2 +- check-env.js | 1 + .../medusa-storefront/src/lib/config.ts | 12 +- .../src/lib/data/collections.ts | 32 +- ...0616142604_add_connected_online_tables.sql | 310 +++++++++--------- ...619070038_add_medreport_product_tables.sql | 274 ++++++++-------- .../20250703145757_add_medreport_schema.sql | 84 ++--- 7 files changed, 359 insertions(+), 356 deletions(-) create mode 100644 check-env.js diff --git a/Dockerfile b/Dockerfile index 5ad66b0..ff86f18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ ENV NODE_ENV=production # 🔍 Optional: Log key envs for debug RUN echo "📄 .env.production contents:" && cat .env.production \ && echo "🔧 Current ENV available to Next.js build:" && printenv | grep -E 'SUPABASE|STRIPE|NEXT|NODE_ENV' || true - +RUN node check-env.js RUN pnpm build diff --git a/check-env.js b/check-env.js new file mode 100644 index 0000000..140854c --- /dev/null +++ b/check-env.js @@ -0,0 +1 @@ +console.log('ENV =', process.env.MEDUSA_BACKEND_URL); diff --git a/packages/features/medusa-storefront/src/lib/config.ts b/packages/features/medusa-storefront/src/lib/config.ts index 47c46b1..f48be4b 100644 --- a/packages/features/medusa-storefront/src/lib/config.ts +++ b/packages/features/medusa-storefront/src/lib/config.ts @@ -1,14 +1,16 @@ -import Medusa from "@medusajs/js-sdk" +import Medusa from "@medusajs/js-sdk"; // Defaults to standard port for Medusa server -let MEDUSA_BACKEND_URL = "http://localhost:9000" +let MEDUSA_BACKEND_URL = "http://localhost:9000"; if (process.env.MEDUSA_BACKEND_URL) { - MEDUSA_BACKEND_URL = process.env.MEDUSA_BACKEND_URL + MEDUSA_BACKEND_URL = process.env.MEDUSA_BACKEND_URL; } -export const sdk = new Medusa({ +export const SDK_CONFIG = { baseUrl: MEDUSA_BACKEND_URL, debug: process.env.NODE_ENV === "development", publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY, -}) +}; + +export const sdk = new Medusa(SDK_CONFIG); diff --git a/packages/features/medusa-storefront/src/lib/data/collections.ts b/packages/features/medusa-storefront/src/lib/data/collections.ts index cb403ee..ce3b4d6 100644 --- a/packages/features/medusa-storefront/src/lib/data/collections.ts +++ b/packages/features/medusa-storefront/src/lib/data/collections.ts @@ -1,13 +1,13 @@ -"use server" +"use server"; -import { sdk } from "@lib/config" -import { HttpTypes } from "@medusajs/types" -import { getCacheOptions } from "./cookies" +import { sdk, SDK_CONFIG } from "@lib/config"; +import { HttpTypes } from "@medusajs/types"; +import { getCacheOptions } from "./cookies"; export const retrieveCollection = async (id: string) => { const next = { ...(await getCacheOptions("collections")), - } + }; return sdk.client .fetch<{ collection: HttpTypes.StoreCollection }>( @@ -17,19 +17,19 @@ export const retrieveCollection = async (id: string) => { cache: "force-cache", } ) - .then(({ collection }) => collection) -} + .then(({ collection }) => collection); +}; export const listCollections = async ( queryParams: Record = {} ): Promise<{ collections: HttpTypes.StoreCollection[]; count: number }> => { const next = { ...(await getCacheOptions("collections")), - } - - queryParams.limit = queryParams.limit || "100" - queryParams.offset = queryParams.offset || "0" + }; + queryParams.limit = queryParams.limit || "100"; + queryParams.offset = queryParams.offset || "0"; + console.log("SDK_CONFIG: ", SDK_CONFIG.baseUrl); return sdk.client .fetch<{ collections: HttpTypes.StoreCollection[]; count: number }>( "/store/collections", @@ -39,15 +39,15 @@ export const listCollections = async ( cache: "force-cache", } ) - .then(({ collections }) => ({ collections, count: collections.length })) -} + .then(({ collections }) => ({ collections, count: collections.length })); +}; export const getCollectionByHandle = async ( handle: string ): Promise => { const next = { ...(await getCacheOptions("collections")), - } + }; return sdk.client .fetch(`/store/collections`, { @@ -55,5 +55,5 @@ export const getCollectionByHandle = async ( next, cache: "force-cache", }) - .then(({ collections }) => collections[0]) -} + .then(({ collections }) => collections[0]); +}; diff --git a/supabase/migrations/20250616142604_add_connected_online_tables.sql b/supabase/migrations/20250616142604_add_connected_online_tables.sql index 74f701a..890eb2b 100644 --- a/supabase/migrations/20250616142604_add_connected_online_tables.sql +++ b/supabase/migrations/20250616142604_add_connected_online_tables.sql @@ -1,227 +1,227 @@ -create table "public"."connected_online_providers" ( - "id" bigint not null, - "name" text not null, - "email" text, - "phone_number" text, - "can_select_worker" boolean not null, - "personal_code_required" boolean not null, - "created_at" timestamp with time zone not null default now(), - "updated_at" timestamp without time zone default now() -); +-- create table "public"."connected_online_providers" ( +-- "id" bigint not null, +-- "name" text not null, +-- "email" text, +-- "phone_number" text, +-- "can_select_worker" boolean not null, +-- "personal_code_required" boolean not null, +-- "created_at" timestamp with time zone not null default now(), +-- "updated_at" timestamp without time zone default now() +-- ); -alter table "public"."connected_online_providers" enable row level security; +-- alter table "public"."connected_online_providers" enable row level security; -create table "public"."connected_online_services" ( - "id" bigint not null, - "clinic_id" bigint not null, - "sync_id" bigint not null, - "name" text not null, - "description" text, - "price" double precision not null, - "requires_payment" boolean not null, - "duration" bigint not null, - "neto_duration" bigint, - "display" text, - "price_periods" text, - "online_hide_duration" bigint, - "online_hide_price" bigint, - "code" text not null, - "has_free_codes" boolean not null, - "created_at" timestamp with time zone not null default now(), - "updated_at" timestamp with time zone default now() -); +-- create table "public"."connected_online_services" ( +-- "id" bigint not null, +-- "clinic_id" bigint not null, +-- "sync_id" bigint not null, +-- "name" text not null, +-- "description" text, +-- "price" double precision not null, +-- "requires_payment" boolean not null, +-- "duration" bigint not null, +-- "neto_duration" bigint, +-- "display" text, +-- "price_periods" text, +-- "online_hide_duration" bigint, +-- "online_hide_price" bigint, +-- "code" text not null, +-- "has_free_codes" boolean not null, +-- "created_at" timestamp with time zone not null default now(), +-- "updated_at" timestamp with time zone default now() +-- ); -alter table "public"."connected_online_services" enable row level security; +-- alter table "public"."connected_online_services" enable row level security; -CREATE UNIQUE INDEX connected_online_providers_id_key ON public.connected_online_providers USING btree (id); +-- CREATE UNIQUE INDEX connected_online_providers_id_key ON public.connected_online_providers USING btree (id); -CREATE UNIQUE INDEX connected_online_providers_pkey ON public.connected_online_providers USING btree (id); +-- CREATE UNIQUE INDEX connected_online_providers_pkey ON public.connected_online_providers USING btree (id); -CREATE UNIQUE INDEX connected_online_services_id_key ON public.connected_online_services USING btree (id); +-- CREATE UNIQUE INDEX connected_online_services_id_key ON public.connected_online_services USING btree (id); -CREATE UNIQUE INDEX connected_online_services_pkey ON public.connected_online_services USING btree (id); +-- CREATE UNIQUE INDEX connected_online_services_pkey ON public.connected_online_services USING btree (id); -alter table "public"."connected_online_providers" add constraint "connected_online_providers_pkey" PRIMARY KEY using index "connected_online_providers_pkey"; +-- alter table "public"."connected_online_providers" add constraint "connected_online_providers_pkey" PRIMARY KEY using index "connected_online_providers_pkey"; -alter table "public"."connected_online_services" add constraint "connected_online_services_pkey" PRIMARY KEY using index "connected_online_services_pkey"; +-- alter table "public"."connected_online_services" add constraint "connected_online_services_pkey" PRIMARY KEY using index "connected_online_services_pkey"; -alter table "public"."connected_online_providers" add constraint "connected_online_providers_id_key" UNIQUE using index "connected_online_providers_id_key"; +-- alter table "public"."connected_online_providers" add constraint "connected_online_providers_id_key" UNIQUE using index "connected_online_providers_id_key"; -alter table "public"."connected_online_services" add constraint "connected_online_services_clinic_id_fkey" FOREIGN KEY (clinic_id) REFERENCES connected_online_providers(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; +-- alter table "public"."connected_online_services" add constraint "connected_online_services_clinic_id_fkey" FOREIGN KEY (clinic_id) REFERENCES connected_online_providers(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; -alter table "public"."connected_online_services" validate constraint "connected_online_services_clinic_id_fkey"; +-- alter table "public"."connected_online_services" validate constraint "connected_online_services_clinic_id_fkey"; -alter table "public"."connected_online_services" add constraint "connected_online_services_id_key" UNIQUE using index "connected_online_services_id_key"; +-- alter table "public"."connected_online_services" add constraint "connected_online_services_id_key" UNIQUE using index "connected_online_services_id_key"; -grant delete on table "public"."connected_online_providers" to "service_role"; +-- grant delete on table "public"."connected_online_providers" to "service_role"; -grant insert on table "public"."connected_online_providers" to "service_role"; +-- grant insert on table "public"."connected_online_providers" to "service_role"; -grant references on table "public"."connected_online_providers" to "service_role"; +-- grant references on table "public"."connected_online_providers" to "service_role"; -grant select on table "public"."connected_online_providers" to "service_role"; +-- grant select on table "public"."connected_online_providers" to "service_role"; -grant trigger on table "public"."connected_online_providers" to "service_role"; +-- grant trigger on table "public"."connected_online_providers" to "service_role"; -grant truncate on table "public"."connected_online_providers" to "service_role"; +-- grant truncate on table "public"."connected_online_providers" to "service_role"; -grant update on table "public"."connected_online_providers" to "service_role"; +-- grant update on table "public"."connected_online_providers" to "service_role"; -grant select on table "public"."connected_online_providers" to "authenticated"; +-- grant select on table "public"."connected_online_providers" to "authenticated"; -grant delete on table "public"."connected_online_services" to "service_role"; +-- grant delete on table "public"."connected_online_services" to "service_role"; -grant insert on table "public"."connected_online_services" to "service_role"; +-- grant insert on table "public"."connected_online_services" to "service_role"; -grant references on table "public"."connected_online_services" to "service_role"; +-- grant references on table "public"."connected_online_services" to "service_role"; -grant select on table "public"."connected_online_services" to "service_role"; +-- grant select on table "public"."connected_online_services" to "service_role"; -grant trigger on table "public"."connected_online_services" to "service_role"; +-- grant trigger on table "public"."connected_online_services" to "service_role"; -grant truncate on table "public"."connected_online_services" to "service_role"; +-- grant truncate on table "public"."connected_online_services" to "service_role"; -grant update on table "public"."connected_online_services" to "service_role"; +-- grant update on table "public"."connected_online_services" to "service_role"; -grant select on table "public"."connected_online_services" to "authenticated"; +-- grant select on table "public"."connected_online_services" to "authenticated"; -create type "audit"."request_status" as enum ('SUCCESS', 'FAIL'); +-- create type "audit"."request_status" as enum ('SUCCESS', 'FAIL'); -create table "audit"."request_entries" ( - "id" bigint generated by default as identity not null, - "personal_code" bigint, - "request_api" text not null, - "request_api_method" text not null, - "status" audit.request_status not null, - "comment" text, - "service_provider_id" bigint, - "service_id" bigint, - "requested_start_date" timestamp with time zone, - "requested_end_date" timestamp with time zone, - "created_at" timestamp with time zone not null default now() -); +-- create table "audit"."request_entries" ( +-- "id" bigint generated by default as identity not null, +-- "personal_code" bigint, +-- "request_api" text not null, +-- "request_api_method" text not null, +-- "status" audit.request_status not null, +-- "comment" text, +-- "service_provider_id" bigint, +-- "service_id" bigint, +-- "requested_start_date" timestamp with time zone, +-- "requested_end_date" timestamp with time zone, +-- "created_at" timestamp with time zone not null default now() +-- ); -alter table "audit"."request_entries" enable row level security; +-- alter table "audit"."request_entries" enable row level security; -CREATE UNIQUE INDEX request_entries_pkey ON audit.request_entries USING btree (id); +-- CREATE UNIQUE INDEX request_entries_pkey ON audit.request_entries USING btree (id); -alter table "audit"."request_entries" add constraint "request_entries_pkey" PRIMARY KEY using index "request_entries_pkey"; +-- alter table "audit"."request_entries" add constraint "request_entries_pkey" PRIMARY KEY using index "request_entries_pkey"; -grant delete on table "audit"."request_entries" to "service_role"; +-- grant delete on table "audit"."request_entries" to "service_role"; -grant insert on table "audit"."request_entries" to "service_role"; +-- grant insert on table "audit"."request_entries" to "service_role"; -grant references on table "audit"."request_entries" to "service_role"; +-- grant references on table "audit"."request_entries" to "service_role"; -grant select on table "audit"."request_entries" to "service_role"; +-- grant select on table "audit"."request_entries" to "service_role"; -grant trigger on table "audit"."request_entries" to "service_role"; +-- grant trigger on table "audit"."request_entries" to "service_role"; -grant truncate on table "audit"."request_entries" to "service_role"; +-- grant truncate on table "audit"."request_entries" to "service_role"; -grant update on table "audit"."request_entries" to "service_role"; +-- grant update on table "audit"."request_entries" to "service_role"; -create policy "service_role_all" -on "audit"."request_entries" -as permissive -for all -to service_role -using (true); +-- create policy "service_role_all" +-- on "audit"."request_entries" +-- as permissive +-- for all +-- to service_role +-- using (true); -create table "public"."connected_online_reservation" ( - "id" bigint generated by default as identity not null, - "user_id" uuid not null, - "booking_code" text not null, - "service_id" bigint not null, - "clinic_id" bigint not null, - "service_user_id" bigint, - "sync_user_id" bigint not null, - "requires_payment" boolean not null, - "comments" text, - "start_time" timestamp with time zone not null, - "lang" text not null, - "discount_code" text, - "created_at" timestamp with time zone not null default now(), - "updated_at" timestamp with time zone default now() -); +-- create table "public"."connected_online_reservation" ( +-- "id" bigint generated by default as identity not null, +-- "user_id" uuid not null, +-- "booking_code" text not null, +-- "service_id" bigint not null, +-- "clinic_id" bigint not null, +-- "service_user_id" bigint, +-- "sync_user_id" bigint not null, +-- "requires_payment" boolean not null, +-- "comments" text, +-- "start_time" timestamp with time zone not null, +-- "lang" text not null, +-- "discount_code" text, +-- "created_at" timestamp with time zone not null default now(), +-- "updated_at" timestamp with time zone default now() +-- ); -alter table "public"."connected_online_reservation" enable row level security; +-- alter table "public"."connected_online_reservation" enable row level security; -CREATE UNIQUE INDEX connected_online_reservation_booking_code_key ON public.connected_online_reservation USING btree (booking_code); +-- CREATE UNIQUE INDEX connected_online_reservation_booking_code_key ON public.connected_online_reservation USING btree (booking_code); -CREATE UNIQUE INDEX connected_online_reservation_pkey ON public.connected_online_reservation USING btree (id); +-- CREATE UNIQUE INDEX connected_online_reservation_pkey ON public.connected_online_reservation USING btree (id); -alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_pkey" PRIMARY KEY using index "connected_online_reservation_pkey"; +-- alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_pkey" PRIMARY KEY using index "connected_online_reservation_pkey"; -alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_booking_code_key" UNIQUE using index "connected_online_reservation_booking_code_key"; +-- alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_booking_code_key" UNIQUE using index "connected_online_reservation_booking_code_key"; -alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_user_id_fkey" FOREIGN KEY (user_id) REFERENCES auth.users(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; +-- alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_user_id_fkey" FOREIGN KEY (user_id) REFERENCES auth.users(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; -alter table "public"."connected_online_reservation" validate constraint "connected_online_reservation_user_id_fkey"; +-- alter table "public"."connected_online_reservation" validate constraint "connected_online_reservation_user_id_fkey"; -grant delete on table "public"."connected_online_reservation" to "service_role"; +-- grant delete on table "public"."connected_online_reservation" to "service_role"; -grant insert on table "public"."connected_online_reservation" to "service_role"; +-- grant insert on table "public"."connected_online_reservation" to "service_role"; -grant references on table "public"."connected_online_reservation" to "service_role"; +-- grant references on table "public"."connected_online_reservation" to "service_role"; -grant select on table "public"."connected_online_reservation" to "service_role"; +-- grant select on table "public"."connected_online_reservation" to "service_role"; -grant trigger on table "public"."connected_online_reservation" to "service_role"; +-- grant trigger on table "public"."connected_online_reservation" to "service_role"; -grant truncate on table "public"."connected_online_reservation" to "service_role"; +-- grant truncate on table "public"."connected_online_reservation" to "service_role"; -grant update on table "public"."connected_online_reservation" to "service_role"; +-- grant update on table "public"."connected_online_reservation" to "service_role"; -create policy "service_role_all" -on "public"."connected_online_reservation" -as permissive -for all -to service_role -using (true); +-- create policy "service_role_all" +-- on "public"."connected_online_reservation" +-- as permissive +-- for all +-- to service_role +-- using (true); -CREATE TRIGGER connected_online_providers_change_record_timestamps AFTER INSERT OR UPDATE ON public.connected_online_providers FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamps(); +-- CREATE TRIGGER connected_online_providers_change_record_timestamps AFTER INSERT OR UPDATE ON public.connected_online_providers FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamps(); -CREATE TRIGGER connected_online_services_change_record_timestamps AFTER INSERT OR UPDATE ON public.connected_online_services FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamps(); +-- CREATE TRIGGER connected_online_services_change_record_timestamps AFTER INSERT OR UPDATE ON public.connected_online_services FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamps(); -create policy "service_role_all" -on "public"."connected_online_providers" -as permissive -for all -to service_role -using (true); +-- create policy "service_role_all" +-- on "public"."connected_online_providers" +-- as permissive +-- for all +-- to service_role +-- using (true); -create policy "service_role_all" -on "public"."connected_online_services" -as permissive -for all -to service_role -using (true); +-- create policy "service_role_all" +-- on "public"."connected_online_services" +-- as permissive +-- for all +-- to service_role +-- using (true); -create policy "authenticated_select" -on "public"."connected_online_providers" -as permissive -for select -to authenticated -using (true); +-- create policy "authenticated_select" +-- on "public"."connected_online_providers" +-- as permissive +-- for select +-- to authenticated +-- using (true); -create policy "authenticated_select" -on "public"."connected_online_services" -as permissive -for select -to authenticated -using (true); +-- create policy "authenticated_select" +-- on "public"."connected_online_services" +-- as permissive +-- for select +-- to authenticated +-- using (true); -create policy "own_all" -on "public"."connected_online_reservation" -as permissive -for all -to authenticated -using ((( SELECT auth.uid() AS uid) = user_id)); \ No newline at end of file +-- create policy "own_all" +-- on "public"."connected_online_reservation" +-- as permissive +-- for all +-- to authenticated +-- using ((( SELECT auth.uid() AS uid) = user_id)); \ No newline at end of file diff --git a/supabase/migrations/20250619070038_add_medreport_product_tables.sql b/supabase/migrations/20250619070038_add_medreport_product_tables.sql index 938fe6e..d861040 100644 --- a/supabase/migrations/20250619070038_add_medreport_product_tables.sql +++ b/supabase/migrations/20250619070038_add_medreport_product_tables.sql @@ -1,225 +1,225 @@ -create table "public"."medreport_product_groups" ( - "id" bigint generated by default as identity not null, - "name" text not null, - "created_at" timestamp with time zone not null default now(), - "updated_at" timestamp with time zone -); +-- create table "public"."medreport_product_groups" ( +-- "id" bigint generated by default as identity not null, +-- "name" text not null, +-- "created_at" timestamp with time zone not null default now(), +-- "updated_at" timestamp with time zone +-- ); -create table "public"."medreport_products" ( - "id" bigint generated by default as identity not null, - "name" text not null, - "product_group_id" bigint, - "created_at" timestamp with time zone not null default now(), - "updated_at" timestamp with time zone default now() -); +-- create table "public"."medreport_products" ( +-- "id" bigint generated by default as identity not null, +-- "name" text not null, +-- "product_group_id" bigint, +-- "created_at" timestamp with time zone not null default now(), +-- "updated_at" timestamp with time zone default now() +-- ); -alter table "public"."medreport_products" enable row level security; +-- alter table "public"."medreport_products" enable row level security; -create table "public"."medreport_products_analyses_relations" ( - "product_id" bigint not null, - "analysis_element_id" bigint, - "analysis_id" bigint -); +-- create table "public"."medreport_products_analyses_relations" ( +-- "product_id" bigint not null, +-- "analysis_element_id" bigint, +-- "analysis_id" bigint +-- ); -alter table "public"."medreport_product_groups" enable row level security; +-- alter table "public"."medreport_product_groups" enable row level security; -alter table "public"."medreport_products_analyses_relations" enable row level security; +-- alter table "public"."medreport_products_analyses_relations" enable row level security; -CREATE UNIQUE INDEX medreport_product_groups_name_key ON public.medreport_product_groups USING btree (name); +-- CREATE UNIQUE INDEX medreport_product_groups_name_key ON public.medreport_product_groups USING btree (name); -CREATE UNIQUE INDEX medreport_product_groups_pkey ON public.medreport_product_groups USING btree (id); +-- CREATE UNIQUE INDEX medreport_product_groups_pkey ON public.medreport_product_groups USING btree (id); -alter table "public"."medreport_product_groups" add constraint "medreport_product_groups_pkey" PRIMARY KEY using index "medreport_product_groups_pkey"; +-- alter table "public"."medreport_product_groups" add constraint "medreport_product_groups_pkey" PRIMARY KEY using index "medreport_product_groups_pkey"; -alter table "public"."medreport_product_groups" add constraint "medreport_product_groups_name_key" UNIQUE using index "medreport_product_groups_name_key"; +-- alter table "public"."medreport_product_groups" add constraint "medreport_product_groups_name_key" UNIQUE using index "medreport_product_groups_name_key"; -alter table "public"."medreport_products" add constraint "medreport_products_product_groups_id_fkey" FOREIGN KEY (product_group_id) REFERENCES medreport_product_groups(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; +-- alter table "public"."medreport_products" add constraint "medreport_products_product_groups_id_fkey" FOREIGN KEY (product_group_id) REFERENCES medreport_product_groups(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; -alter table "public"."medreport_products" validate constraint "medreport_products_product_groups_id_fkey"; +-- alter table "public"."medreport_products" validate constraint "medreport_products_product_groups_id_fkey"; -grant select on table "public"."medreport_product_groups" to "anon"; +-- grant select on table "public"."medreport_product_groups" to "anon"; -grant select on table "public"."medreport_product_groups" to "authenticated"; +-- grant select on table "public"."medreport_product_groups" to "authenticated"; -grant delete on table "public"."medreport_product_groups" to "service_role"; +-- grant delete on table "public"."medreport_product_groups" to "service_role"; -grant insert on table "public"."medreport_product_groups" to "service_role"; +-- grant insert on table "public"."medreport_product_groups" to "service_role"; -grant references on table "public"."medreport_product_groups" to "service_role"; +-- grant references on table "public"."medreport_product_groups" to "service_role"; -grant select on table "public"."medreport_product_groups" to "service_role"; +-- grant select on table "public"."medreport_product_groups" to "service_role"; -grant trigger on table "public"."medreport_product_groups" to "service_role"; +-- grant trigger on table "public"."medreport_product_groups" to "service_role"; -grant truncate on table "public"."medreport_product_groups" to "service_role"; +-- grant truncate on table "public"."medreport_product_groups" to "service_role"; -grant update on table "public"."medreport_product_groups" to "service_role"; +-- grant update on table "public"."medreport_product_groups" to "service_role"; -CREATE UNIQUE INDEX medreport_products_analyses_analysis_element_id_key ON public.medreport_products_analyses_relations USING btree (analysis_element_id); +-- CREATE UNIQUE INDEX medreport_products_analyses_analysis_element_id_key ON public.medreport_products_analyses_relations USING btree (analysis_element_id); -CREATE UNIQUE INDEX medreport_products_analyses_analysis_id_key ON public.medreport_products_analyses_relations USING btree (analysis_id); +-- CREATE UNIQUE INDEX medreport_products_analyses_analysis_id_key ON public.medreport_products_analyses_relations USING btree (analysis_id); -CREATE UNIQUE INDEX medreport_products_analyses_pkey ON public.medreport_products_analyses_relations USING btree (product_id); +-- CREATE UNIQUE INDEX medreport_products_analyses_pkey ON public.medreport_products_analyses_relations USING btree (product_id); -CREATE UNIQUE INDEX medreport_products_name_key ON public.medreport_products USING btree (name); +-- CREATE UNIQUE INDEX medreport_products_name_key ON public.medreport_products USING btree (name); -CREATE UNIQUE INDEX medreport_products_pkey ON public.medreport_products USING btree (id); +-- CREATE UNIQUE INDEX medreport_products_pkey ON public.medreport_products USING btree (id); -alter table "public"."medreport_products" add constraint "medreport_products_pkey" PRIMARY KEY using index "medreport_products_pkey"; +-- alter table "public"."medreport_products" add constraint "medreport_products_pkey" PRIMARY KEY using index "medreport_products_pkey"; -alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_pkey" PRIMARY KEY using index "medreport_products_analyses_pkey"; +-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_pkey" PRIMARY KEY using index "medreport_products_analyses_pkey"; -alter table "public"."medreport_products" add constraint "medreport_products_name_key" UNIQUE using index "medreport_products_name_key"; +-- alter table "public"."medreport_products" add constraint "medreport_products_name_key" UNIQUE using index "medreport_products_name_key"; -alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_element_id_fkey" FOREIGN KEY (analysis_element_id) REFERENCES analysis_elements(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; +-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_element_id_fkey" FOREIGN KEY (analysis_element_id) REFERENCES analysis_elements(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; -alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_element_id_fkey"; +-- alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_element_id_fkey"; -alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_element_id_key" UNIQUE using index "medreport_products_analyses_analysis_element_id_key"; +-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_element_id_key" UNIQUE using index "medreport_products_analyses_analysis_element_id_key"; -alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_fkey" FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; +-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_fkey" FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; -alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_id_fkey"; +-- alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_id_fkey"; -alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_key" UNIQUE using index "medreport_products_analyses_analysis_id_key"; +-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_key" UNIQUE using index "medreport_products_analyses_analysis_id_key"; -alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_product_id_fkey" FOREIGN KEY (product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; +-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_product_id_fkey" FOREIGN KEY (product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; -alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_product_id_fkey"; +-- alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_product_id_fkey"; -alter table "public"."medreport_products_analyses_relations" add constraint "product_can_be_tied_to_only_one_external_item" CHECK (((analysis_id IS NULL) OR (analysis_element_id IS NULL))) not valid; +-- alter table "public"."medreport_products_analyses_relations" add constraint "product_can_be_tied_to_only_one_external_item" CHECK (((analysis_id IS NULL) OR (analysis_element_id IS NULL))) not valid; -alter table "public"."medreport_products_analyses_relations" validate constraint "product_can_be_tied_to_only_one_external_item"; +-- alter table "public"."medreport_products_analyses_relations" validate constraint "product_can_be_tied_to_only_one_external_item"; -grant select on table "public"."medreport_products" to "anon"; +-- grant select on table "public"."medreport_products" to "anon"; -grant select on table "public"."medreport_products" to "authenticated"; +-- grant select on table "public"."medreport_products" to "authenticated"; -grant delete on table "public"."medreport_products" to "service_role"; +-- grant delete on table "public"."medreport_products" to "service_role"; -grant insert on table "public"."medreport_products" to "service_role"; +-- grant insert on table "public"."medreport_products" to "service_role"; -grant references on table "public"."medreport_products" to "service_role"; +-- grant references on table "public"."medreport_products" to "service_role"; -grant select on table "public"."medreport_products" to "service_role"; +-- grant select on table "public"."medreport_products" to "service_role"; -grant trigger on table "public"."medreport_products" to "service_role"; +-- grant trigger on table "public"."medreport_products" to "service_role"; -grant truncate on table "public"."medreport_products" to "service_role"; +-- grant truncate on table "public"."medreport_products" to "service_role"; -grant update on table "public"."medreport_products" to "service_role"; +-- grant update on table "public"."medreport_products" to "service_role"; -grant select on table "public"."medreport_products_analyses_relations" to "anon"; +-- grant select on table "public"."medreport_products_analyses_relations" to "anon"; -grant select on table "public"."medreport_products_analyses_relations" to "authenticated"; +-- grant select on table "public"."medreport_products_analyses_relations" to "authenticated"; -grant delete on table "public"."medreport_products_analyses_relations" to "service_role"; +-- grant delete on table "public"."medreport_products_analyses_relations" to "service_role"; -grant insert on table "public"."medreport_products_analyses_relations" to "service_role"; +-- grant insert on table "public"."medreport_products_analyses_relations" to "service_role"; -grant references on table "public"."medreport_products_analyses_relations" to "service_role"; +-- grant references on table "public"."medreport_products_analyses_relations" to "service_role"; -grant select on table "public"."medreport_products_analyses_relations" to "service_role"; +-- grant select on table "public"."medreport_products_analyses_relations" to "service_role"; -grant trigger on table "public"."medreport_products_analyses_relations" to "service_role"; +-- grant trigger on table "public"."medreport_products_analyses_relations" to "service_role"; -grant truncate on table "public"."medreport_products_analyses_relations" to "service_role"; +-- grant truncate on table "public"."medreport_products_analyses_relations" to "service_role"; -grant update on table "public"."medreport_products_analyses_relations" to "service_role"; +-- grant update on table "public"."medreport_products_analyses_relations" to "service_role"; -create policy "Enable read access for all users" -on "public"."medreport_products_analyses_relations" -as permissive -for select -to public -using (true); +-- create policy "Enable read access for all users" +-- on "public"."medreport_products_analyses_relations" +-- as permissive +-- for select +-- to public +-- using (true); -ALTER TABLE medreport_products_analyses_relations -ADD CONSTRAINT product_can_be_tied_to_only_one_analysis_item -CHECK (analysis_id IS NULL OR analysis_element_id IS NULL); +-- ALTER TABLE medreport_products_analyses_relations +-- ADD CONSTRAINT product_can_be_tied_to_only_one_analysis_item +-- CHECK (analysis_id IS NULL OR analysis_element_id IS NULL); -create table "public"."medreport_products_external_services_relations" ( - "product_id" bigint not null, - "connected_online_service_id" bigint not null -); +-- create table "public"."medreport_products_external_services_relations" ( +-- "product_id" bigint not null, +-- "connected_online_service_id" bigint not null +-- ); -alter table "public"."medreport_products_external_services_relations" enable row level security; +-- alter table "public"."medreport_products_external_services_relations" enable row level security; -CREATE UNIQUE INDEX medreport_products_connected_online_services_id_key ON public.medreport_products_external_services_relations USING btree (connected_online_service_id); +-- CREATE UNIQUE INDEX medreport_products_connected_online_services_id_key ON public.medreport_products_external_services_relations USING btree (connected_online_service_id); -CREATE UNIQUE INDEX medreport_products_connected_online_services_pkey ON public.medreport_products_external_services_relations USING btree (connected_online_service_id); +-- CREATE UNIQUE INDEX medreport_products_connected_online_services_pkey ON public.medreport_products_external_services_relations USING btree (connected_online_service_id); -alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_pkey" PRIMARY KEY using index "medreport_products_connected_online_services_pkey"; +-- alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_pkey" PRIMARY KEY using index "medreport_products_connected_online_services_pkey"; -alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_id_fkey" FOREIGN KEY (connected_online_service_id) REFERENCES connected_online_services(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; +-- alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_id_fkey" FOREIGN KEY (connected_online_service_id) REFERENCES connected_online_services(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; -alter table "public"."medreport_products_external_services_relations" validate constraint "medreport_products_connected_online_services_id_fkey"; +-- alter table "public"."medreport_products_external_services_relations" validate constraint "medreport_products_connected_online_services_id_fkey"; -alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_id_key" UNIQUE using index "medreport_products_connected_online_services_id_key"; +-- alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_id_key" UNIQUE using index "medreport_products_connected_online_services_id_key"; -alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_product_id_fkey" FOREIGN KEY (product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; +-- alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_product_id_fkey" FOREIGN KEY (product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid; -alter table "public"."medreport_products_external_services_relations" validate constraint "medreport_products_connected_online_services_product_id_fkey"; +-- alter table "public"."medreport_products_external_services_relations" validate constraint "medreport_products_connected_online_services_product_id_fkey"; -grant select on table "public"."medreport_products_external_services_relations" to "anon"; +-- grant select on table "public"."medreport_products_external_services_relations" to "anon"; -grant select on table "public"."medreport_products_external_services_relations" to "authenticated"; +-- grant select on table "public"."medreport_products_external_services_relations" to "authenticated"; -grant delete on table "public"."medreport_products_external_services_relations" to "service_role"; +-- grant delete on table "public"."medreport_products_external_services_relations" to "service_role"; -grant insert on table "public"."medreport_products_external_services_relations" to "service_role"; +-- grant insert on table "public"."medreport_products_external_services_relations" to "service_role"; -grant references on table "public"."medreport_products_external_services_relations" to "service_role"; +-- grant references on table "public"."medreport_products_external_services_relations" to "service_role"; -grant select on table "public"."medreport_products_external_services_relations" to "service_role"; +-- grant select on table "public"."medreport_products_external_services_relations" to "service_role"; -grant trigger on table "public"."medreport_products_external_services_relations" to "service_role"; +-- grant trigger on table "public"."medreport_products_external_services_relations" to "service_role"; -grant truncate on table "public"."medreport_products_external_services_relations" to "service_role"; +-- grant truncate on table "public"."medreport_products_external_services_relations" to "service_role"; -grant update on table "public"."medreport_products_external_services_relations" to "service_role"; +-- grant update on table "public"."medreport_products_external_services_relations" to "service_role"; -CREATE OR REPLACE FUNCTION check_tied_to_connected_online() -RETURNS TRIGGER AS $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM medreport_products_external_services_relations - WHERE product_id = NEW.product_id - ) THEN - RAISE EXCEPTION 'Value "%" already exists in medreport_products_external_services_relations', NEW.product_id; - END IF; +-- CREATE OR REPLACE FUNCTION check_tied_to_connected_online() +-- RETURNS TRIGGER AS $$ +-- BEGIN +-- IF EXISTS ( +-- SELECT 1 +-- FROM medreport_products_external_services_relations +-- WHERE product_id = NEW.product_id +-- ) THEN +-- RAISE EXCEPTION 'Value "%" already exists in medreport_products_external_services_relations', NEW.product_id; +-- END IF; - RETURN NEW; -END; -$$ LANGUAGE plpgsql; +-- RETURN NEW; +-- END; +-- $$ LANGUAGE plpgsql; -CREATE OR REPLACE FUNCTION check_tied_to_analysis_item() -RETURNS TRIGGER AS $$ -BEGIN - IF EXISTS ( - SELECT 1 - FROM medreport_products_analyses_relations - WHERE product_id = NEW.product_id - ) THEN - RAISE EXCEPTION 'Value "%" already exists in medreport_products_analyses_relations', NEW.product_id; - END IF; +-- CREATE OR REPLACE FUNCTION check_tied_to_analysis_item() +-- RETURNS TRIGGER AS $$ +-- BEGIN +-- IF EXISTS ( +-- SELECT 1 +-- FROM medreport_products_analyses_relations +-- WHERE product_id = NEW.product_id +-- ) THEN +-- RAISE EXCEPTION 'Value "%" already exists in medreport_products_analyses_relations', NEW.product_id; +-- END IF; - RETURN NEW; -END; -$$ LANGUAGE plpgsql; +-- RETURN NEW; +-- END; +-- $$ LANGUAGE plpgsql; -CREATE TRIGGER check_not_already_tied_to_connected_online BEFORE INSERT OR UPDATE ON public.medreport_products_analyses_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_connected_online(); +-- CREATE TRIGGER check_not_already_tied_to_connected_online BEFORE INSERT OR UPDATE ON public.medreport_products_analyses_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_connected_online(); -CREATE TRIGGER check_not_already_tied_to_analysis BEFORE INSERT OR UPDATE ON public.medreport_products_external_services_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_analysis_item(); +-- CREATE TRIGGER check_not_already_tied_to_analysis BEFORE INSERT OR UPDATE ON public.medreport_products_external_services_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_analysis_item(); -create policy "read_all" -on "public"."medreport_product_groups" -as permissive -for select -to public -using (true); +-- create policy "read_all" +-- on "public"."medreport_product_groups" +-- as permissive +-- for select +-- to public +-- using (true); diff --git a/supabase/migrations/20250703145757_add_medreport_schema.sql b/supabase/migrations/20250703145757_add_medreport_schema.sql index 8e66630..7b7ac0e 100644 --- a/supabase/migrations/20250703145757_add_medreport_schema.sql +++ b/supabase/migrations/20250703145757_add_medreport_schema.sql @@ -680,17 +680,17 @@ drop policy "accounts_self_update" on "public"."accounts"; drop policy "create_org_account" on "public"."accounts"; -drop policy "restrict_mfa_accounts" on "public"."accounts"; +-- drop policy "restrict_mfa_accounts" on "public"."accounts"; -drop policy "super_admins_access_accounts" on "public"."accounts"; +-- drop policy "super_admins_access_accounts" on "public"."accounts"; drop policy "accounts_memberships_delete" on "public"."accounts_memberships"; drop policy "accounts_memberships_read" on "public"."accounts_memberships"; -drop policy "restrict_mfa_accounts_memberships" on "public"."accounts_memberships"; +-- drop policy "restrict_mfa_accounts_memberships" on "public"."accounts_memberships"; -drop policy "super_admins_access_accounts_memberships" on "public"."accounts_memberships"; +-- drop policy "super_admins_access_accounts_memberships" on "public"."accounts_memberships"; drop policy "analysis_all" on "public"."analyses"; @@ -742,53 +742,53 @@ drop policy "invitations_read_self" on "public"."invitations"; drop policy "invitations_update" on "public"."invitations"; -drop policy "restrict_mfa_invitations" on "public"."invitations"; +-- drop policy "restrict_mfa_invitations" on "public"."invitations"; -drop policy "super_admins_access_invitations" on "public"."invitations"; +-- drop policy "super_admins_access_invitations" on "public"."invitations"; drop policy "read_all" on "public"."medreport_product_groups"; drop policy "Enable read access for all users" on "public"."medreport_products_analyses_relations"; -drop policy "Users can read their own nonces" on "public"."nonces"; +-- drop policy "Users can read their own nonces" on "public"."nonces"; drop policy "notifications_read_self" on "public"."notifications"; drop policy "notifications_update_self" on "public"."notifications"; -drop policy "restrict_mfa_notifications" on "public"."notifications"; +-- drop policy "restrict_mfa_notifications" on "public"."notifications"; drop policy "order_items_read_self" on "public"."order_items"; -drop policy "restrict_mfa_order_items" on "public"."order_items"; +-- drop policy "restrict_mfa_order_items" on "public"."order_items"; -drop policy "super_admins_access_order_items" on "public"."order_items"; +-- drop policy "super_admins_access_order_items" on "public"."order_items"; drop policy "orders_read_self" on "public"."orders"; -drop policy "restrict_mfa_orders" on "public"."orders"; +-- drop policy "restrict_mfa_orders" on "public"."orders"; -drop policy "super_admins_access_orders" on "public"."orders"; +-- drop policy "super_admins_access_orders" on "public"."orders"; -drop policy "restrict_mfa_role_permissions" on "public"."role_permissions"; +-- drop policy "restrict_mfa_role_permissions" on "public"."role_permissions"; drop policy "role_permissions_read" on "public"."role_permissions"; -drop policy "super_admins_access_role_permissions" on "public"."role_permissions"; +-- drop policy "super_admins_access_role_permissions" on "public"."role_permissions"; drop policy "roles_read" on "public"."roles"; -drop policy "restrict_mfa_subscription_items" on "public"."subscription_items"; +-- drop policy "restrict_mfa_subscription_items" on "public"."subscription_items"; drop policy "subscription_items_read_self" on "public"."subscription_items"; -drop policy "super_admins_access_subscription_items" on "public"."subscription_items"; +-- drop policy "super_admins_access_subscription_items" on "public"."subscription_items"; -drop policy "restrict_mfa_subscriptions" on "public"."subscriptions"; +-- drop policy "restrict_mfa_subscriptions" on "public"."subscriptions"; drop policy "subscriptions_read_self" on "public"."subscriptions"; -drop policy "super_admins_access_subscriptions" on "public"."subscriptions"; +-- drop policy "super_admins_access_subscriptions" on "public"."subscriptions"; alter table "public"."accounts" drop constraint "accounts_created_by_fkey"; @@ -888,7 +888,7 @@ alter table "public"."medreport_products_analyses_relations" drop constraint "pr alter table "public"."medreport_products_analyses_relations" drop constraint "product_can_be_tied_to_only_one_external_item"; -alter table "public"."nonces" drop constraint "nonces_user_id_fkey"; +-- alter table "public"."nonces" drop constraint "nonces_user_id_fkey"; alter table "public"."notifications" drop constraint "notifications_account_id_fkey"; @@ -956,7 +956,7 @@ alter table "public"."medreport_products_analyses_relations" drop constraint "me alter table "public"."medreport_products_external_services_relations" drop constraint "medreport_products_connected_online_services_pkey"; -alter table "public"."nonces" drop constraint "nonces_pkey"; +-- alter table "public"."nonces" drop constraint "nonces_pkey"; alter table "public"."notifications" drop constraint "notifications_pkey"; @@ -5160,47 +5160,47 @@ revoke truncate on table "public"."medreport_products_external_services_relation revoke update on table "public"."medreport_products_external_services_relations" from "service_role"; -revoke delete on table "public"."nonces" from "anon"; +-- revoke delete on table "public"."nonces" from "anon"; -revoke insert on table "public"."nonces" from "anon"; +-- revoke insert on table "public"."nonces" from "anon"; -revoke references on table "public"."nonces" from "anon"; +-- revoke references on table "public"."nonces" from "anon"; -revoke select on table "public"."nonces" from "anon"; +-- revoke select on table "public"."nonces" from "anon"; -revoke trigger on table "public"."nonces" from "anon"; +-- revoke trigger on table "public"."nonces" from "anon"; -revoke truncate on table "public"."nonces" from "anon"; +-- revoke truncate on table "public"."nonces" from "anon"; -revoke update on table "public"."nonces" from "anon"; +-- revoke update on table "public"."nonces" from "anon"; -revoke delete on table "public"."nonces" from "authenticated"; +-- revoke delete on table "public"."nonces" from "authenticated"; -revoke insert on table "public"."nonces" from "authenticated"; +-- revoke insert on table "public"."nonces" from "authenticated"; -revoke references on table "public"."nonces" from "authenticated"; +-- revoke references on table "public"."nonces" from "authenticated"; -revoke select on table "public"."nonces" from "authenticated"; +-- revoke select on table "public"."nonces" from "authenticated"; -revoke trigger on table "public"."nonces" from "authenticated"; +-- revoke trigger on table "public"."nonces" from "authenticated"; -revoke truncate on table "public"."nonces" from "authenticated"; +-- revoke truncate on table "public"."nonces" from "authenticated"; -revoke update on table "public"."nonces" from "authenticated"; +-- revoke update on table "public"."nonces" from "authenticated"; -revoke delete on table "public"."nonces" from "service_role"; +-- revoke delete on table "public"."nonces" from "service_role"; -revoke insert on table "public"."nonces" from "service_role"; +-- revoke insert on table "public"."nonces" from "service_role"; -revoke references on table "public"."nonces" from "service_role"; +-- revoke references on table "public"."nonces" from "service_role"; -revoke select on table "public"."nonces" from "service_role"; +-- revoke select on table "public"."nonces" from "service_role"; -revoke trigger on table "public"."nonces" from "service_role"; +-- revoke trigger on table "public"."nonces" from "service_role"; -revoke truncate on table "public"."nonces" from "service_role"; +-- revoke truncate on table "public"."nonces" from "service_role"; -revoke update on table "public"."nonces" from "service_role"; +-- revoke update on table "public"."nonces" from "service_role"; revoke delete on table "public"."notifications" from "anon"; @@ -5410,7 +5410,7 @@ drop table "public"."medreport_products_analyses_relations"; drop table "public"."medreport_products_external_services_relations"; -drop table "public"."nonces"; +-- drop table "public"."nonces"; drop table "public"."notifications";