mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-06-08 07:15:15 -04:00
Use real dates instead of iso string everywhere
This commit is contained in:
+8
-11
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
type Column,
|
||||
Column,
|
||||
type ColumnsSelection,
|
||||
getTableColumns,
|
||||
is,
|
||||
@@ -12,6 +12,8 @@ import {
|
||||
View,
|
||||
ViewBaseConfig,
|
||||
InferSelectModel,
|
||||
isTable,
|
||||
isSQLWrapper,
|
||||
} from "drizzle-orm";
|
||||
import type { CasingCache } from "drizzle-orm/casing";
|
||||
import type { AnyMySqlSelect } from "drizzle-orm/mysql-core";
|
||||
@@ -162,10 +164,11 @@ export const unnestValues = <
|
||||
.select(
|
||||
Object.fromEntries([
|
||||
...keys.map((x) => [x, sql.raw(`"${dbNames[x]}"`)]),
|
||||
...computed.map((x) => [
|
||||
x,
|
||||
(columns[x].defaultFn?.() ?? columns[x].onUpdateFn!()).as(dbNames[x]),
|
||||
]),
|
||||
...computed.map((x) => {
|
||||
let def = columns[x].defaultFn?.() ?? columns[x].onUpdateFn!();
|
||||
if (!isSQLWrapper(def)) def = sql`${def}`;
|
||||
return [x, def.as(dbNames[x])];
|
||||
}),
|
||||
]) as {
|
||||
[k in keyof typeof typeInfo.$inferInsert]-?: SQL.Aliased<
|
||||
(typeof typeInfo.$inferInsert)[k]
|
||||
@@ -255,9 +258,3 @@ export const isUniqueConstraint = (e: unknown): boolean => {
|
||||
cause.code === "23505"
|
||||
);
|
||||
};
|
||||
|
||||
export const normalizeDate = (date: Column) => {
|
||||
return sql<string>`to_char(${date}, 'YYYY-MM-DD"T"HH24:MI:SS"Z"')`.as(
|
||||
date.name,
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user