mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
checkpoint
This commit is contained in:
parent
3e2c098c05
commit
8f934c7e6c
14 changed files with 73 additions and 63 deletions
|
|
@ -29,7 +29,7 @@ async function relationalQuery(
|
|||
return rawQuery(
|
||||
`
|
||||
select
|
||||
event_value x,
|
||||
event_name x,
|
||||
${getDateQuery('created_at', unit, timezone)} t,
|
||||
count(*) y
|
||||
from event
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function clickhouseQuery(websites, start_at) {
|
|||
session_id,
|
||||
created_at,
|
||||
url,
|
||||
event_type
|
||||
event_name
|
||||
from event
|
||||
where website_id in (${websites.join[',']}
|
||||
and created_at >= ${getDateFormatClickhouse(start_at)})
|
||||
|
|
|
|||
|
|
@ -14,33 +14,36 @@ export async function saveEvent(...args) {
|
|||
});
|
||||
}
|
||||
|
||||
async function relationalQuery(website_id, { session_id, url, event_type, event_value }) {
|
||||
async function relationalQuery(website_id, { session_id, url, event_name, event_data }) {
|
||||
const data = {
|
||||
website_id,
|
||||
session_id,
|
||||
url: url?.substr(0, URL_LENGTH),
|
||||
event_name: event_name?.substr(0, 50),
|
||||
};
|
||||
|
||||
if (event_data) {
|
||||
data.eventData = {
|
||||
create: {
|
||||
eventData: event_data,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return runQuery(
|
||||
prisma.event.create({
|
||||
data: {
|
||||
website_id,
|
||||
session_id,
|
||||
url: url?.substr(0, URL_LENGTH),
|
||||
event_type: event_type?.substr(0, 50),
|
||||
event_value: event_value?.substr(0, 50),
|
||||
},
|
||||
data,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
async function clickhouseQuery(website_id, { session_uuid, url, event_type, event_value }) {
|
||||
const params = [
|
||||
website_id,
|
||||
session_uuid,
|
||||
url?.substr(0, URL_LENGTH),
|
||||
event_type?.substr(0, 50),
|
||||
event_value?.substr(0, 50),
|
||||
];
|
||||
async function clickhouseQuery(website_id, { session_uuid, url, event_name }) {
|
||||
const params = [website_id, session_uuid, url?.substr(0, URL_LENGTH), event_name?.substr(0, 50)];
|
||||
|
||||
return rawQueryClickhouse(
|
||||
`
|
||||
insert into umami_dev.event (created_at, website_id, session_uuid, url, event_type, event_value)
|
||||
values (${getDateFormatClickhouse(new Date())}, $1, $2, $3, $4, $5);`,
|
||||
insert into umami_dev.event (created_at, website_id, session_uuid, url, event_name)
|
||||
values (${getDateFormatClickhouse(new Date())}, $1, $2, $3, $4);`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue