Merge branch 'main' into MED-85

This commit is contained in:
2025-08-27 08:31:26 +03:00
55 changed files with 1356 additions and 547 deletions

View File

@@ -0,0 +1,46 @@
import { getSupabaseServerClient } from '@kit/supabase/server-client';
export enum DoctorPageViewAction {
VIEW_ANALYSIS_RESULTS = 'VIEW_ANALYSIS_RESULTS',
VIEW_DASHBOARD = 'VIEW_DASHBOARD',
VIEW_OPEN_JOBS = 'VIEW_OPEN_JOBS',
VIEW_OWN_JOBS = 'VIEW_OWN_JOBS',
VIEW_DONE_JOBS = 'VIEW_DONE_JOBS',
}
export const createDoctorPageViewLog = async ({
action,
recordKey,
dataOwnerUserId,
}: {
action: DoctorPageViewAction;
recordKey?: string;
dataOwnerUserId?: string;
}) => {
try {
const supabase = getSupabaseServerClient();
const {
data: { user },
error: userError,
} = await supabase.auth.getUser();
if (userError || !user) {
console.error('No authenticated user found; skipping audit insert');
return;
}
await supabase
.schema('audit')
.from('doctor_page_views')
.insert({
viewer_user_id: user.id,
data_owner_user_id: dataOwnerUserId,
viewed_record_key: recordKey,
action,
})
.throwOnError();
} catch (error) {
console.error('Failed to insert doctor page view log', error);
}
};

View File

@@ -1,9 +1,10 @@
import { getSupabaseServerClient } from '@kit/supabase/server-client';
export enum PAGE_VIEW_ACTION {
export enum PageViewAction {
VIEW_ANALYSIS_RESULTS = 'VIEW_ANALYSIS_RESULTS',
REGISTRATION_SUCCESS = 'REGISTRATION_SUCCESS',
VIEW_ORDER_ANALYSIS = 'VIEW_ORDER_ANALYSIS',
VIEW_TEAM_ACCOUNT_DASHBOARD = 'VIEW_TEAM_ACCOUNT_DASHBOARD',
}
export const createPageViewLog = async ({
@@ -11,7 +12,7 @@ export const createPageViewLog = async ({
action,
}: {
accountId: string;
action: PAGE_VIEW_ACTION;
action: PageViewAction;
}) => {
try {
const supabase = getSupabaseServerClient();

View File

@@ -673,6 +673,7 @@ async function syncPrivateMessage({
unit: element.Mootyhik ?? null,
original_response_element: element,
analysis_name: element.UuringNimi || element.KNimetus,
comment: element.UuringuKommentaar
})),
);
}