MED-147: add doctor actions logging (#59)

* MED-147: add doctor actions logging

* enum casing
This commit is contained in:
Helena
2025-08-27 08:11:13 +03:00
committed by GitHub
parent f33f2b6db4
commit 8c6ce29c23
14 changed files with 236 additions and 14 deletions

View File

@@ -5,7 +5,7 @@ import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { withI18n } from '~/lib/i18n/with-i18n';
import {
PAGE_VIEW_ACTION,
PageViewAction,
createPageViewLog,
} from '~/lib/services/audit/pageView.service';
@@ -23,7 +23,7 @@ async function MembershipConfirmation() {
}
await createPageViewLog({
accountId: user.id,
action: PAGE_VIEW_ACTION.REGISTRATION_SUCCESS,
action: PageViewAction.REGISTRATION_SUCCESS,
});
return <MembershipConfirmationNotification userId={user.id} />;

View File

@@ -3,6 +3,11 @@ import { cache } from 'react';
import { getAnalysisResultsForDoctor } from '@kit/doctor/services/doctor-analysis.service';
import { PageBody, PageHeader } from '@kit/ui/page';
import {
DoctorPageViewAction,
createDoctorPageViewLog,
} from '~/lib/services/audit/doctorPageView.service';
import AnalysisView from '../../_components/analysis-view';
import { DoctorGuard } from '../../_components/doctor-guard';
@@ -20,6 +25,14 @@ async function AnalysisPage({
return null;
}
if (analysisResultDetails) {
await createDoctorPageViewLog({
action: DoctorPageViewAction.VIEW_ANALYSIS_RESULTS,
recordKey: id,
dataOwnerUserId: analysisResultDetails.patient.userId,
});
}
return (
<>
<PageHeader />

View File

@@ -1,10 +1,19 @@
import { getUserDoneResponsesAction } from '@kit/doctor/actions/table-data-fetching-actions';
import { PageBody, PageHeader } from '@kit/ui/page';
import { getUserDoneResponsesAction } from '@kit/doctor/actions/table-data-fetching-actions';
import ResultsTableWrapper from '../_components/results-table-wrapper';
import {
DoctorPageViewAction,
createDoctorPageViewLog,
} from '~/lib/services/audit/doctorPageView.service';
import { DoctorGuard } from '../_components/doctor-guard';
import ResultsTableWrapper from '../_components/results-table-wrapper';
async function CompletedJobsPage() {
await createDoctorPageViewLog({
action: DoctorPageViewAction.VIEW_DONE_JOBS,
});
return (
<>
<PageHeader />

View File

@@ -1,9 +1,19 @@
import { getUserInProgressResponsesAction } from '@kit/doctor/actions/table-data-fetching-actions';
import { PageBody, PageHeader } from '@kit/ui/page';
import ResultsTableWrapper from '../_components/results-table-wrapper';
import {
DoctorPageViewAction,
createDoctorPageViewLog,
} from '~/lib/services/audit/doctorPageView.service';
import { DoctorGuard } from '../_components/doctor-guard';
import ResultsTableWrapper from '../_components/results-table-wrapper';
async function MyReviewsPage() {
await createDoctorPageViewLog({
action: DoctorPageViewAction.VIEW_OWN_JOBS,
});
return (
<>
<PageHeader />

View File

@@ -1,10 +1,19 @@
import { getOpenResponsesAction } from '@kit/doctor/actions/table-data-fetching-actions';
import { PageBody, PageHeader } from '@kit/ui/page';
import {
DoctorPageViewAction,
createDoctorPageViewLog,
} from '~/lib/services/audit/doctorPageView.service';
import { DoctorGuard } from '../_components/doctor-guard';
import ResultsTableWrapper from '../_components/results-table-wrapper';
async function OpenJobsPage() {
await createDoctorPageViewLog({
action: DoctorPageViewAction.VIEW_OPEN_JOBS,
});
return (
<>
<PageHeader />

View File

@@ -1,8 +1,18 @@
import { PageBody, PageHeader } from '@kit/ui/page';
import {
DoctorPageViewAction,
createDoctorPageViewLog,
} from '~/lib/services/audit/doctorPageView.service';
import Dashboard from './_components/doctor-dashboard';
import { DoctorGuard } from './_components/doctor-guard';
async function DoctorPage() {
await createDoctorPageViewLog({
action: DoctorPageViewAction.VIEW_DASHBOARD,
});
return (
<>
<PageHeader />

View File

@@ -13,7 +13,7 @@ import { pathsConfig } from '@kit/shared/config';
import { getAnalysisElements } from '~/lib/services/analysis-element.service';
import {
PAGE_VIEW_ACTION,
PageViewAction,
createPageViewLog,
} from '~/lib/services/audit/pageView.service';
import { AnalysisOrder, getAnalysisOrders } from '~/lib/services/order.service';
@@ -50,7 +50,7 @@ async function AnalysisResultsPage() {
await createPageViewLog({
accountId: account.id,
action: PAGE_VIEW_ACTION.VIEW_ANALYSIS_RESULTS,
action: PageViewAction.VIEW_ANALYSIS_RESULTS,
});
const getAnalysisElementIds = (analysisOrders: AnalysisOrder[]) => [

View File

@@ -6,7 +6,7 @@ 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 { createPageViewLog, PageViewAction } from '~/lib/services/audit/pageView.service';
import { loadCurrentUserAccount } from '../../_lib/server/load-user-account';
export const generateMetadata = async () => {
@@ -27,7 +27,7 @@ async function OrderAnalysisPage() {
await createPageViewLog({
accountId: account.id,
action: PAGE_VIEW_ACTION.VIEW_ORDER_ANALYSIS,
action: PageViewAction.VIEW_ORDER_ANALYSIS,
});
return (

View File

@@ -12,7 +12,7 @@ import { PageBody } from '@kit/ui/page';
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
import { withI18n } from '~/lib/i18n/with-i18n';
import {
PAGE_VIEW_ACTION,
PageViewAction,
createPageViewLog,
} from '~/lib/services/audit/pageView.service';
@@ -46,7 +46,7 @@ function TeamAccountHomePage({ params }: TeamAccountHomePageProps) {
use(
createPageViewLog({
accountId: teamAccount.id,
action: PAGE_VIEW_ACTION.VIEW_TEAM_ACCOUNT_DASHBOARD,
action: PageViewAction.VIEW_TEAM_ACCOUNT_DASHBOARD,
}),
);