mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
Fix usage.
This commit is contained in:
parent
98a0a83ccf
commit
25dd94b551
2 changed files with 24 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ import redis from '@umami/redis-client';
|
|||
import prisma from 'lib/prisma';
|
||||
import { PageResult, PageParams } from 'lib/types';
|
||||
import WebsiteFindManyArgs = Prisma.WebsiteFindManyArgs;
|
||||
import { ROLES } from 'lib/constants';
|
||||
|
||||
async function findWebsite(criteria: Prisma.WebsiteFindUniqueArgs): Promise<Website> {
|
||||
return prisma.client.website.findUnique(criteria);
|
||||
|
|
@ -52,6 +53,27 @@ export async function getAllWebsites(userId: string) {
|
|||
});
|
||||
}
|
||||
|
||||
export async function getAllUserWebsitesIncludingTeamOwner(userId: string) {
|
||||
return prisma.client.website.findMany({
|
||||
where: {
|
||||
OR: [
|
||||
{ userId },
|
||||
{
|
||||
team: {
|
||||
deletedAt: null,
|
||||
teamUser: {
|
||||
some: {
|
||||
role: ROLES.teamOwner,
|
||||
userId,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function getUserWebsites(
|
||||
userId: string,
|
||||
filters?: PageParams,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue