translations, remove random empty lines, refactor

This commit is contained in:
Helena
2025-09-19 17:28:45 +03:00
parent c50b75ce9b
commit 961f726520
11 changed files with 166 additions and 115 deletions

View File

@@ -0,0 +1,40 @@
import { getSupabaseServerClient } from '@kit/supabase/server-client';
export const createCartEntriesLog = async ({
operation,
accountId,
cartId,
variantId,
comment,
}: {
operation: string;
accountId: string;
cartId: string;
variantId?: string;
comment?: 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;
}
return supabase.schema('audit').from('cart_entries').insert({
operation,
account_id: accountId,
cart_id: cartId,
changed_by: user.id,
variant_id: variantId,
comment,
});
} catch (error) {
console.error('Failed to insert doctor page view log', error);
}
};