fix dashboard premium tables

This commit is contained in:
Emily
2025-04-05 16:32:38 +02:00
parent 70c15238a0
commit 10d4a9f1bc
24 changed files with 341 additions and 370 deletions

View File

@@ -1,16 +1,18 @@
import StripeService from '~/server/services/StripeService';
import { PremiumModel } from '~/shared/schema/PremiumSchema';
export default defineEventHandler(async event => {
const data = await getRequestData(event, []);
if (!data) return;
const { project } = data;
const premium = await PremiumModel.findOne({ user_id: data.user.id })
if (!premium) return;
const customer = await StripeService.getCustomer(project.customer_id);
const customer = await StripeService.getCustomer(premium.customer_id);
if (customer?.deleted) return;
return customer?.address;
});