mirror of
https://github.com/umami-software/umami.git
synced 2026-02-15 01:55:36 +01:00
Cherry pick prisma query protection.
This commit is contained in:
parent
4c202741c2
commit
9a7385e4d5
9 changed files with 68 additions and 47 deletions
|
|
@ -11,16 +11,18 @@ export async function getActiveVisitors(...args: [websiteId: string]) {
|
|||
}
|
||||
|
||||
async function relationalQuery(websiteId: string) {
|
||||
const date = subMinutes(new Date(), 5);
|
||||
const params = [date];
|
||||
const { toUuid, rawQuery } = prisma;
|
||||
|
||||
return prisma.rawQuery(
|
||||
const date = subMinutes(new Date(), 5);
|
||||
const params: any = [websiteId, date];
|
||||
|
||||
return rawQuery(
|
||||
`select count(distinct session_id) x
|
||||
from pageview
|
||||
from website_event
|
||||
join website
|
||||
on pageview.website_id = website.website_id
|
||||
where website.website_id = '${websiteId}'
|
||||
and pageview.created_at >= $1`,
|
||||
on website_event.website_id = website.website_id
|
||||
where website.website_id = $1${toUuid()}
|
||||
and website_event.created_at >= $2`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue