update admin get websites with includeAllTeams
This commit is contained in:
@@ -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: {
|
||||||
|
|||||||
Reference in New Issue
Block a user