feat(MED-123): log order analysis page view

This commit is contained in:
Karli
2025-08-18 14:11:27 +03:00
parent abf455117d
commit 2f732b254f
2 changed files with 13 additions and 0 deletions

View File

@@ -5,6 +5,8 @@ import { Trans } from '@kit/ui/trans';
import { HomeLayoutPageHeader } from '../../_components/home-page-header';
import { loadAnalyses } from '../../_lib/server/load-analyses';
import OrderAnalysesCards from '../../_components/order-analyses-cards';
import { createPageViewLog, PAGE_VIEW_ACTION } from '~/lib/services/audit/pageView.service';
import { loadCurrentUserAccount } from '../../_lib/server/load-user-account';
export const generateMetadata = async () => {
const { t } = await createI18nServerInstance();
@@ -15,8 +17,18 @@ export const generateMetadata = async () => {
};
async function OrderAnalysisPage() {
const account = await loadCurrentUserAccount();
if (!account) {
throw new Error('Account not found');
}
const { analyses, countryCode } = await loadAnalyses();
await createPageViewLog({
accountId: account.id,
action: PAGE_VIEW_ACTION.VIEW_ORDER_ANALYSIS,
});
return (
<>
<HomeLayoutPageHeader

View File

@@ -3,6 +3,7 @@ import { getSupabaseServerClient } from '@kit/supabase/server-client';
export enum PAGE_VIEW_ACTION {
VIEW_ANALYSIS_RESULTS = 'VIEW_ANALYSIS_RESULTS',
REGISTRATION_SUCCESS = 'REGISTRATION_SUCCESS',
VIEW_ORDER_ANALYSIS = 'VIEW_ORDER_ANALYSIS',
}
export const createPageViewLog = async ({