mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 08:07:12 +01:00
Events table.
This commit is contained in:
parent
2addb96e4b
commit
5206622d5a
13 changed files with 131 additions and 31 deletions
|
|
@ -400,3 +400,41 @@ export function getActiveVisitors(website_id) {
|
|||
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
export function getEvents(website_id, start_at, end_at) {
|
||||
const db = getDatabase();
|
||||
|
||||
if (db === POSTGRESQL) {
|
||||
return prisma.$queryRaw(
|
||||
`
|
||||
select distinct event_type w, event_value x, count(*) y
|
||||
from event
|
||||
where website_id=$1
|
||||
and created_at between $2 and $3
|
||||
group by 1, 2
|
||||
order by 3 desc
|
||||
`,
|
||||
website_id,
|
||||
start_at,
|
||||
end_at,
|
||||
);
|
||||
}
|
||||
|
||||
if (db === MYSQL) {
|
||||
return prisma.$queryRaw(
|
||||
`
|
||||
select distinct event_type w, event_value x, count(*) y
|
||||
from event
|
||||
where website_id=?
|
||||
and created_at between ? and ?
|
||||
group by 1, 2
|
||||
order by 3 desc
|
||||
`,
|
||||
website_id,
|
||||
start_at,
|
||||
end_at,
|
||||
);
|
||||
}
|
||||
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue