mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
update pricing data
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import { ProjectModel } from "@schema/project/ProjectSchema";
|
import { ProjectModel } from "@schema/project/ProjectSchema";
|
||||||
import { ProjectCountModel } from "@schema/project/ProjectsCounts";
|
import { ProjectCountModel } from "@schema/project/ProjectsCounts";
|
||||||
import { SessionModel } from "@schema/metrics/SessionSchema";
|
import { SessionModel } from "@schema/metrics/SessionSchema";
|
||||||
import { LimitNotifyModel } from "@schema/broker/LimitNotifySchema";
|
|
||||||
import { AiChatModel } from "@schema/ai/AiChatSchema";
|
import { AiChatModel } from "@schema/ai/AiChatSchema";
|
||||||
|
|
||||||
export default defineEventHandler(async event => {
|
export default defineEventHandler(async event => {
|
||||||
@@ -18,14 +17,12 @@ export default defineEventHandler(async event => {
|
|||||||
const projectDeletation = ProjectModel.deleteOne({ _id: project_id });
|
const projectDeletation = ProjectModel.deleteOne({ _id: project_id });
|
||||||
const countDeletation = ProjectCountModel.deleteMany({ project_id });
|
const countDeletation = ProjectCountModel.deleteMany({ project_id });
|
||||||
const sessionsDeletation = SessionModel.deleteMany({ project_id });
|
const sessionsDeletation = SessionModel.deleteMany({ project_id });
|
||||||
const notifiesDeletation = LimitNotifyModel.deleteMany({ project_id });
|
|
||||||
const aiChatsDeletation = AiChatModel.deleteMany({ project_id });
|
const aiChatsDeletation = AiChatModel.deleteMany({ project_id });
|
||||||
|
|
||||||
const results = await Promise.all([
|
const results = await Promise.all([
|
||||||
projectDeletation,
|
projectDeletation,
|
||||||
countDeletation,
|
countDeletation,
|
||||||
sessionsDeletation,
|
sessionsDeletation,
|
||||||
notifiesDeletation,
|
|
||||||
aiChatsDeletation
|
aiChatsDeletation
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ export default defineEventHandler(async event => {
|
|||||||
const passwordDeletation = await PasswordModel.deleteMany({ user_id: userData.id });
|
const passwordDeletation = await PasswordModel.deleteMany({ user_id: userData.id });
|
||||||
|
|
||||||
const limitdeletation = await UserLimitModel.deleteMany({ user_id: userData.id });
|
const limitdeletation = await UserLimitModel.deleteMany({ user_id: userData.id });
|
||||||
|
const notifiesDeletation = await LimitNotifyModel.deleteMany({ user_id: userData.id });
|
||||||
|
|
||||||
await StripeService.deleteCustomer(premium.customer_id);
|
await StripeService.deleteCustomer(premium.customer_id);
|
||||||
|
|
||||||
@@ -43,7 +44,6 @@ export default defineEventHandler(async event => {
|
|||||||
const userSettingsDeletation = await UserSettingsModel.deleteOne({ project_id });
|
const userSettingsDeletation = await UserSettingsModel.deleteOne({ project_id });
|
||||||
const countDeletation = await ProjectCountModel.deleteMany({ project_id });
|
const countDeletation = await ProjectCountModel.deleteMany({ project_id });
|
||||||
const sessionsDeletation = await SessionModel.deleteMany({ project_id });
|
const sessionsDeletation = await SessionModel.deleteMany({ project_id });
|
||||||
const notifiesDeletation = await LimitNotifyModel.deleteMany({ project_id });
|
|
||||||
const aiChatsDeletation = await AiChatModel.deleteMany({ project_id });
|
const aiChatsDeletation = await AiChatModel.deleteMany({ project_id });
|
||||||
|
|
||||||
//Shields
|
//Shields
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ export async function onPaymentSuccess(event: Event.InvoicePaidEvent) {
|
|||||||
|
|
||||||
const databaseSubscription = premiumData.subscription_id;
|
const databaseSubscription = premiumData.subscription_id;
|
||||||
|
|
||||||
|
const currentSubscriptionData = await StripeService.getSubscription(subscription_id);
|
||||||
|
if (!currentSubscriptionData || currentSubscriptionData.status !== 'active') return { error: 'subscription not active' }
|
||||||
|
|
||||||
if (databaseSubscription != subscription_id) {
|
if (databaseSubscription != subscription_id) {
|
||||||
try {
|
try {
|
||||||
await StripeService.deleteSubscription(databaseSubscription);
|
await StripeService.deleteSubscription(databaseSubscription);
|
||||||
|
|||||||
Reference in New Issue
Block a user