add medreport schema
This commit is contained in:
@@ -6,6 +6,7 @@ import { useRouter } from 'next/navigation';
|
||||
|
||||
import { MedReportLogo } from '@/components/med-report-logo';
|
||||
import { SubmitButton } from '@/components/ui/submit-button';
|
||||
import { withI18n } from '@/lib/i18n/with-i18n';
|
||||
import { sendCompanyOfferEmail } from '@/lib/services/mailer.service';
|
||||
import { CompanySubmitData } from '@/lib/types/company';
|
||||
import { companyOfferSchema } from '@/lib/validations/company-offer.schema';
|
||||
@@ -18,7 +19,7 @@ import { Input } from '@kit/ui/input';
|
||||
import { Label } from '@kit/ui/label';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
export default function CompanyOffer() {
|
||||
function CompanyOffer() {
|
||||
const router = useRouter();
|
||||
const {
|
||||
register,
|
||||
@@ -100,3 +101,5 @@ export default function CompanyOffer() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default withI18n(CompanyOffer);
|
||||
|
||||
@@ -34,6 +34,7 @@ async function accountLoader(id: string) {
|
||||
const client = getSupabaseServerClient();
|
||||
|
||||
const { data, error } = await client
|
||||
.schema('medreport')
|
||||
.from('accounts')
|
||||
.select('*, memberships: accounts_memberships (*)')
|
||||
.eq('id', id)
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import pathsConfig from '@/config/paths.config';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { usePersonalAccountData } from '@kit/accounts/hooks/use-personal-account-data';
|
||||
import { SuccessNotification } from '@kit/notifications/components';
|
||||
|
||||
const MembershipConfirmationNotification: React.FC<{
|
||||
userId: string;
|
||||
}> = ({ userId }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { data: accountData } = usePersonalAccountData(userId);
|
||||
|
||||
return (
|
||||
<SuccessNotification
|
||||
showLogo={false}
|
||||
title={t('account:membershipConfirmation:successTitle', {
|
||||
firstName: accountData?.name,
|
||||
lastName: accountData?.last_name,
|
||||
})}
|
||||
descriptionKey="account:membershipConfirmation:successDescription"
|
||||
buttonProps={{
|
||||
buttonTitleKey: 'account:membershipConfirmation:successButton',
|
||||
href: pathsConfig.app.selectPackage,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default MembershipConfirmationNotification;
|
||||
@@ -8,4 +8,4 @@ async function SiteLayout(props: React.PropsWithChildren) {
|
||||
);
|
||||
}
|
||||
|
||||
export default withI18n(SiteLayout);
|
||||
export default SiteLayout;
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
import pathsConfig from '@/config/paths.config';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { usePersonalAccountData } from '@kit/accounts/hooks/use-personal-account-data';
|
||||
import { SuccessNotification } from '@kit/notifications/components';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
import MembershipConfirmationNotification from './_components/membership-confirmation-notification';
|
||||
|
||||
async function UpdateAccountSuccess() {
|
||||
const { t } = useTranslation('account');
|
||||
const client = getSupabaseServerClient();
|
||||
|
||||
const {
|
||||
@@ -21,26 +19,7 @@ async function UpdateAccountSuccess() {
|
||||
redirect(pathsConfig.app.home);
|
||||
}
|
||||
|
||||
const { data: accountData } = usePersonalAccountData(user.id);
|
||||
|
||||
if (!accountData?.id) {
|
||||
redirect(pathsConfig.app.home);
|
||||
}
|
||||
|
||||
return (
|
||||
<SuccessNotification
|
||||
showLogo={false}
|
||||
title={t('account:membershipConfirmation:successTitle', {
|
||||
firstName: accountData?.name,
|
||||
lastName: accountData?.last_name,
|
||||
})}
|
||||
descriptionKey="account:membershipConfirmation:successDescription"
|
||||
buttonProps={{
|
||||
buttonTitleKey: 'account:membershipConfirmation:successButton',
|
||||
href: pathsConfig.app.selectPackage,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
return <MembershipConfirmationNotification userId={user.id} />;
|
||||
}
|
||||
|
||||
export default withI18n(UpdateAccountSuccess);
|
||||
|
||||
@@ -26,7 +26,7 @@ async function getSupabaseHealthCheck() {
|
||||
try {
|
||||
const client = getSupabaseServerAdminClient();
|
||||
|
||||
const { error } = await client.rpc('is_set', {
|
||||
const { error } = await client.schema('medreport').rpc('is_set', {
|
||||
field_name: 'billing_provider',
|
||||
});
|
||||
|
||||
|
||||
@@ -46,9 +46,11 @@ async function loadAccountMembers(
|
||||
client: SupabaseClient<Database>,
|
||||
account: string,
|
||||
) {
|
||||
const { data, error } = await client.rpc('get_account_members', {
|
||||
account_slug: account,
|
||||
});
|
||||
const { data, error } = await client
|
||||
.schema('medreport')
|
||||
.rpc('get_account_members', {
|
||||
account_slug: account,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error(error);
|
||||
@@ -67,9 +69,11 @@ async function loadInvitations(
|
||||
client: SupabaseClient<Database>,
|
||||
account: string,
|
||||
) {
|
||||
const { data, error } = await client.rpc('get_account_invitations', {
|
||||
account_slug: account,
|
||||
});
|
||||
const { data, error } = await client
|
||||
.schema('medreport')
|
||||
.rpc('get_account_invitations', {
|
||||
account_slug: account,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error(error);
|
||||
|
||||
@@ -79,12 +79,11 @@ async function JoinTeamAccountPage(props: JoinTeamAccountPageProps) {
|
||||
// we need to verify the user isn't already in the account
|
||||
// we do so by checking if the user can read the account
|
||||
// if the user can read the account, then they are already in the account
|
||||
const { data: isAlreadyTeamMember } = await client.rpc(
|
||||
'is_account_team_member',
|
||||
{
|
||||
const { data: isAlreadyTeamMember } = await client
|
||||
.schema('medreport')
|
||||
.rpc('is_account_team_member', {
|
||||
target_account_id: invitation.account.id,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
// if the user is already in the account redirect to the home page
|
||||
if (isAlreadyTeamMember) {
|
||||
|
||||
Reference in New Issue
Block a user