add medreport schema

This commit is contained in:
Danel Kungla
2025-07-09 13:31:37 +03:00
parent 9371ff7710
commit d9198a8a12
73 changed files with 420 additions and 270 deletions

View File

@@ -37,6 +37,7 @@ class AccountMembersService {
logger.info(ctx, `Removing member from account...`);
const { data, error } = await this.client
.schema('medreport')
.from('accounts_memberships')
.delete()
.match({
@@ -88,7 +89,7 @@ class AccountMembersService {
logger.info(ctx, `Validating permissions to update member role...`);
const { data: canActionAccountMember, error: accountError } =
await this.client.rpc('can_action_account_member', {
await this.client.schema('medreport').rpc('can_action_account_member', {
target_user_id: params.userId,
target_team_account_id: params.accountId,
});
@@ -112,6 +113,7 @@ class AccountMembersService {
// for updating accounts_memberships. Instead, we use the can_action_account_member
// RPC to validate permissions to update the role
const { data, error } = await adminClient
.schema('medreport')
.from('accounts_memberships')
.update({
account_role: params.role,
@@ -157,13 +159,12 @@ class AccountMembersService {
logger.info(ctx, `Transferring ownership of account...`);
const { data, error } = await adminClient.rpc(
'transfer_team_account_ownership',
{
const { data, error } = await adminClient
.schema('medreport')
.rpc('transfer_team_account_ownership', {
target_account_id: params.accountId,
new_owner_id: params.userId,
},
);
});
if (error) {
logger.error(