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

@@ -22,6 +22,7 @@ export const updateTeamAccountName = enhanceAction(
logger.info(ctx, `Updating team name...`);
const { error, data } = await client
.schema('medreport')
.from('accounts')
.update({
name,

View File

@@ -41,6 +41,7 @@ export const createInvitationsAction = enhanceAction(
);
const { data: company, error: companyError } = await client
.schema('medreport')
.from('accounts')
.select('id')
.eq('slug', accountSlug);

View File

@@ -79,9 +79,11 @@ export const transferOwnershipAction = enhanceAction(
logger.info(ctx, 'Processing team ownership transfer request...');
// assert that the user is the owner of the account
const { data: isOwner, error } = await client.rpc('is_account_owner', {
account_id: data.accountId,
});
const { data: isOwner, error } = await client
.schema('medreport')
.rpc('is_account_owner', {
account_id: data.accountId,
});
if (error || !isOwner) {
logger.error(ctx, 'User is not the owner of this account');