mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 12:35:38 +01:00
Split logic for findSession.
This commit is contained in:
parent
e487da72c3
commit
f2fa514a31
5 changed files with 161 additions and 130 deletions
|
|
@ -1,18 +1,29 @@
|
|||
import { Prisma, Team, Website } from '@prisma/client';
|
||||
import { Prisma, Team, TeamUser, Website } from '@prisma/client';
|
||||
import cache from 'lib/cache';
|
||||
import prisma from 'lib/prisma';
|
||||
import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
|
||||
export async function getWebsite(where: Prisma.WebsiteWhereUniqueInput): Promise<
|
||||
export async function getWebsite(
|
||||
where: Prisma.WebsiteWhereUniqueInput,
|
||||
includeTeamData = false,
|
||||
): Promise<
|
||||
Website & {
|
||||
team?: Team;
|
||||
team?: Team & { teamUsers: TeamUser[] };
|
||||
}
|
||||
> {
|
||||
prisma.client.team.findMany();
|
||||
|
||||
return prisma.client.website.findUnique({
|
||||
where,
|
||||
include: {
|
||||
team: true,
|
||||
},
|
||||
include: includeTeamData
|
||||
? {
|
||||
team: {
|
||||
include: {
|
||||
teamUsers: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
: {},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue