update getAllwebsites, match usage query with api / cloud call

This commit is contained in:
Francis Cao 2024-05-14 09:39:04 -07:00
parent 8fc755df99
commit e701d6976b
2 changed files with 14 additions and 3 deletions

View File

@ -7,8 +7,7 @@ import * as yup from 'yup';
export interface UserUsageRequestQuery { export interface UserUsageRequestQuery {
id: string; id: string;
startAt: string; params: { startAt: string; endAt: string };
endAt: string;
} }
export interface UserUsageRequestResponse { export interface UserUsageRequestResponse {

View File

@ -48,7 +48,19 @@ export async function getWebsites(
export async function getAllWebsites(userId: string) { export async function getAllWebsites(userId: string) {
return prisma.client.website.findMany({ return prisma.client.website.findMany({
where: { where: {
userId, OR: [
{ userId },
{
team: {
deletedAt: null,
teamUser: {
some: {
userId,
},
},
},
},
],
}, },
}); });
} }