Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

update getAllwebsites, match usage query with api / cloud call

Francis Caoe701d6976b4c
diff --git a/src/pages/api/users/[userId]/usage.ts b/src/pages/api/users/[userId]/usage.ts
index 9d2bc37ea..90cfb9ee7 100644
--- a/src/pages/api/users/[userId]/usage.ts
+++ b/src/pages/api/users/[userId]/usage.ts
@@ -7,8 +7,7 @@ import * as yup from 'yup';
export interface UserUsageRequestQuery {
id: string;
- startAt: string;
- endAt: string;
+ params: { startAt: string; endAt: string };
}
export interface UserUsageRequestResponse {
diff --git a/src/queries/admin/website.ts b/src/queries/admin/website.ts
index 37dd5f482..a3bcac7b8 100644
--- a/src/queries/admin/website.ts
+++ b/src/queries/admin/website.ts
@@ -48,7 +48,19 @@ export async function getWebsites(
export async function getAllWebsites(userId: string) {
return prisma.client.website.findMany({
where: {
- userId,
+ OR: [
+ { userId },
+ {
+ team: {
+ deletedAt: null,
+ teamUser: {
+ some: {
+ userId,
+ },
+ },
+ },
+ },
+ ],
},
});
}