Merge branch 'dev' of https://github.com/umami-software/umami into francis/uc-24-kafka-test

This commit is contained in:
Francis Cao 2022-08-04 17:48:00 -07:00
commit 1ffd5775f8
138 changed files with 2849 additions and 239 deletions

View file

@ -16,33 +16,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.event_data = {
create: {
event_data: 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,
);
}