mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 12:35:38 +01:00
Add collect limits.
This commit is contained in:
parent
f42cab8d83
commit
e487da72c3
13 changed files with 217 additions and 61 deletions
|
|
@ -1,16 +1,45 @@
|
|||
import { Prisma, Website } from '@prisma/client';
|
||||
import { Prisma, Team, 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<Website> {
|
||||
export async function getWebsite(where: Prisma.WebsiteWhereUniqueInput): Promise<
|
||||
Website & {
|
||||
team?: Team;
|
||||
}
|
||||
> {
|
||||
return prisma.client.website.findUnique({
|
||||
where,
|
||||
include: {
|
||||
team: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function getWebsites(): Promise<Website[]> {
|
||||
export async function getWebsites(
|
||||
where: Prisma.WebsiteFindManyArgs,
|
||||
showDeleted = false,
|
||||
): Promise<Website[]> {
|
||||
return prisma.client.website.findMany({
|
||||
where: { ...where, deletedAt: showDeleted ? { not: null } : null },
|
||||
orderBy: {
|
||||
name: 'asc',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function getAllWebsitesByUser(userId): Promise<Website[]> {
|
||||
return prisma.client.website.findMany({
|
||||
where: {
|
||||
OR: [
|
||||
{ userId },
|
||||
{
|
||||
team: {
|
||||
userId,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
orderBy: {
|
||||
name: 'asc',
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue