Revert "feat(MED-131): check permissions for 'audit' schema"
This reverts commit ff3335d331.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { loadCurrentUserAccount } from '@/app/home/(user)/_lib/server/load-user-account';
|
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 { addToCart, deleteLineItem, retrieveCart } from '@lib/data/cart';
|
||||||
import { StoreCartLineItem, StoreProductVariant } from '@medusajs/types';
|
import { StoreCartLineItem, StoreProductVariant } from '@medusajs/types';
|
||||||
import { MontonioOrderHandlerService } from '@/packages/billing/montonio/src';
|
import { MontonioOrderHandlerService } from '@/packages/billing/montonio/src';
|
||||||
@@ -36,6 +36,7 @@ export async function handleAddToCart({
|
|||||||
selectedVariant: StoreProductVariant
|
selectedVariant: StoreProductVariant
|
||||||
countryCode: string
|
countryCode: string
|
||||||
}) {
|
}) {
|
||||||
|
const supabase = getSupabaseServerClient();
|
||||||
const user = await requireUserInServerComponent();
|
const user = await requireUserInServerComponent();
|
||||||
const account = await loadCurrentUserAccount()
|
const account = await loadCurrentUserAccount()
|
||||||
if (!account) {
|
if (!account) {
|
||||||
@@ -49,7 +50,7 @@ export async function handleAddToCart({
|
|||||||
countryCode,
|
countryCode,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { error } = await getSupabaseServerAdminClient()
|
const { error } = await supabase
|
||||||
.schema('audit')
|
.schema('audit')
|
||||||
.from('cart_entries')
|
.from('cart_entries')
|
||||||
.insert({
|
.insert({
|
||||||
@@ -67,6 +68,7 @@ export async function handleAddToCart({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function handleNavigateToPayment({ language, paymentSessionId }: { language: string, paymentSessionId: string }) {
|
export async function handleNavigateToPayment({ language, paymentSessionId }: { language: string, paymentSessionId: string }) {
|
||||||
|
const supabase = getSupabaseServerClient();
|
||||||
const user = await requireUserInServerComponent();
|
const user = await requireUserInServerComponent();
|
||||||
const account = await loadCurrentUserAccount()
|
const account = await loadCurrentUserAccount()
|
||||||
if (!account) {
|
if (!account) {
|
||||||
@@ -88,7 +90,7 @@ export async function handleNavigateToPayment({ language, paymentSessionId }: {
|
|||||||
merchantReference: `${account.id}:${paymentSessionId}:${cart.id}`,
|
merchantReference: `${account.id}:${paymentSessionId}:${cart.id}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { error } = await getSupabaseServerAdminClient()
|
const { error } = await supabase
|
||||||
.schema('audit')
|
.schema('audit')
|
||||||
.from('cart_entries')
|
.from('cart_entries')
|
||||||
.insert({
|
.insert({
|
||||||
@@ -109,6 +111,7 @@ export async function handleLineItemTimeout({
|
|||||||
}: {
|
}: {
|
||||||
lineItem: StoreCartLineItem
|
lineItem: StoreCartLineItem
|
||||||
}) {
|
}) {
|
||||||
|
const supabase = getSupabaseServerClient();
|
||||||
const user = await requireUserInServerComponent();
|
const user = await requireUserInServerComponent();
|
||||||
const account = await loadCurrentUserAccount()
|
const account = await loadCurrentUserAccount()
|
||||||
if (!account) {
|
if (!account) {
|
||||||
@@ -117,7 +120,7 @@ export async function handleLineItemTimeout({
|
|||||||
|
|
||||||
await deleteLineItem(lineItem.id);
|
await deleteLineItem(lineItem.id);
|
||||||
|
|
||||||
const { error } = await getSupabaseServerAdminClient()
|
const { error } = await supabase
|
||||||
.schema('audit')
|
.schema('audit')
|
||||||
.from('cart_entries')
|
.from('cart_entries')
|
||||||
.insert({
|
.insert({
|
||||||
|
|||||||
Reference in New Issue
Block a user