diff --git a/src/app/(main)/links/[linkId]/page.tsx b/src/app/(main)/links/[linkId]/page.tsx
index 3a5f5d7e..4317ada2 100644
--- a/src/app/(main)/links/[linkId]/page.tsx
+++ b/src/app/(main)/links/[linkId]/page.tsx
@@ -1,14 +1,8 @@
import type { Metadata } from 'next';
-import { getLink } from '@/queries/prisma';
import { LinkPage } from './LinkPage';
export default async function ({ params }: { params: Promise<{ linkId: string }> }) {
const { linkId } = await params;
- const link = await getLink(linkId);
-
- if (!link || link?.deletedAt) {
- return null;
- }
return ;
}
diff --git a/src/app/(main)/pixels/[pixelId]/page.tsx b/src/app/(main)/pixels/[pixelId]/page.tsx
index e174c195..d1db92f3 100644
--- a/src/app/(main)/pixels/[pixelId]/page.tsx
+++ b/src/app/(main)/pixels/[pixelId]/page.tsx
@@ -1,14 +1,8 @@
import type { Metadata } from 'next';
-import { getPixel } from '@/queries/prisma';
import { PixelPage } from './PixelPage';
export default async function ({ params }: { params: { pixelId: string } }) {
const { pixelId } = await params;
- const pixel = await getPixel(pixelId);
-
- if (!pixel || pixel?.deletedAt) {
- return null;
- }
return ;
}
diff --git a/src/app/(main)/websites/[websiteId]/layout.tsx b/src/app/(main)/websites/[websiteId]/layout.tsx
index b12ff950..67595e9d 100644
--- a/src/app/(main)/websites/[websiteId]/layout.tsx
+++ b/src/app/(main)/websites/[websiteId]/layout.tsx
@@ -1,6 +1,5 @@
import type { Metadata } from 'next';
import { WebsiteLayout } from '@/app/(main)/websites/[websiteId]/WebsiteLayout';
-import { getWebsite } from '@/queries/prisma';
export default async function ({
children,
@@ -10,11 +9,6 @@ export default async function ({
params: Promise<{ websiteId: string }>;
}) {
const { websiteId } = await params;
- const website = await getWebsite(websiteId);
-
- if (!website || website?.deletedAt) {
- return null;
- }
return {children};
}
diff --git a/src/lib/prisma.ts b/src/lib/prisma.ts
index bfd007d1..64cb870f 100644
--- a/src/lib/prisma.ts
+++ b/src/lib/prisma.ts
@@ -74,21 +74,15 @@ function getSearchSQL(column: string, param: string = 'search'): string {
function mapFilter(column: string, operator: string, name: string, type: string = '') {
const value = `{{${name}${type ? `::${type}` : ''}}}`;
- if (name.startsWith('cohort_')) {
- name = name.slice('cohort_'.length);
- }
-
- const table = SESSION_COLUMNS.includes(name) ? 'session' : 'website_event';
-
switch (operator) {
case OPERATORS.equals:
- return `${table}.${column} = ${value}`;
+ return `${column} = ${value}`;
case OPERATORS.notEquals:
- return `${table}.${column} != ${value}`;
+ return `${column} != ${value}`;
case OPERATORS.contains:
- return `${table}.${column} ilike ${value}`;
+ return `${column} ilike ${value}`;
case OPERATORS.doesNotContain:
- return `${table}.${column} not ilike ${value}`;
+ return `${column} not ilike ${value}`;
default:
return '';
}
diff --git a/src/lib/request.ts b/src/lib/request.ts
index d6543b18..e6450bf3 100644
--- a/src/lib/request.ts
+++ b/src/lib/request.ts
@@ -85,7 +85,7 @@ export async function setWebsiteDate(websiteId: string, userId: string, data: Re
const website = await fetchWebsite(websiteId);
const cloudMode = !!process.env.CLOUD_MODE;
- if (cloudMode && website && !website.teamId) {
+ if (cloudMode && !website.teamId) {
const account = await fetchAccount(userId);
if (!account?.hasSubscription) {
diff --git a/src/queries/sql/reports/getRevenue.ts b/src/queries/sql/reports/getRevenue.ts
index 2a4604fe..19b75d42 100644
--- a/src/queries/sql/reports/getRevenue.ts
+++ b/src/queries/sql/reports/getRevenue.ts
@@ -41,15 +41,14 @@ async function relationalQuery(
currency,
});
- const joinQuery =
- filterQuery || cohortQuery
- ? `join website_event
+ const joinQuery = filterQuery
+ ? `join website_event
on website_event.website_id = revenue.website_id
and website_event.session_id = revenue.session_id
and website_event.event_id = revenue.event_id
and website_event.website_id = {{websiteId::uuid}}
and website_event.created_at between {{startDate}} and {{endDate}}`
- : '';
+ : '';
const chart = await rawQuery(
`