mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-13 08:48:38 +01:00
fix admin panel + payment ok page
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { ProjectModel, TProject } from "@schema/project/ProjectSchema";
|
||||
import { TProjectLimit } from "~/shared/schema/project/ProjectsLimits";
|
||||
import { TPremium } from "~/shared/schema/PremiumSchema";
|
||||
import { TUser } from "~/shared/schema/UserSchema";
|
||||
|
||||
|
||||
type ExtendedProject = {
|
||||
limits: TProjectLimit[],
|
||||
user: [TUser],
|
||||
premium: [TPremium],
|
||||
counts: [{
|
||||
events: number,
|
||||
visits: number,
|
||||
@@ -54,14 +57,14 @@ export default defineEventHandler(async event => {
|
||||
const count = await ProjectModel.countDocuments(matchQuery);
|
||||
|
||||
const projects = await ProjectModel.aggregate([
|
||||
{
|
||||
{
|
||||
$match: matchQuery
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: "project_limits",
|
||||
localField: "_id",
|
||||
foreignField: "project_id",
|
||||
from: "user_limits",
|
||||
localField: "owner",
|
||||
foreignField: "user_id",
|
||||
as: "limits"
|
||||
}
|
||||
},
|
||||
@@ -73,6 +76,22 @@ export default defineEventHandler(async event => {
|
||||
as: "counts"
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: "users",
|
||||
localField: "owner",
|
||||
foreignField: "_id",
|
||||
as: "user"
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: "premiums",
|
||||
localField: "owner",
|
||||
foreignField: "user_id",
|
||||
as: "premium"
|
||||
}
|
||||
},
|
||||
{
|
||||
$addFields: addFieldsFromArray([
|
||||
{ arrayName: 'counts', fieldName: 'visits', projectedName: 'visits' },
|
||||
|
||||
Reference in New Issue
Block a user