feature(dashboard,api): add timezone support

* feat(dashboard): add support for today, yesterday etc (timezones)

* fix(db): escape js dates

* fix(dashboard): ensure we support default timezone

* final fixes

* remove complete series and add sql with fill instead
This commit is contained in:
Carl-Gerhard Lindesvärd
2025-05-23 11:26:44 +02:00
committed by GitHub
parent 46bfeee131
commit 680727355b
48 changed files with 1817 additions and 758 deletions

View File

@@ -10,6 +10,7 @@ export interface SqlBuilderObject {
joins: Record<string, string>;
limit: number | undefined;
offset: number | undefined;
fill: string | undefined;
}
export function createSqlBuilder() {
@@ -26,6 +27,7 @@ export function createSqlBuilder() {
joins: {},
limit: undefined,
offset: undefined,
fill: undefined,
};
const getWhere = () =>
@@ -43,6 +45,7 @@ export function createSqlBuilder() {
const getOffset = () => (sb.offset ? `OFFSET ${sb.offset}` : '');
const getJoins = () =>
Object.keys(sb.joins).length ? join(sb.joins, ' ') : '';
const getFill = () => (sb.fill ? `WITH FILL ${sb.fill}` : '');
return {
sb,
@@ -54,6 +57,7 @@ export function createSqlBuilder() {
getOrderBy,
getHaving,
getJoins,
getFill,
getSql: () => {
const sql = [
getSelect(),
@@ -65,6 +69,7 @@ export function createSqlBuilder() {
getOrderBy(),
getLimit(),
getOffset(),
getFill(),
]
.filter(Boolean)
.join(' ');