initial commit
This commit is contained in:
12
schema/utils/transformers.ts
Normal file
12
schema/utils/transformers.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { ValueTransformer } from "typeorm"
|
||||
|
||||
export const transformer: Record<"date" | "bigint", ValueTransformer> = {
|
||||
date: {
|
||||
from: (date: string | null) => date && new Date(parseInt(date, 10)),
|
||||
to: (date?: Date) => date?.valueOf().toString(),
|
||||
},
|
||||
bigint: {
|
||||
from: (bigInt: string | null) => bigInt && parseInt(bigInt, 10),
|
||||
to: (bigInt?: number) => bigInt?.toString(),
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user