You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-12-01 22:52:06 +02:00
adding sqlite support, removing mysql required dependency
This commit is contained in:
39
backend/model/sql/enitites/DirectoryEntity.ts
Normal file
39
backend/model/sql/enitites/DirectoryEntity.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import {Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn} from "typeorm";
|
||||
import {DirectoryDTO} from "../../../../common/entities/DirectoryDTO";
|
||||
import {PhotoEntity} from "./PhotoEntity";
|
||||
|
||||
@Entity()
|
||||
export class DirectoryEntity implements DirectoryDTO {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column({
|
||||
length: 500
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
length: 500
|
||||
})
|
||||
path: string;
|
||||
|
||||
|
||||
@Column('number')
|
||||
public lastModified: number;
|
||||
@Column('number')
|
||||
public lastScanned: number;
|
||||
|
||||
@Column({type: 'smallint', length: 1})
|
||||
public scanned: boolean;
|
||||
|
||||
@ManyToOne(type => DirectoryEntity, directory => directory.directories, {onDelete: "CASCADE"})
|
||||
public parent: DirectoryEntity;
|
||||
|
||||
@OneToMany(type => DirectoryEntity, dir => dir.parent)
|
||||
public directories: Array<DirectoryEntity>;
|
||||
|
||||
@OneToMany(type => PhotoEntity, photo => photo.directory)
|
||||
public photos: Array<PhotoEntity>;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user