1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/backend/model/sql/enitites/SharingEntity.ts

42 lines
870 B
TypeScript
Raw Normal View History

2018-03-31 03:30:30 +08:00
import {Column, Entity, ManyToOne, PrimaryGeneratedColumn} from 'typeorm';
import {SharingDTO} from '../../../../common/entities/SharingDTO';
import {UserEntity} from './UserEntity';
import {UserDTO} from '../../../../common/entities/UserDTO';
2017-07-04 01:17:49 +08:00
@Entity()
export class SharingEntity implements SharingDTO {
@PrimaryGeneratedColumn({unsigned: true})
2017-07-04 01:17:49 +08:00
id: number;
2017-10-20 00:08:07 +08:00
@Column()
2017-07-04 01:17:49 +08:00
sharingKey: string;
2017-10-20 00:08:07 +08:00
@Column()
2017-07-04 01:17:49 +08:00
path: string;
2018-03-31 03:30:30 +08:00
@Column({type: 'text', nullable: true})
2017-07-04 01:17:49 +08:00
password: string;
@Column('bigint', {
unsigned: true, transformer: {
from: v => parseInt(v, 10),
to: v => v
}
})
2017-07-04 01:17:49 +08:00
expires: number;
@Column('bigint', {
unsigned: true, transformer: {
from: v => parseInt(v, 10),
to: v => v
}
})
2017-07-04 01:17:49 +08:00
timeStamp: number;
2017-10-20 00:08:07 +08:00
@Column()
2017-07-04 01:17:49 +08:00
includeSubfolders: boolean;
@ManyToOne(type => UserEntity)
creator: UserDTO;
}