Revert "feat(MED-131): check permissions for 'audit' schema"

This reverts commit ff3335d331.
This commit is contained in:
2025-08-04 17:16:09 +03:00
parent ff3335d331
commit 9854a65484

View File

@@ -2,7 +2,7 @@
import { z } from 'zod';
import { loadCurrentUserAccount } from '@/app/home/(user)/_lib/server/load-user-account';
import { getSupabaseServerAdminClient } from '@kit/supabase/server-admin-client';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { addToCart, deleteLineItem, retrieveCart } from '@lib/data/cart';
import { StoreCartLineItem, StoreProductVariant } from '@medusajs/types';
import { MontonioOrderHandlerService } from '@/packages/billing/montonio/src';
@@ -36,6 +36,7 @@ export async function handleAddToCart({
selectedVariant: StoreProductVariant
countryCode: string
}) {
const supabase = getSupabaseServerClient();
const user = await requireUserInServerComponent();
const account = await loadCurrentUserAccount()
if (!account) {
@@ -49,7 +50,7 @@ export async function handleAddToCart({
countryCode,
});
const { error } = await getSupabaseServerAdminClient()
const { error } = await supabase
.schema('audit')
.from('cart_entries')
.insert({
@@ -67,6 +68,7 @@ export async function handleAddToCart({
}
export async function handleNavigateToPayment({ language, paymentSessionId }: { language: string, paymentSessionId: string }) {
const supabase = getSupabaseServerClient();
const user = await requireUserInServerComponent();
const account = await loadCurrentUserAccount()
if (!account) {
@@ -88,7 +90,7 @@ export async function handleNavigateToPayment({ language, paymentSessionId }: {
merchantReference: `${account.id}:${paymentSessionId}:${cart.id}`,
});
const { error } = await getSupabaseServerAdminClient()
const { error } = await supabase
.schema('audit')
.from('cart_entries')
.insert({
@@ -109,6 +111,7 @@ export async function handleLineItemTimeout({
}: {
lineItem: StoreCartLineItem
}) {
const supabase = getSupabaseServerClient();
const user = await requireUserInServerComponent();
const account = await loadCurrentUserAccount()
if (!account) {
@@ -117,7 +120,7 @@ export async function handleLineItemTimeout({
await deleteLineItem(lineItem.id);
const { error } = await getSupabaseServerAdminClient()
const { error } = await supabase
.schema('audit')
.from('cart_entries')
.insert({