Skip to content

Commit

Permalink
fix: typo in query
Browse files Browse the repository at this point in the history
  • Loading branch information
chronark committed Nov 11, 2024
1 parent 9d4a41a commit 28fed2d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/clickhouse/src/verifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ const schema = z.object({
export function getVerificationsPerHour(ch: Querier) {
return async (args: z.input<typeof params>) => {
const query = `
SELECT
SELECT
time,
outcome async,
count
FROM verifications.key_verifications_per_hour_v1
WHERE
WHERE
workspace_id = {workspaceId: String}
AND key_space_id = {keySpaceId: String} AND time >= {start: Int64}
AND time < {end: Int64}
${args.keyId ? "AND key_id = {keyId: String}" : ""}
GROUP BY time
ORDER BY time ASC
WITH FILL
WITH FILL
FROM toStartOfHour(fromUnixTimestamp64Milli({start: Int64}))
TO toStartOfHour(fromUnixTimestamp64Milli({end: Int64}))
STEP INTERVAL 1 HOUR
Expand All @@ -57,22 +57,22 @@ export function getVerificationsPerHour(ch: Querier) {
export function getVerificationsPerDay(ch: Querier) {
return async (args: z.input<typeof params>) => {
const query = `
SELECT
SELECT
time,
outcome,
count
FROM verifications.key_verifications_per_day_v1
WHERE
WHERE
workspace_id = {workspaceId: String}
AND key_space_id = {keySpaceId: String} AND time >= {start: Int64}
AND time < {end: Int64}
${args.keyId ? "AND key_id = {keyId: String}" : ""}
GROUP BY time
ORDER BY time ASC
WITH FILL
WITH FILL
FROM toStartOfDay(fromUnixTimestamp64Milli({start: Int64}))
TO toStartOfDay(fromUnixTimestamp64Milli({end: Int64}))
STEP INTERVAL 1D AY
STEP INTERVAL 1D
;`;

return ch.query({ query, params, schema })(args);
Expand All @@ -82,19 +82,19 @@ export function getVerificationsPerDay(ch: Querier) {
export function getVerificationsPerMonth(ch: Querier) {
return async (args: z.input<typeof params>) => {
const query = `
SELECT
SELECT
time,
outcome,
count
FROM verifications.key_verifications_per_month_v1
WHERE
WHERE
workspace_id = {workspaceId: String}
AND key_space_id = {keySpaceId: String} AND time >= {start: Int64}
AND time < {end: Int64}
${args.keyId ? "AND key_id = {keyId: String}" : ""}
GROUP BY time
ORDER BY time ASC
WITH FILL
WITH FILL
FROM toStartOfMonth(fromUnixTimestamp64Milli({start: Int64}))
TO toStartOfMonth(fromUnixTimestamp64Milli({end: Int64}))
STEP INTERVAL 1 MONTH
Expand Down

0 comments on commit 28fed2d

Please sign in to comment.