mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 16:17:13 +01:00
Feat/um 62 prisma property names (#1562)
* checkpoint * fix pg schema * fix mysql schema * change property names
This commit is contained in:
parent
36edbe2f4c
commit
78338205a3
65 changed files with 431 additions and 433 deletions
|
|
@ -10,16 +10,16 @@ export async function createSession(...args) {
|
|||
});
|
||||
}
|
||||
|
||||
async function relationalQuery(website_id, data) {
|
||||
async function relationalQuery(websiteId, data) {
|
||||
return prisma.client.session
|
||||
.create({
|
||||
data: {
|
||||
website_id,
|
||||
websiteId,
|
||||
...data,
|
||||
},
|
||||
select: {
|
||||
session_id: true,
|
||||
session_uuid: true,
|
||||
sessionId: true,
|
||||
sessionUuid: true,
|
||||
hostname: true,
|
||||
browser: true,
|
||||
os: true,
|
||||
|
|
@ -31,7 +31,7 @@ async function relationalQuery(website_id, data) {
|
|||
})
|
||||
.then(async res => {
|
||||
if (redis.client && res) {
|
||||
await redis.client.set(`session:${res.session_uuid}`, res.session_id);
|
||||
await redis.client.set(`session:${res.sessionUuid}`, res.id);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
@ -39,14 +39,14 @@ async function relationalQuery(website_id, data) {
|
|||
}
|
||||
|
||||
async function clickhouseQuery(
|
||||
website_id,
|
||||
{ session_uuid, hostname, browser, os, screen, language, country, device },
|
||||
websiteId,
|
||||
{ sessionUuid, hostname, browser, os, screen, language, country, device },
|
||||
) {
|
||||
const { getDateFormat, sendMessage } = kafka;
|
||||
|
||||
const params = {
|
||||
session_uuid,
|
||||
website_id,
|
||||
session_uuid: sessionUuid,
|
||||
website_id: websiteId,
|
||||
created_at: getDateFormat(new Date()),
|
||||
hostname,
|
||||
browser,
|
||||
|
|
@ -60,6 +60,6 @@ async function clickhouseQuery(
|
|||
await sendMessage(params, 'event');
|
||||
|
||||
if (redis.client) {
|
||||
await redis.client.set(`session:${session_uuid}`, 1);
|
||||
await redis.client.set(`session:${sessionUuid}`, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,25 +10,25 @@ export async function getSessionByUuid(...args) {
|
|||
});
|
||||
}
|
||||
|
||||
async function relationalQuery(session_uuid) {
|
||||
async function relationalQuery(sessionUuid) {
|
||||
return prisma.client.session
|
||||
.findUnique({
|
||||
where: {
|
||||
session_uuid,
|
||||
sessionUuid,
|
||||
},
|
||||
})
|
||||
.then(async res => {
|
||||
if (redis.client && res) {
|
||||
await redis.client.set(`session:${res.session_uuid}`, res.session_id);
|
||||
await redis.client.set(`session:${res.sessionUuid}`, res.sessionId);
|
||||
}
|
||||
|
||||
return res;
|
||||
});
|
||||
}
|
||||
|
||||
async function clickhouseQuery(session_uuid) {
|
||||
async function clickhouseQuery(sessionUuid) {
|
||||
const { rawQuery, findFirst } = clickhouse;
|
||||
const params = [session_uuid];
|
||||
const params = [sessionUuid];
|
||||
|
||||
return rawQuery(
|
||||
`select distinct
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ export async function getSessionMetrics(...args) {
|
|||
});
|
||||
}
|
||||
|
||||
async function relationalQuery(website_id, { startDate, endDate, field, filters = {} }) {
|
||||
async function relationalQuery(websiteId, { startDate, endDate, field, filters = {} }) {
|
||||
const { parseFilters, rawQuery } = prisma;
|
||||
const params = [website_id, startDate, endDate];
|
||||
const params = [websiteId, startDate, endDate];
|
||||
const { pageviewQuery, sessionQuery, joinSession } = parseFilters(null, filters, params);
|
||||
|
||||
return rawQuery(
|
||||
|
|
@ -32,9 +32,9 @@ async function relationalQuery(website_id, { startDate, endDate, field, filters
|
|||
);
|
||||
}
|
||||
|
||||
async function clickhouseQuery(website_id, { startDate, endDate, field, filters = {} }) {
|
||||
async function clickhouseQuery(websiteId, { startDate, endDate, field, filters = {} }) {
|
||||
const { parseFilters, getBetweenDates, rawQuery } = clickhouse;
|
||||
const params = [website_id];
|
||||
const params = [websiteId];
|
||||
const { pageviewQuery, sessionQuery } = parseFilters(null, filters, params);
|
||||
|
||||
return rawQuery(
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ async function relationalQuery(websites, start_at) {
|
|||
...(websites && websites.length > 0
|
||||
? {
|
||||
website: {
|
||||
website_id: {
|
||||
id: {
|
||||
in: websites,
|
||||
},
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
created_at: {
|
||||
createdAt: {
|
||||
gte: start_at,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue