mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-01-22 03:37:13 -05:00
Fix keyset paginate with dates
This commit is contained in:
parent
e9bfa0d8b0
commit
9af89da590
@ -44,8 +44,7 @@ export const base = new Elysia({ name: "base" })
|
||||
if (code === "NOT_FOUND") {
|
||||
return error;
|
||||
}
|
||||
console.error(code, error);
|
||||
logger.error("Elysia encountered an error. code={code} error={error.message}", {
|
||||
logger.error("Request error code={code} error={error}", {
|
||||
code: code,
|
||||
error: error,
|
||||
});
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { Value } from "@sinclair/typebox/value";
|
||||
import { and, eq, gt, isNull, lt, or, sql } from "drizzle-orm";
|
||||
import { t } from "elysia";
|
||||
import type { Sort } from "./sort";
|
||||
|
||||
type After = (string | number | boolean | undefined)[];
|
||||
type After = (string | number | boolean | Date | undefined)[];
|
||||
|
||||
// Create a filter (where) expression on the query to skip everything before/after the referenceID.
|
||||
// The generalized expression for this in pseudocode is:
|
||||
@ -55,6 +57,8 @@ export const keysetPaginate = ({
|
||||
let previous = undefined;
|
||||
|
||||
for (const [i, by] of [...sort.sort, pkSort].entries()) {
|
||||
if (Value.Check(t.String({ format: "date-time" }), cursor[i]))
|
||||
cursor[i] = new Date(cursor[i]);
|
||||
const cmp = by.desc ? lt : gt;
|
||||
where = or(
|
||||
where,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { record as elysiaRecord } from "@elysiajs/opentelemetry";
|
||||
import { getLogger } from "@logtape/logtape";
|
||||
import { metrics as metricapi, trace as traceapi } from "@opentelemetry/api";
|
||||
import { metrics as metricapi } from "@opentelemetry/api";
|
||||
import { logs as logapi } from "@opentelemetry/api-logs";
|
||||
import { SDK_INFO } from "@opentelemetry/core";
|
||||
import { OTLPLogExporter as OLTPLogExporterGRPC } from "@opentelemetry/exporter-logs-otlp-grpc";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user