mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 09:05:36 +01:00
fix admin/website
This commit is contained in:
parent
b3bcfa5bd1
commit
36928d4f04
1 changed files with 14 additions and 13 deletions
|
|
@ -10,7 +10,7 @@ import * as yup from 'yup';
|
||||||
|
|
||||||
export interface WebsitesRequestQuery extends PageParams {
|
export interface WebsitesRequestQuery extends PageParams {
|
||||||
userId?: string;
|
userId?: string;
|
||||||
includeTeams?: boolean;
|
includeOwnedTeams?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WebsitesRequestBody {
|
export interface WebsitesRequestBody {
|
||||||
|
|
@ -43,27 +43,28 @@ export default async (
|
||||||
return unauthorized(res);
|
return unauthorized(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { userId, includeTeams } = req.query;
|
const { userId, includeOwnedTeams } = req.query;
|
||||||
|
|
||||||
const websites = await getWebsites(
|
const websites = await getWebsites(
|
||||||
{
|
{
|
||||||
where: {
|
where: {
|
||||||
OR: [
|
OR: [
|
||||||
...(userId && [{ userId }]),
|
...(userId && [{ userId }]),
|
||||||
...(userId &&
|
...(userId && includeOwnedTeams
|
||||||
includeTeams && [
|
? [
|
||||||
{
|
{
|
||||||
team: {
|
team: {
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
teamUser: {
|
teamUser: {
|
||||||
some: {
|
some: {
|
||||||
role: ROLES.teamOwner,
|
role: ROLES.teamOwner,
|
||||||
userId,
|
userId,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
]
|
||||||
]),
|
: []),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue