feat: update API and database structure for membership confirmation and wallet integration
- Refactor API calls to use 'medreport' schema for membership confirmation and account updates - Enhance success notification component to include wallet balance and expiration details - Modify database types to reflect new 'medreport' schema and add product-related tables - Update localization files to support new wallet messages - Adjust SQL migration scripts for proper schema references and function definitions
This commit is contained in:
@@ -25,12 +25,11 @@ class AuthApi {
|
||||
throw new Error('User not authenticated');
|
||||
}
|
||||
|
||||
const { data, error } = await this.client.rpc(
|
||||
'has_unseen_membership_confirmation',
|
||||
{
|
||||
const { data, error } = await this.client
|
||||
.schema('medreport')
|
||||
.rpc('has_unseen_membership_confirmation', {
|
||||
p_user_id: user.id,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
@@ -53,15 +52,17 @@ class AuthApi {
|
||||
throw new Error('User not authenticated');
|
||||
}
|
||||
|
||||
const { error } = await this.client.rpc('update_account', {
|
||||
p_name: data.firstName,
|
||||
p_last_name: data.lastName,
|
||||
p_personal_code: data.personalCode,
|
||||
p_phone: data.phone || '',
|
||||
p_city: data.city || '',
|
||||
p_has_consent_personal_data: data.userConsent,
|
||||
p_uid: user.id,
|
||||
});
|
||||
const { error } = await this.client
|
||||
.schema('medreport')
|
||||
.rpc('update_account', {
|
||||
p_name: data.firstName,
|
||||
p_last_name: data.lastName,
|
||||
p_personal_code: data.personalCode,
|
||||
p_phone: data.phone || '',
|
||||
p_city: data.city || '',
|
||||
p_has_consent_personal_data: data.userConsent,
|
||||
p_uid: user.id,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
@@ -86,11 +87,14 @@ class AuthApi {
|
||||
throw new Error('User not authenticated');
|
||||
}
|
||||
console.log('test', user, data);
|
||||
const response = await this.client.from('account_params').insert({
|
||||
account_id: user.id,
|
||||
height: data.height,
|
||||
weight: data.weight,
|
||||
});
|
||||
const response = await this.client
|
||||
.schema('medreport')
|
||||
.from('account_params')
|
||||
.insert({
|
||||
account_id: user.id,
|
||||
height: data.height,
|
||||
weight: data.weight,
|
||||
});
|
||||
|
||||
if (response.error) {
|
||||
throw response.error;
|
||||
|
||||
@@ -11,12 +11,17 @@ export const SuccessNotification = ({
|
||||
title,
|
||||
titleKey,
|
||||
descriptionKey,
|
||||
walletProps,
|
||||
buttonProps,
|
||||
}: {
|
||||
showLogo?: boolean;
|
||||
title?: string;
|
||||
titleKey?: string;
|
||||
descriptionKey?: string;
|
||||
walletProps?: {
|
||||
amount: string;
|
||||
expiredAt: string;
|
||||
};
|
||||
buttonProps?: {
|
||||
buttonTitleKey: string;
|
||||
href: string;
|
||||
@@ -38,6 +43,16 @@ export const SuccessNotification = ({
|
||||
<Trans i18nKey={descriptionKey} />
|
||||
</p>
|
||||
</div>
|
||||
{walletProps && (
|
||||
<div>
|
||||
<Trans i18nKey="common.wallet.balance" />
|
||||
<p></p>
|
||||
<Trans
|
||||
i18nKey="common.wallet.expiredAt"
|
||||
values={{ expiredAt: '12.12.2025' }}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{buttonProps && (
|
||||
<Button className="mt-8 w-full">
|
||||
<Link href={buttonProps.href}>
|
||||
|
||||
@@ -157,7 +157,7 @@ export type Database = {
|
||||
[_ in never]: never
|
||||
}
|
||||
}
|
||||
public: {
|
||||
medreport: {
|
||||
Tables: {
|
||||
account_params: {
|
||||
Row: {
|
||||
@@ -189,7 +189,6 @@ export type Database = {
|
||||
created_at: string | null
|
||||
created_by: string | null
|
||||
email: string | null
|
||||
has_consent_anonymized_company_statistics: boolean | null
|
||||
has_consent_personal_data: boolean | null
|
||||
id: string
|
||||
is_personal_account: boolean
|
||||
@@ -209,7 +208,6 @@ export type Database = {
|
||||
created_at?: string | null
|
||||
created_by?: string | null
|
||||
email?: string | null
|
||||
has_consent_anonymized_company_statistics?: boolean | null
|
||||
has_consent_personal_data?: boolean | null
|
||||
id?: string
|
||||
is_personal_account?: boolean
|
||||
@@ -229,7 +227,6 @@ export type Database = {
|
||||
created_at?: string | null
|
||||
created_by?: string | null
|
||||
email?: string | null
|
||||
has_consent_anonymized_company_statistics?: boolean | null
|
||||
has_consent_personal_data?: boolean | null
|
||||
id?: string
|
||||
is_personal_account?: boolean
|
||||
@@ -438,7 +435,7 @@ export type Database = {
|
||||
analysis_ids: number[] | null
|
||||
created_at: string
|
||||
id: number
|
||||
status: Database["public"]["Enums"]["analysis_order_status"]
|
||||
status: Database["medreport"]["Enums"]["analysis_order_status"]
|
||||
user_id: string
|
||||
}
|
||||
Insert: {
|
||||
@@ -446,7 +443,7 @@ export type Database = {
|
||||
analysis_ids?: number[] | null
|
||||
created_at?: string
|
||||
id?: number
|
||||
status: Database["public"]["Enums"]["analysis_order_status"]
|
||||
status: Database["medreport"]["Enums"]["analysis_order_status"]
|
||||
user_id: string
|
||||
}
|
||||
Update: {
|
||||
@@ -454,7 +451,7 @@ export type Database = {
|
||||
analysis_ids?: number[] | null
|
||||
created_at?: string
|
||||
id?: number
|
||||
status?: Database["public"]["Enums"]["analysis_order_status"]
|
||||
status?: Database["medreport"]["Enums"]["analysis_order_status"]
|
||||
user_id?: string
|
||||
}
|
||||
Relationships: []
|
||||
@@ -524,7 +521,7 @@ export type Database = {
|
||||
created_at: string
|
||||
id: number
|
||||
order_number: string
|
||||
order_status: Database["public"]["Enums"]["analysis_order_status"]
|
||||
order_status: Database["medreport"]["Enums"]["analysis_order_status"]
|
||||
updated_at: string | null
|
||||
user_id: string
|
||||
}
|
||||
@@ -533,7 +530,7 @@ export type Database = {
|
||||
created_at?: string
|
||||
id?: number
|
||||
order_number: string
|
||||
order_status: Database["public"]["Enums"]["analysis_order_status"]
|
||||
order_status: Database["medreport"]["Enums"]["analysis_order_status"]
|
||||
updated_at?: string | null
|
||||
user_id: string
|
||||
}
|
||||
@@ -542,7 +539,7 @@ export type Database = {
|
||||
created_at?: string
|
||||
id?: number
|
||||
order_number?: string
|
||||
order_status?: Database["public"]["Enums"]["analysis_order_status"]
|
||||
order_status?: Database["medreport"]["Enums"]["analysis_order_status"]
|
||||
updated_at?: string | null
|
||||
user_id?: string
|
||||
}
|
||||
@@ -562,21 +559,21 @@ export type Database = {
|
||||
customer_id: string
|
||||
email: string | null
|
||||
id: number
|
||||
provider: Database["public"]["Enums"]["billing_provider"]
|
||||
provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
}
|
||||
Insert: {
|
||||
account_id: string
|
||||
customer_id: string
|
||||
email?: string | null
|
||||
id?: number
|
||||
provider: Database["public"]["Enums"]["billing_provider"]
|
||||
provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
}
|
||||
Update: {
|
||||
account_id?: string
|
||||
customer_id?: string
|
||||
email?: string | null
|
||||
id?: number
|
||||
provider?: Database["public"]["Enums"]["billing_provider"]
|
||||
provider?: Database["medreport"]["Enums"]["billing_provider"]
|
||||
}
|
||||
Relationships: [
|
||||
{
|
||||
@@ -665,19 +662,19 @@ export type Database = {
|
||||
}
|
||||
config: {
|
||||
Row: {
|
||||
billing_provider: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
enable_account_billing: boolean
|
||||
enable_team_account_billing: boolean
|
||||
enable_team_accounts: boolean
|
||||
}
|
||||
Insert: {
|
||||
billing_provider?: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider?: Database["medreport"]["Enums"]["billing_provider"]
|
||||
enable_account_billing?: boolean
|
||||
enable_team_account_billing?: boolean
|
||||
enable_team_accounts?: boolean
|
||||
}
|
||||
Update: {
|
||||
billing_provider?: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider?: Database["medreport"]["Enums"]["billing_provider"]
|
||||
enable_account_billing?: boolean
|
||||
enable_team_account_billing?: boolean
|
||||
enable_team_accounts?: boolean
|
||||
@@ -845,7 +842,6 @@ export type Database = {
|
||||
id: number
|
||||
invite_token: string
|
||||
invited_by: string
|
||||
personal_code: string | null
|
||||
role: string
|
||||
updated_at: string
|
||||
}
|
||||
@@ -857,7 +853,6 @@ export type Database = {
|
||||
id?: number
|
||||
invite_token: string
|
||||
invited_by: string
|
||||
personal_code?: string | null
|
||||
role: string
|
||||
updated_at?: string
|
||||
}
|
||||
@@ -869,7 +864,6 @@ export type Database = {
|
||||
id?: number
|
||||
invite_token?: string
|
||||
invited_by?: string
|
||||
personal_code?: string | null
|
||||
role?: string
|
||||
updated_at?: string
|
||||
}
|
||||
@@ -904,21 +898,74 @@ export type Database = {
|
||||
},
|
||||
]
|
||||
}
|
||||
medusa_products_analyses_relations: {
|
||||
medreport_product_groups: {
|
||||
Row: {
|
||||
created_at: string
|
||||
id: number
|
||||
name: string
|
||||
updated_at: string | null
|
||||
}
|
||||
Insert: {
|
||||
created_at?: string
|
||||
id?: number
|
||||
name: string
|
||||
updated_at?: string | null
|
||||
}
|
||||
Update: {
|
||||
created_at?: string
|
||||
id?: number
|
||||
name?: string
|
||||
updated_at?: string | null
|
||||
}
|
||||
Relationships: []
|
||||
}
|
||||
medreport_products: {
|
||||
Row: {
|
||||
created_at: string
|
||||
id: number
|
||||
name: string
|
||||
product_group_id: number | null
|
||||
updated_at: string | null
|
||||
}
|
||||
Insert: {
|
||||
created_at?: string
|
||||
id?: number
|
||||
name: string
|
||||
product_group_id?: number | null
|
||||
updated_at?: string | null
|
||||
}
|
||||
Update: {
|
||||
created_at?: string
|
||||
id?: number
|
||||
name?: string
|
||||
product_group_id?: number | null
|
||||
updated_at?: string | null
|
||||
}
|
||||
Relationships: [
|
||||
{
|
||||
foreignKeyName: "medreport_products_product_groups_id_fkey"
|
||||
columns: ["product_group_id"]
|
||||
isOneToOne: false
|
||||
referencedRelation: "medreport_product_groups"
|
||||
referencedColumns: ["id"]
|
||||
},
|
||||
]
|
||||
}
|
||||
medreport_products_analyses_relations: {
|
||||
Row: {
|
||||
analysis_element_id: number | null
|
||||
analysis_id: number | null
|
||||
medusa_product_id: number
|
||||
product_id: number
|
||||
}
|
||||
Insert: {
|
||||
analysis_element_id?: number | null
|
||||
analysis_id?: number | null
|
||||
medusa_product_id: number
|
||||
product_id: number
|
||||
}
|
||||
Update: {
|
||||
analysis_element_id?: number | null
|
||||
analysis_id?: number | null
|
||||
medusa_product_id?: number
|
||||
product_id?: number
|
||||
}
|
||||
Relationships: [
|
||||
{
|
||||
@@ -935,20 +982,27 @@ export type Database = {
|
||||
referencedRelation: "analyses"
|
||||
referencedColumns: ["id"]
|
||||
},
|
||||
{
|
||||
foreignKeyName: "medreport_products_analyses_product_id_fkey"
|
||||
columns: ["product_id"]
|
||||
isOneToOne: true
|
||||
referencedRelation: "medreport_products"
|
||||
referencedColumns: ["id"]
|
||||
},
|
||||
]
|
||||
}
|
||||
medusa_products_external_services_relations: {
|
||||
medreport_products_external_services_relations: {
|
||||
Row: {
|
||||
connected_online_service_id: number
|
||||
medusa_product_id: number
|
||||
product_id: number
|
||||
}
|
||||
Insert: {
|
||||
connected_online_service_id: number
|
||||
medusa_product_id: number
|
||||
product_id: number
|
||||
}
|
||||
Update: {
|
||||
connected_online_service_id?: number
|
||||
medusa_product_id?: number
|
||||
product_id?: number
|
||||
}
|
||||
Relationships: [
|
||||
{
|
||||
@@ -958,6 +1012,13 @@ export type Database = {
|
||||
referencedRelation: "connected_online_services"
|
||||
referencedColumns: ["id"]
|
||||
},
|
||||
{
|
||||
foreignKeyName: "medreport_products_connected_online_services_product_id_fkey"
|
||||
columns: ["product_id"]
|
||||
isOneToOne: false
|
||||
referencedRelation: "medreport_products"
|
||||
referencedColumns: ["id"]
|
||||
},
|
||||
]
|
||||
}
|
||||
nonces: {
|
||||
@@ -1021,35 +1082,35 @@ export type Database = {
|
||||
Row: {
|
||||
account_id: string
|
||||
body: string
|
||||
channel: Database["public"]["Enums"]["notification_channel"]
|
||||
channel: Database["medreport"]["Enums"]["notification_channel"]
|
||||
created_at: string
|
||||
dismissed: boolean
|
||||
expires_at: string | null
|
||||
id: number
|
||||
link: string | null
|
||||
type: Database["public"]["Enums"]["notification_type"]
|
||||
type: Database["medreport"]["Enums"]["notification_type"]
|
||||
}
|
||||
Insert: {
|
||||
account_id: string
|
||||
body: string
|
||||
channel?: Database["public"]["Enums"]["notification_channel"]
|
||||
channel?: Database["medreport"]["Enums"]["notification_channel"]
|
||||
created_at?: string
|
||||
dismissed?: boolean
|
||||
expires_at?: string | null
|
||||
id?: never
|
||||
link?: string | null
|
||||
type?: Database["public"]["Enums"]["notification_type"]
|
||||
type?: Database["medreport"]["Enums"]["notification_type"]
|
||||
}
|
||||
Update: {
|
||||
account_id?: string
|
||||
body?: string
|
||||
channel?: Database["public"]["Enums"]["notification_channel"]
|
||||
channel?: Database["medreport"]["Enums"]["notification_channel"]
|
||||
created_at?: string
|
||||
dismissed?: boolean
|
||||
expires_at?: string | null
|
||||
id?: never
|
||||
link?: string | null
|
||||
type?: Database["public"]["Enums"]["notification_type"]
|
||||
type?: Database["medreport"]["Enums"]["notification_type"]
|
||||
}
|
||||
Relationships: [
|
||||
{
|
||||
@@ -1120,33 +1181,33 @@ export type Database = {
|
||||
Row: {
|
||||
account_id: string
|
||||
billing_customer_id: number
|
||||
billing_provider: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
created_at: string
|
||||
currency: string
|
||||
id: string
|
||||
status: Database["public"]["Enums"]["payment_status"]
|
||||
status: Database["medreport"]["Enums"]["payment_status"]
|
||||
total_amount: number
|
||||
updated_at: string
|
||||
}
|
||||
Insert: {
|
||||
account_id: string
|
||||
billing_customer_id: number
|
||||
billing_provider: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
created_at?: string
|
||||
currency: string
|
||||
id: string
|
||||
status: Database["public"]["Enums"]["payment_status"]
|
||||
status: Database["medreport"]["Enums"]["payment_status"]
|
||||
total_amount: number
|
||||
updated_at?: string
|
||||
}
|
||||
Update: {
|
||||
account_id?: string
|
||||
billing_customer_id?: number
|
||||
billing_provider?: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider?: Database["medreport"]["Enums"]["billing_provider"]
|
||||
created_at?: string
|
||||
currency?: string
|
||||
id?: string
|
||||
status?: Database["public"]["Enums"]["payment_status"]
|
||||
status?: Database["medreport"]["Enums"]["payment_status"]
|
||||
total_amount?: number
|
||||
updated_at?: string
|
||||
}
|
||||
@@ -1184,17 +1245,17 @@ export type Database = {
|
||||
role_permissions: {
|
||||
Row: {
|
||||
id: number
|
||||
permission: Database["public"]["Enums"]["app_permissions"]
|
||||
permission: Database["medreport"]["Enums"]["app_permissions"]
|
||||
role: string
|
||||
}
|
||||
Insert: {
|
||||
id?: number
|
||||
permission: Database["public"]["Enums"]["app_permissions"]
|
||||
permission: Database["medreport"]["Enums"]["app_permissions"]
|
||||
role: string
|
||||
}
|
||||
Update: {
|
||||
id?: number
|
||||
permission?: Database["public"]["Enums"]["app_permissions"]
|
||||
permission?: Database["medreport"]["Enums"]["app_permissions"]
|
||||
role?: string
|
||||
}
|
||||
Relationships: [
|
||||
@@ -1232,7 +1293,7 @@ export type Database = {
|
||||
product_id: string
|
||||
quantity: number
|
||||
subscription_id: string
|
||||
type: Database["public"]["Enums"]["subscription_item_type"]
|
||||
type: Database["medreport"]["Enums"]["subscription_item_type"]
|
||||
updated_at: string
|
||||
variant_id: string
|
||||
}
|
||||
@@ -1245,7 +1306,7 @@ export type Database = {
|
||||
product_id: string
|
||||
quantity?: number
|
||||
subscription_id: string
|
||||
type: Database["public"]["Enums"]["subscription_item_type"]
|
||||
type: Database["medreport"]["Enums"]["subscription_item_type"]
|
||||
updated_at?: string
|
||||
variant_id: string
|
||||
}
|
||||
@@ -1258,7 +1319,7 @@ export type Database = {
|
||||
product_id?: string
|
||||
quantity?: number
|
||||
subscription_id?: string
|
||||
type?: Database["public"]["Enums"]["subscription_item_type"]
|
||||
type?: Database["medreport"]["Enums"]["subscription_item_type"]
|
||||
updated_at?: string
|
||||
variant_id?: string
|
||||
}
|
||||
@@ -1277,14 +1338,14 @@ export type Database = {
|
||||
account_id: string
|
||||
active: boolean
|
||||
billing_customer_id: number
|
||||
billing_provider: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
cancel_at_period_end: boolean
|
||||
created_at: string
|
||||
currency: string
|
||||
id: string
|
||||
period_ends_at: string
|
||||
period_starts_at: string
|
||||
status: Database["public"]["Enums"]["subscription_status"]
|
||||
status: Database["medreport"]["Enums"]["subscription_status"]
|
||||
trial_ends_at: string | null
|
||||
trial_starts_at: string | null
|
||||
updated_at: string
|
||||
@@ -1293,14 +1354,14 @@ export type Database = {
|
||||
account_id: string
|
||||
active: boolean
|
||||
billing_customer_id: number
|
||||
billing_provider: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
cancel_at_period_end: boolean
|
||||
created_at?: string
|
||||
currency: string
|
||||
id: string
|
||||
period_ends_at: string
|
||||
period_starts_at: string
|
||||
status: Database["public"]["Enums"]["subscription_status"]
|
||||
status: Database["medreport"]["Enums"]["subscription_status"]
|
||||
trial_ends_at?: string | null
|
||||
trial_starts_at?: string | null
|
||||
updated_at?: string
|
||||
@@ -1309,14 +1370,14 @@ export type Database = {
|
||||
account_id?: string
|
||||
active?: boolean
|
||||
billing_customer_id?: number
|
||||
billing_provider?: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider?: Database["medreport"]["Enums"]["billing_provider"]
|
||||
cancel_at_period_end?: boolean
|
||||
created_at?: string
|
||||
currency?: string
|
||||
id?: string
|
||||
period_ends_at?: string
|
||||
period_starts_at?: string
|
||||
status?: Database["public"]["Enums"]["subscription_status"]
|
||||
status?: Database["medreport"]["Enums"]["subscription_status"]
|
||||
trial_ends_at?: string | null
|
||||
trial_starts_at?: string | null
|
||||
updated_at?: string
|
||||
@@ -1360,7 +1421,7 @@ export type Database = {
|
||||
name: string | null
|
||||
picture_url: string | null
|
||||
subscription_status:
|
||||
| Database["public"]["Enums"]["subscription_status"]
|
||||
| Database["medreport"]["Enums"]["subscription_status"]
|
||||
| null
|
||||
}
|
||||
Relationships: []
|
||||
@@ -1394,7 +1455,7 @@ export type Database = {
|
||||
account_slug: string
|
||||
invitations: Database["public"]["CompositeTypes"]["invitation"][]
|
||||
}
|
||||
Returns: Database["public"]["Tables"]["invitations"]["Row"][]
|
||||
Returns: Database["medreport"]["Tables"]["invitations"]["Row"][]
|
||||
}
|
||||
can_action_account_member: {
|
||||
Args: { target_team_account_id: string; target_user_id: string }
|
||||
@@ -1410,7 +1471,6 @@ export type Database = {
|
||||
id: number
|
||||
invite_token: string
|
||||
invited_by: string
|
||||
personal_code: string | null
|
||||
role: string
|
||||
updated_at: string
|
||||
}
|
||||
@@ -1433,7 +1493,6 @@ export type Database = {
|
||||
created_at: string | null
|
||||
created_by: string | null
|
||||
email: string | null
|
||||
has_consent_anonymized_company_statistics: boolean | null
|
||||
has_consent_personal_data: boolean | null
|
||||
id: string
|
||||
is_personal_account: boolean
|
||||
@@ -1460,7 +1519,6 @@ export type Database = {
|
||||
created_at: string
|
||||
updated_at: string
|
||||
expires_at: string
|
||||
personal_code: string
|
||||
inviter_name: string
|
||||
inviter_email: string
|
||||
}[]
|
||||
@@ -1476,7 +1534,6 @@ export type Database = {
|
||||
primary_owner_user_id: string
|
||||
name: string
|
||||
email: string
|
||||
personal_code: string
|
||||
picture_url: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
@@ -1486,14 +1543,6 @@ export type Database = {
|
||||
Args: Record<PropertyKey, never>
|
||||
Returns: Json
|
||||
}
|
||||
get_invitations_with_account_ids: {
|
||||
Args: { company_id: string; personal_codes: string[] }
|
||||
Returns: {
|
||||
invite_token: string
|
||||
personal_code: string
|
||||
account_id: string
|
||||
}[]
|
||||
}
|
||||
get_nonce_status: {
|
||||
Args: { p_id: string }
|
||||
Returns: Json
|
||||
@@ -1522,7 +1571,7 @@ export type Database = {
|
||||
Args: {
|
||||
user_id: string
|
||||
account_id: string
|
||||
permission_name: Database["public"]["Enums"]["app_permissions"]
|
||||
permission_name: Database["medreport"]["Enums"]["app_permissions"]
|
||||
}
|
||||
Returns: boolean
|
||||
}
|
||||
@@ -1554,10 +1603,6 @@ export type Database = {
|
||||
Args: { target_account_id: string }
|
||||
Returns: boolean
|
||||
}
|
||||
is_company_admin: {
|
||||
Args: { account_slug: string }
|
||||
Returns: boolean
|
||||
}
|
||||
is_mfa_compliant: {
|
||||
Args: Record<PropertyKey, never>
|
||||
Returns: boolean
|
||||
@@ -1588,8 +1633,8 @@ export type Database = {
|
||||
role: string
|
||||
role_hierarchy_level: number
|
||||
primary_owner_user_id: string
|
||||
subscription_status: Database["public"]["Enums"]["subscription_status"]
|
||||
permissions: Database["public"]["Enums"]["app_permissions"][]
|
||||
subscription_status: Database["medreport"]["Enums"]["subscription_status"]
|
||||
permissions: Database["medreport"]["Enums"]["app_permissions"][]
|
||||
}[]
|
||||
}
|
||||
transfer_team_account_ownership: {
|
||||
@@ -1613,8 +1658,8 @@ export type Database = {
|
||||
target_account_id: string
|
||||
target_customer_id: string
|
||||
target_order_id: string
|
||||
status: Database["public"]["Enums"]["payment_status"]
|
||||
billing_provider: Database["public"]["Enums"]["billing_provider"]
|
||||
status: Database["medreport"]["Enums"]["payment_status"]
|
||||
billing_provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
total_amount: number
|
||||
currency: string
|
||||
line_items: Json
|
||||
@@ -1622,11 +1667,11 @@ export type Database = {
|
||||
Returns: {
|
||||
account_id: string
|
||||
billing_customer_id: number
|
||||
billing_provider: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
created_at: string
|
||||
currency: string
|
||||
id: string
|
||||
status: Database["public"]["Enums"]["payment_status"]
|
||||
status: Database["medreport"]["Enums"]["payment_status"]
|
||||
total_amount: number
|
||||
updated_at: string
|
||||
}
|
||||
@@ -1637,8 +1682,8 @@ export type Database = {
|
||||
target_customer_id: string
|
||||
target_subscription_id: string
|
||||
active: boolean
|
||||
status: Database["public"]["Enums"]["subscription_status"]
|
||||
billing_provider: Database["public"]["Enums"]["billing_provider"]
|
||||
status: Database["medreport"]["Enums"]["subscription_status"]
|
||||
billing_provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
cancel_at_period_end: boolean
|
||||
currency: string
|
||||
period_starts_at: string
|
||||
@@ -1651,14 +1696,14 @@ export type Database = {
|
||||
account_id: string
|
||||
active: boolean
|
||||
billing_customer_id: number
|
||||
billing_provider: Database["public"]["Enums"]["billing_provider"]
|
||||
billing_provider: Database["medreport"]["Enums"]["billing_provider"]
|
||||
cancel_at_period_end: boolean
|
||||
created_at: string
|
||||
currency: string
|
||||
id: string
|
||||
period_ends_at: string
|
||||
period_starts_at: string
|
||||
status: Database["public"]["Enums"]["subscription_status"]
|
||||
status: Database["medreport"]["Enums"]["subscription_status"]
|
||||
trial_ends_at: string | null
|
||||
trial_starts_at: string | null
|
||||
updated_at: string
|
||||
@@ -1706,6 +1751,51 @@ export type Database = {
|
||||
| "incomplete_expired"
|
||||
| "paused"
|
||||
}
|
||||
CompositeTypes: {
|
||||
[_ in never]: never
|
||||
}
|
||||
}
|
||||
public: {
|
||||
Tables: {
|
||||
[_ in never]: never
|
||||
}
|
||||
Views: {
|
||||
[_ in never]: never
|
||||
}
|
||||
Functions: {
|
||||
get_invitations_with_account_ids: {
|
||||
Args: { company_id: string; personal_codes: string[] }
|
||||
Returns: {
|
||||
invite_token: string
|
||||
personal_code: string
|
||||
account_id: string
|
||||
}[]
|
||||
}
|
||||
has_permission: {
|
||||
Args: {
|
||||
user_id: string
|
||||
account_id: string
|
||||
permission_name: Database["public"]["Enums"]["app_permissions"]
|
||||
}
|
||||
Returns: boolean
|
||||
}
|
||||
has_role_on_account: {
|
||||
Args: { account_id: string; account_role?: string }
|
||||
Returns: boolean
|
||||
}
|
||||
is_company_admin: {
|
||||
Args: { account_slug: string }
|
||||
Returns: boolean
|
||||
}
|
||||
}
|
||||
Enums: {
|
||||
app_permissions:
|
||||
| "roles.manage"
|
||||
| "billing.manage"
|
||||
| "settings.manage"
|
||||
| "members.manage"
|
||||
| "invites.manage"
|
||||
}
|
||||
CompositeTypes: {
|
||||
invitation: {
|
||||
email: string | null
|
||||
@@ -1831,7 +1921,7 @@ export const Constants = {
|
||||
graphql_public: {
|
||||
Enums: {},
|
||||
},
|
||||
public: {
|
||||
medreport: {
|
||||
Enums: {
|
||||
analysis_order_status: [
|
||||
"QUEUED",
|
||||
@@ -1865,5 +1955,16 @@ export const Constants = {
|
||||
],
|
||||
},
|
||||
},
|
||||
public: {
|
||||
Enums: {
|
||||
app_permissions: [
|
||||
"roles.manage",
|
||||
"billing.manage",
|
||||
"settings.manage",
|
||||
"members.manage",
|
||||
"invites.manage",
|
||||
],
|
||||
},
|
||||
},
|
||||
} as const
|
||||
|
||||
|
||||
@@ -120,5 +120,9 @@
|
||||
"city": "Linn",
|
||||
"weight": "Kaal",
|
||||
"height": "Pikkus"
|
||||
},
|
||||
"wallet": {
|
||||
"balance": "Sinu MedReporti konto seis",
|
||||
"expiredAt": "Kehtiv kuni {{expiredAt}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,342 +0,0 @@
|
||||
drop trigger if exists "check_not_already_tied_to_connected_online" on "public"."medreport_products_analyses_relations";
|
||||
|
||||
drop trigger if exists "check_not_already_tied_to_analysis" on "public"."medreport_products_external_services_relations";
|
||||
|
||||
drop policy "read_all" on "public"."medreport_product_groups";
|
||||
|
||||
drop policy "Enable read access for all users" on "public"."medreport_products_analyses_relations";
|
||||
|
||||
revoke delete on table "public"."medreport_product_groups" from "anon";
|
||||
|
||||
revoke insert on table "public"."medreport_product_groups" from "anon";
|
||||
|
||||
revoke references on table "public"."medreport_product_groups" from "anon";
|
||||
|
||||
revoke select on table "public"."medreport_product_groups" from "anon";
|
||||
|
||||
revoke trigger on table "public"."medreport_product_groups" from "anon";
|
||||
|
||||
revoke truncate on table "public"."medreport_product_groups" from "anon";
|
||||
|
||||
revoke update on table "public"."medreport_product_groups" from "anon";
|
||||
|
||||
revoke delete on table "public"."medreport_product_groups" from "authenticated";
|
||||
|
||||
revoke insert on table "public"."medreport_product_groups" from "authenticated";
|
||||
|
||||
revoke references on table "public"."medreport_product_groups" from "authenticated";
|
||||
|
||||
revoke select on table "public"."medreport_product_groups" from "authenticated";
|
||||
|
||||
revoke trigger on table "public"."medreport_product_groups" from "authenticated";
|
||||
|
||||
revoke truncate on table "public"."medreport_product_groups" from "authenticated";
|
||||
|
||||
revoke update on table "public"."medreport_product_groups" from "authenticated";
|
||||
|
||||
revoke delete on table "public"."medreport_product_groups" from "service_role";
|
||||
|
||||
revoke insert on table "public"."medreport_product_groups" from "service_role";
|
||||
|
||||
revoke references on table "public"."medreport_product_groups" from "service_role";
|
||||
|
||||
revoke select on table "public"."medreport_product_groups" from "service_role";
|
||||
|
||||
revoke trigger on table "public"."medreport_product_groups" from "service_role";
|
||||
|
||||
revoke truncate on table "public"."medreport_product_groups" from "service_role";
|
||||
|
||||
revoke update on table "public"."medreport_product_groups" from "service_role";
|
||||
|
||||
revoke delete on table "public"."medreport_products_analyses_relations" from "anon";
|
||||
|
||||
revoke insert on table "public"."medreport_products_analyses_relations" from "anon";
|
||||
|
||||
revoke references on table "public"."medreport_products_analyses_relations" from "anon";
|
||||
|
||||
revoke select on table "public"."medreport_products_analyses_relations" from "anon";
|
||||
|
||||
revoke trigger on table "public"."medreport_products_analyses_relations" from "anon";
|
||||
|
||||
revoke truncate on table "public"."medreport_products_analyses_relations" from "anon";
|
||||
|
||||
revoke update on table "public"."medreport_products_analyses_relations" from "anon";
|
||||
|
||||
revoke delete on table "public"."medreport_products_analyses_relations" from "authenticated";
|
||||
|
||||
revoke insert on table "public"."medreport_products_analyses_relations" from "authenticated";
|
||||
|
||||
revoke references on table "public"."medreport_products_analyses_relations" from "authenticated";
|
||||
|
||||
revoke select on table "public"."medreport_products_analyses_relations" from "authenticated";
|
||||
|
||||
revoke trigger on table "public"."medreport_products_analyses_relations" from "authenticated";
|
||||
|
||||
revoke truncate on table "public"."medreport_products_analyses_relations" from "authenticated";
|
||||
|
||||
revoke update on table "public"."medreport_products_analyses_relations" from "authenticated";
|
||||
|
||||
revoke delete on table "public"."medreport_products_analyses_relations" from "service_role";
|
||||
|
||||
revoke insert on table "public"."medreport_products_analyses_relations" from "service_role";
|
||||
|
||||
revoke references on table "public"."medreport_products_analyses_relations" from "service_role";
|
||||
|
||||
revoke select on table "public"."medreport_products_analyses_relations" from "service_role";
|
||||
|
||||
revoke trigger on table "public"."medreport_products_analyses_relations" from "service_role";
|
||||
|
||||
revoke truncate on table "public"."medreport_products_analyses_relations" from "service_role";
|
||||
|
||||
revoke update on table "public"."medreport_products_analyses_relations" from "service_role";
|
||||
|
||||
revoke delete on table "public"."medreport_products_external_services_relations" from "anon";
|
||||
|
||||
revoke insert on table "public"."medreport_products_external_services_relations" from "anon";
|
||||
|
||||
revoke references on table "public"."medreport_products_external_services_relations" from "anon";
|
||||
|
||||
revoke select on table "public"."medreport_products_external_services_relations" from "anon";
|
||||
|
||||
revoke trigger on table "public"."medreport_products_external_services_relations" from "anon";
|
||||
|
||||
revoke truncate on table "public"."medreport_products_external_services_relations" from "anon";
|
||||
|
||||
revoke update on table "public"."medreport_products_external_services_relations" from "anon";
|
||||
|
||||
revoke delete on table "public"."medreport_products_external_services_relations" from "authenticated";
|
||||
|
||||
revoke insert on table "public"."medreport_products_external_services_relations" from "authenticated";
|
||||
|
||||
revoke references on table "public"."medreport_products_external_services_relations" from "authenticated";
|
||||
|
||||
revoke select on table "public"."medreport_products_external_services_relations" from "authenticated";
|
||||
|
||||
revoke trigger on table "public"."medreport_products_external_services_relations" from "authenticated";
|
||||
|
||||
revoke truncate on table "public"."medreport_products_external_services_relations" from "authenticated";
|
||||
|
||||
revoke update on table "public"."medreport_products_external_services_relations" from "authenticated";
|
||||
|
||||
revoke delete on table "public"."medreport_products_external_services_relations" from "service_role";
|
||||
|
||||
revoke insert on table "public"."medreport_products_external_services_relations" from "service_role";
|
||||
|
||||
revoke references on table "public"."medreport_products_external_services_relations" from "service_role";
|
||||
|
||||
revoke select on table "public"."medreport_products_external_services_relations" from "service_role";
|
||||
|
||||
revoke trigger on table "public"."medreport_products_external_services_relations" from "service_role";
|
||||
|
||||
revoke truncate on table "public"."medreport_products_external_services_relations" from "service_role";
|
||||
|
||||
revoke update on table "public"."medreport_products_external_services_relations" from "service_role";
|
||||
|
||||
alter table "public"."medreport_product_groups" drop constraint "medreport_product_groups_name_key";
|
||||
|
||||
alter table "public"."medreport_products" drop constraint "medreport_products_product_groups_id_fkey";
|
||||
|
||||
alter table "public"."medreport_products_analyses_relations" drop constraint "medreport_products_analyses_analysis_element_id_fkey";
|
||||
|
||||
alter table "public"."medreport_products_analyses_relations" drop constraint "medreport_products_analyses_analysis_element_id_key";
|
||||
|
||||
alter table "public"."medreport_products_analyses_relations" drop constraint "medreport_products_analyses_analysis_id_fkey";
|
||||
|
||||
alter table "public"."medreport_products_analyses_relations" drop constraint "medreport_products_analyses_analysis_id_key";
|
||||
|
||||
alter table "public"."medreport_products_analyses_relations" drop constraint "medreport_products_analyses_product_id_fkey";
|
||||
|
||||
alter table "public"."medreport_products_analyses_relations" drop constraint "product_can_be_tied_to_only_one_analysis_item";
|
||||
|
||||
alter table "public"."medreport_products_analyses_relations" drop constraint "product_can_be_tied_to_only_one_external_item";
|
||||
|
||||
alter table "public"."medreport_products_external_services_relations" drop constraint "medreport_products_connected_online_services_id_fkey";
|
||||
|
||||
alter table "public"."medreport_products_external_services_relations" drop constraint "medreport_products_connected_online_services_id_key";
|
||||
|
||||
alter table "public"."medreport_products_external_services_relations" drop constraint "medreport_products_connected_online_services_product_id_fkey";
|
||||
|
||||
alter table "public"."medreport_product_groups" drop constraint "medreport_product_groups_pkey";
|
||||
|
||||
alter table "public"."medreport_products_analyses_relations" drop constraint "medreport_products_analyses_pkey";
|
||||
|
||||
alter table "public"."medreport_products_external_services_relations" drop constraint "medreport_products_connected_online_services_pkey";
|
||||
|
||||
drop index if exists "public"."medreport_product_groups_name_key";
|
||||
|
||||
drop index if exists "public"."medreport_product_groups_pkey";
|
||||
|
||||
drop index if exists "public"."medreport_products_analyses_pkey";
|
||||
|
||||
drop index if exists "public"."medreport_products_analyses_analysis_element_id_key";
|
||||
|
||||
drop index if exists "public"."medreport_products_analyses_analysis_id_key";
|
||||
|
||||
drop index if exists "public"."medreport_products_connected_online_services_id_key";
|
||||
|
||||
drop index if exists "public"."medreport_products_connected_online_services_pkey";
|
||||
|
||||
drop table "public"."medreport_product_groups";
|
||||
|
||||
drop table "public"."medreport_products_analyses_relations";
|
||||
|
||||
drop table "public"."medreport_products_external_services_relations";
|
||||
|
||||
create table "public"."medusa_products_analyses_relations" (
|
||||
"medusa_product_id" bigint not null,
|
||||
"analysis_element_id" bigint,
|
||||
"analysis_id" bigint
|
||||
);
|
||||
|
||||
|
||||
alter table "public"."medusa_products_analyses_relations" enable row level security;
|
||||
|
||||
create table "public"."medusa_products_external_services_relations" (
|
||||
"medusa_product_id" bigint not null,
|
||||
"connected_online_service_id" bigint not null
|
||||
);
|
||||
|
||||
|
||||
alter table "public"."medusa_products_external_services_relations" enable row level security;
|
||||
|
||||
CREATE UNIQUE INDEX medusa_products_analyses_relations_pkey ON public.medusa_products_analyses_relations USING btree (medusa_product_id);
|
||||
|
||||
CREATE UNIQUE INDEX medusa_products_external_services_relations_product_id_key ON public.medusa_products_external_services_relations USING btree (medusa_product_id);
|
||||
|
||||
CREATE UNIQUE INDEX medreport_products_analyses_analysis_element_id_key ON public.medusa_products_analyses_relations USING btree (analysis_element_id);
|
||||
|
||||
CREATE UNIQUE INDEX medreport_products_analyses_analysis_id_key ON public.medusa_products_analyses_relations USING btree (analysis_id);
|
||||
|
||||
CREATE UNIQUE INDEX medreport_products_connected_online_services_id_key ON public.medusa_products_external_services_relations USING btree (connected_online_service_id);
|
||||
|
||||
CREATE UNIQUE INDEX medreport_products_connected_online_services_pkey ON public.medusa_products_external_services_relations USING btree (connected_online_service_id);
|
||||
|
||||
alter table "public"."medusa_products_analyses_relations" add constraint "medusa_products_analyses_relations_pkey" PRIMARY KEY using index "medusa_products_analyses_relations_pkey";
|
||||
|
||||
alter table "public"."medusa_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"."medusa_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"."medusa_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_element_id_fkey";
|
||||
|
||||
alter table "public"."medusa_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"."medusa_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"."medusa_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_id_fkey";
|
||||
|
||||
alter table "public"."medusa_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_key" UNIQUE using index "medreport_products_analyses_analysis_id_key";
|
||||
|
||||
alter table "public"."medusa_products_analyses_relations" add constraint "medreport_products_analyses_product_id_fkey" FOREIGN KEY (medusa_product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
|
||||
|
||||
alter table "public"."medusa_products_analyses_relations" validate constraint "medreport_products_analyses_product_id_fkey";
|
||||
|
||||
alter table "public"."medusa_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))) not valid;
|
||||
|
||||
alter table "public"."medusa_products_analyses_relations" validate constraint "product_can_be_tied_to_only_one_analysis_item";
|
||||
|
||||
alter table "public"."medusa_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"."medusa_products_analyses_relations" validate constraint "product_can_be_tied_to_only_one_external_item";
|
||||
|
||||
alter table "public"."medusa_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"."medusa_products_external_services_relations" validate constraint "medreport_products_connected_online_services_id_fkey";
|
||||
|
||||
alter table "public"."medusa_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"."medusa_products_external_services_relations" add constraint "medreport_products_connected_online_services_product_id_fkey" FOREIGN KEY (medusa_product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
|
||||
|
||||
alter table "public"."medusa_products_external_services_relations" validate constraint "medreport_products_connected_online_services_product_id_fkey";
|
||||
|
||||
alter table "public"."medusa_products_external_services_relations" add constraint "medusa_products_external_services_relations_product_id_key" UNIQUE using index "medusa_products_external_services_relations_product_id_key";
|
||||
|
||||
grant delete on table "public"."medusa_products_analyses_relations" to "service_role";
|
||||
|
||||
grant insert on table "public"."medusa_products_analyses_relations" to "service_role";
|
||||
|
||||
grant references on table "public"."medusa_products_analyses_relations" to "service_role";
|
||||
|
||||
grant select on table "public"."medusa_products_analyses_relations" to "service_role";
|
||||
|
||||
grant trigger on table "public"."medusa_products_analyses_relations" to "service_role";
|
||||
|
||||
grant truncate on table "public"."medusa_products_analyses_relations" to "service_role";
|
||||
|
||||
grant update on table "public"."medusa_products_analyses_relations" to "service_role";
|
||||
|
||||
grant delete on table "public"."medusa_products_external_services_relations" to "service_role";
|
||||
|
||||
grant insert on table "public"."medusa_products_external_services_relations" to "service_role";
|
||||
|
||||
grant references on table "public"."medusa_products_external_services_relations" to "service_role";
|
||||
|
||||
grant select on table "public"."medusa_products_external_services_relations" to "service_role";
|
||||
|
||||
grant trigger on table "public"."medusa_products_external_services_relations" to "service_role";
|
||||
|
||||
grant truncate on table "public"."medusa_products_external_services_relations" to "service_role";
|
||||
|
||||
grant update on table "public"."medusa_products_external_services_relations" to "service_role";
|
||||
|
||||
CREATE TRIGGER check_not_already_tied_to_connected_online BEFORE INSERT OR UPDATE ON public.medusa_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.medusa_products_external_services_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_analysis_item();
|
||||
|
||||
revoke delete on table "public"."medreport_products" from "anon";
|
||||
|
||||
revoke insert on table "public"."medreport_products" from "anon";
|
||||
|
||||
revoke references on table "public"."medreport_products" from "anon";
|
||||
|
||||
revoke select on table "public"."medreport_products" from "anon";
|
||||
|
||||
revoke trigger on table "public"."medreport_products" from "anon";
|
||||
|
||||
revoke truncate on table "public"."medreport_products" from "anon";
|
||||
|
||||
revoke update on table "public"."medreport_products" from "anon";
|
||||
|
||||
revoke delete on table "public"."medreport_products" from "authenticated";
|
||||
|
||||
revoke insert on table "public"."medreport_products" from "authenticated";
|
||||
|
||||
revoke references on table "public"."medreport_products" from "authenticated";
|
||||
|
||||
revoke select on table "public"."medreport_products" from "authenticated";
|
||||
|
||||
revoke trigger on table "public"."medreport_products" from "authenticated";
|
||||
|
||||
revoke truncate on table "public"."medreport_products" from "authenticated";
|
||||
|
||||
revoke update on table "public"."medreport_products" from "authenticated";
|
||||
|
||||
revoke delete on table "public"."medreport_products" from "service_role";
|
||||
|
||||
revoke insert on table "public"."medreport_products" from "service_role";
|
||||
|
||||
revoke references on table "public"."medreport_products" from "service_role";
|
||||
|
||||
revoke select on table "public"."medreport_products" from "service_role";
|
||||
|
||||
revoke trigger on table "public"."medreport_products" from "service_role";
|
||||
|
||||
revoke truncate on table "public"."medreport_products" from "service_role";
|
||||
|
||||
revoke update on table "public"."medreport_products" from "service_role";
|
||||
|
||||
alter table "public"."medreport_products" drop constraint "medreport_products_name_key";
|
||||
|
||||
alter table "public"."medusa_products_analyses_relations" drop constraint "medreport_products_analyses_product_id_fkey";
|
||||
|
||||
alter table "public"."medusa_products_external_services_relations" drop constraint "medreport_products_connected_online_services_product_id_fkey";
|
||||
|
||||
alter table "public"."medreport_products" drop constraint "medreport_products_pkey";
|
||||
|
||||
drop index if exists "public"."medreport_products_name_key";
|
||||
|
||||
drop index if exists "public"."medreport_products_pkey";
|
||||
|
||||
drop table "public"."medreport_products";
|
||||
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
alter table "public"."accounts_memberships" add column "has_seen_confirmation" boolean not null default false;
|
||||
alter table "medreport"."accounts_memberships" add column "has_seen_confirmation" boolean not null default false;
|
||||
|
||||
set check_function_bodies = off;
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.has_unseen_membership_confirmation(p_user_id uuid DEFAULT auth.uid())
|
||||
CREATE OR REPLACE FUNCTION medreport.has_unseen_membership_confirmation(p_user_id uuid DEFAULT auth.uid())
|
||||
RETURNS boolean
|
||||
LANGUAGE sql
|
||||
SECURITY DEFINER
|
||||
SET search_path TO 'public', 'extensions'
|
||||
SET search_path TO 'medreport', 'extensions'
|
||||
AS $function$
|
||||
select exists (
|
||||
select 1
|
||||
from public.accounts_memberships am
|
||||
from medreport.accounts_memberships am
|
||||
where am.user_id = p_user_id
|
||||
and am.has_seen_confirmation = false
|
||||
);
|
||||
$function$
|
||||
;
|
||||
|
||||
grant execute on function public.has_unseen_membership_confirmation(uuid)
|
||||
grant execute on function medreport.has_unseen_membership_confirmation(uuid)
|
||||
to authenticated, anon;
|
||||
|
||||
drop function if exists "public"."has_personal_code"(account_id uuid);
|
||||
drop function if exists "medreport"."has_personal_code"(account_id uuid);
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.has_consent_personal_data(account_id uuid)
|
||||
CREATE OR REPLACE FUNCTION medreport.has_consent_personal_data(account_id uuid)
|
||||
RETURNS boolean
|
||||
LANGUAGE plpgsql
|
||||
SECURITY DEFINER
|
||||
@@ -30,12 +30,12 @@ CREATE OR REPLACE FUNCTION public.has_consent_personal_data(account_id uuid)
|
||||
AS $function$BEGIN
|
||||
RETURN EXISTS (
|
||||
SELECT 1
|
||||
FROM public.accounts
|
||||
FROM medreport.accounts
|
||||
WHERE id = account_id
|
||||
AND has_consent_personal_data IS TRUE
|
||||
);
|
||||
END;$function$
|
||||
;
|
||||
|
||||
grant execute on function public.has_consent_personal_data(uuid)
|
||||
grant execute on function medreport.has_consent_personal_data(uuid)
|
||||
to authenticated, anon;
|
||||
|
||||
Reference in New Issue
Block a user