mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
add timestamp column to prisma realtime queries
This commit is contained in:
parent
8a4fe95a72
commit
29694352e7
@ -13,17 +13,26 @@ export function getEvents(...args: [websiteId: string, filters: QueryFilters]) {
|
||||
function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||
const { startDate } = filters;
|
||||
|
||||
return prisma.client.websiteEvent.findMany({
|
||||
where: {
|
||||
websiteId,
|
||||
createdAt: {
|
||||
gte: startDate,
|
||||
return prisma.client.websiteEvent
|
||||
.findMany({
|
||||
where: {
|
||||
websiteId,
|
||||
createdAt: {
|
||||
gte: startDate,
|
||||
},
|
||||
},
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
});
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
})
|
||||
.then(a => {
|
||||
return Object.values(a).map(a => {
|
||||
return {
|
||||
...a,
|
||||
timestamp: new Date(a.createdAt).getTime() / 1000,
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
||||
|
@ -13,17 +13,26 @@ export async function getSessions(...args: [websiteId: string, filters: QueryFil
|
||||
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||
const { startDate } = filters;
|
||||
|
||||
return prisma.client.session.findMany({
|
||||
where: {
|
||||
websiteId,
|
||||
createdAt: {
|
||||
gte: startDate,
|
||||
return prisma.client.session
|
||||
.findMany({
|
||||
where: {
|
||||
websiteId,
|
||||
createdAt: {
|
||||
gte: startDate,
|
||||
},
|
||||
},
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
});
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
})
|
||||
.then(a => {
|
||||
return Object.values(a).map(a => {
|
||||
return {
|
||||
...a,
|
||||
timestamp: new Date(a.createdAt).getTime() / 1000,
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
||||
|
Loading…
Reference in New Issue
Block a user