mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
31 lines
815 B
TypeScript
31 lines
815 B
TypeScript
|
|
import { Column, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
||
|
|
import { AssetEntity } from '../../asset/entities/asset.entity';
|
||
|
|
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;
|
||
|
|
}
|