Details page.
This commit is contained in:
18
lib/db.js
18
lib/db.js
@@ -154,6 +154,24 @@ export async function getPageviews(website_id, start_at, end_at) {
|
||||
);
|
||||
}
|
||||
|
||||
export async function getRankings(website_id, start_at, end_at, type, table) {
|
||||
return runQuery(
|
||||
prisma.queryRaw(
|
||||
`
|
||||
select distinct "${type}" x, count(*) y
|
||||
from "${table}"
|
||||
where website_id=$1
|
||||
and created_at between $2 and $3
|
||||
group by 1
|
||||
order by 2 desc
|
||||
`,
|
||||
website_id,
|
||||
start_at,
|
||||
end_at,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export async function getPageviewData(
|
||||
website_id,
|
||||
start_at,
|
||||
|
||||
Reference in New Issue
Block a user