mirror of
https://github.com/umami-software/umami.git
synced 2026-02-17 02:55:38 +01:00
update admin get websites with includeAllTeams
This commit is contained in:
parent
1c8ae90457
commit
cfe2389b8e
1 changed files with 16 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ import * as yup from 'yup';
|
||||||
export interface WebsitesRequestQuery extends PageParams {
|
export interface WebsitesRequestQuery extends PageParams {
|
||||||
userId?: string;
|
userId?: string;
|
||||||
includeOwnedTeams?: boolean;
|
includeOwnedTeams?: boolean;
|
||||||
|
includeAllTeams?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WebsitesRequestBody {
|
export interface WebsitesRequestBody {
|
||||||
|
|
@ -43,7 +44,7 @@ export default async (
|
||||||
return unauthorized(res);
|
return unauthorized(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { userId, includeOwnedTeams } = req.query;
|
const { userId, includeOwnedTeams, includeAllTeams } = req.query;
|
||||||
|
|
||||||
const websites = await getWebsites(
|
const websites = await getWebsites(
|
||||||
{
|
{
|
||||||
|
|
@ -65,6 +66,20 @@ export default async (
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
|
...(userId && includeAllTeams
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
team: {
|
||||||
|
deletedAt: null,
|
||||||
|
teamUser: {
|
||||||
|
some: {
|
||||||
|
userId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue