fix counts on project creation

This commit is contained in:
Emily
2024-06-06 03:46:25 +02:00
parent 31dc1b2fc9
commit a614937d5c
2 changed files with 7 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import { ProjectModel, TProject } from "@schema/ProjectSchema";
import { ProjectCountModel } from "@schema/ProjectsCounts";
import StripeService from '~/server/services/StripeService';
export default defineEventHandler(async event => {
@@ -32,6 +33,11 @@ export default defineEventHandler(async event => {
premium_expire_at: subscription.current_period_end * 1000
});
await ProjectCountModel.create({
project_id: project._id,
events: 0,
visits: 0
});
return project.toJSON() as TProject;