Add ability to load votes by id
Use createDate and updateDate as strings
This commit is contained in:
parent
17d67900c1
commit
e509c32f79
@ -12,6 +12,7 @@ app:
|
|||||||
db:
|
db:
|
||||||
type: sqlite
|
type: sqlite
|
||||||
database: data/data.db
|
database: data/data.db
|
||||||
|
timezone: 'Z'
|
||||||
synchronize: false
|
synchronize: false
|
||||||
dropSchema: false
|
dropSchema: false
|
||||||
migrationsRun: false
|
migrationsRun: false
|
||||||
|
|||||||
@ -4,13 +4,18 @@ import {
|
|||||||
UpdateDateColumn,
|
UpdateDateColumn,
|
||||||
} from 'typeorm'
|
} from 'typeorm'
|
||||||
|
|
||||||
|
const transformer = {
|
||||||
|
from: (value: Date) => value.toISOString(),
|
||||||
|
to: (value: undefined | null | string) => value ? new Date(value) : value,
|
||||||
|
}
|
||||||
|
|
||||||
export abstract class BaseEntity {
|
export abstract class BaseEntity {
|
||||||
@PrimaryGeneratedColumn({type: 'bigint'})
|
@PrimaryGeneratedColumn({type: 'bigint'})
|
||||||
id!: number
|
id!: number
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn({transformer, type: 'datetime'})
|
||||||
createDate!: Date
|
createDate!: string
|
||||||
|
|
||||||
@UpdateDateColumn()
|
@UpdateDateColumn({transformer, type: 'datetime'})
|
||||||
updateDate!: Date
|
updateDate!: string
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user