2022-04-23 21:08:45 -05:00
|
|
|
import { Column, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
2022-06-11 16:12:06 -05:00
|
|
|
import { AssetEntity } from './asset.entity';
|
2022-04-23 21:08:45 -05:00
|
|
|
import { SharedAlbumEntity } from './shared-album.entity';
|
|
|
|
|
|
|
|
|
|
@Entity('asset_shared_album')
|
|
|
|
|
@Unique('PK_unique_asset_in_album', ['albumId', 'assetId'])
|
|
|
|
|
export class AssetSharedAlbumEntity {
|
|
|
|
|
@PrimaryGeneratedColumn()
|
|
|
|
|
id: string;
|
|
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
|
albumId: string;
|
|
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
|
assetId: string;
|
|
|
|
|
|
|
|
|
|
@ManyToOne(() => SharedAlbumEntity, (sharedAlbum) => sharedAlbum.sharedAssets, {
|
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
|
nullable: true,
|
|
|
|
|
})
|
|
|
|
|
@JoinColumn({ name: 'albumId' })
|
|
|
|
|
albumInfo: SharedAlbumEntity;
|
|
|
|
|
|
|
|
|
|
@ManyToOne(() => AssetEntity, {
|
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
|
nullable: true,
|
|
|
|
|
})
|
|
|
|
|
@JoinColumn({ name: 'assetId' })
|
|
|
|
|
assetInfo: AssetEntity;
|
|
|
|
|
}
|