feat(server): improve thumbnail relation and updating (#1897)

* feat(server): improve thumbnail relation and updating

* improve query + update tests and migration

* make sure uuids are valid in migration

* fix unit test
This commit is contained in:
Michel Heusschen
2023-03-04 15:16:48 +01:00
committed by GitHub
parent 2ac54ce4bd
commit bdf35b6688
7 changed files with 138 additions and 60 deletions

View File

@@ -33,7 +33,10 @@ export class AlbumEntity {
@UpdateDateColumn({ type: 'timestamptz' })
updatedAt!: string;
@Column({ comment: 'Asset ID to be used as thumbnail', type: 'varchar', nullable: true })
@ManyToOne(() => AssetEntity, { nullable: true, onDelete: 'SET NULL', onUpdate: 'CASCADE' })
albumThumbnailAsset!: AssetEntity | null;
@Column({ comment: 'Asset ID to be used as thumbnail', nullable: true })
albumThumbnailAssetId!: string | null;
@ManyToMany(() => UserEntity)