1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

improving bigint parsing

This commit is contained in:
Patrik J. Braun 2019-02-15 15:49:05 -05:00
parent ec777bade6
commit b387eeb7c9
2 changed files with 9 additions and 4 deletions

View File

@ -36,7 +36,7 @@ export class DirectoryEntity implements DirectoryDTO {
*/
@Column({
type: 'bigint', nullable: true, unsigned: true, transformer: {
from: v => parseInt(v, 10),
from: v => parseInt(v, 10) || null,
to: v => v
}
})

View File

@ -1,5 +1,5 @@
import {Column, Entity, ChildEntity} from 'typeorm';
import { MediaEntity, MediaMetadataEntity} from './MediaEntity';
import {ChildEntity, Column} from 'typeorm';
import {MediaEntity, MediaMetadataEntity} from './MediaEntity';
import {VideoDTO, VideoMetadata} from '../../../../common/entities/VideoDTO';
@ -8,7 +8,12 @@ export class VideoMetadataEntity extends MediaMetadataEntity implements VideoMet
@Column('int')
bitRate: number;
@Column('bigint')
@Column('bigint', {
unsigned: true, nullable: true, transformer: {
from: v => parseInt(v, 10) || null,
to: v => v
}
})
duration: number;
}