mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 08:07:12 +01:00
checkpoint
This commit is contained in:
parent
3e2c098c05
commit
8f934c7e6c
14 changed files with 73 additions and 63 deletions
|
|
@ -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