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:
|
||||
type: sqlite
|
||||
database: data/data.db
|
||||
timezone: 'Z'
|
||||
synchronize: false
|
||||
dropSchema: false
|
||||
migrationsRun: false
|
||||
|
||||
@ -4,13 +4,18 @@ import {
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm'
|
||||
|
||||
const transformer = {
|
||||
from: (value: Date) => value.toISOString(),
|
||||
to: (value: undefined | null | string) => value ? new Date(value) : value,
|
||||
}
|
||||
|
||||
export abstract class BaseEntity {
|
||||
@PrimaryGeneratedColumn({type: 'bigint'})
|
||||
id!: number
|
||||
|
||||
@CreateDateColumn()
|
||||
createDate!: Date
|
||||
@CreateDateColumn({transformer, type: 'datetime'})
|
||||
createDate!: string
|
||||
|
||||
@UpdateDateColumn()
|
||||
updateDate!: Date
|
||||
@UpdateDateColumn({transformer, type: 'datetime'})
|
||||
updateDate!: string
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user