Compare commits

..

No commits in common. "912d2d544dac632cf08064a08deb46ac9a07bcd4" and "86d2672c47fe74f38ff71a62e8540c1bc5ffb7d1" have entirely different histories.

6 changed files with 8 additions and 33 deletions

View file

@ -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 <LinkPage linkId={linkId} />;
}

View file

@ -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 <PixelPage pixelId={pixelId} />;
}

View file

@ -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 <WebsiteLayout websiteId={websiteId}>{children}</WebsiteLayout>;
}

View file

@ -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 '';
}

View file

@ -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) {

View file

@ -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(
`