Skip to content

Commit b61353a

Browse files
committed
Fix Video nodes not having proper labels
1 parent 7a8a633 commit b61353a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/components/file/media/detect-existing-media.migration.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { FileVersion } from '../dto';
66
import { FileRepository } from '../file.repository';
77
import { MediaService } from './media.service';
88

9-
@Migration('2023-09-05T19:00:00')
9+
@Migration('2023-09-06T12:00:00')
1010
export class DetectExistingMediaMigration extends BaseMigration {
1111
constructor(
1212
private readonly mediaService: MediaService,
@@ -16,6 +16,7 @@ export class DetectExistingMediaMigration extends BaseMigration {
1616
}
1717

1818
async up() {
19+
await this.fixVideoLabels();
1920
await this.dropAllDuplicatedMedia();
2021

2122
const detect = async (f: FileVersion) => {
@@ -82,6 +83,13 @@ export class DetectExistingMediaMigration extends BaseMigration {
8283
} while (true);
8384
}
8485

86+
private async fixVideoLabels() {
87+
await this.db.query().raw`
88+
match (v:Video)
89+
set v:VisualMedia:TemporalMedia:Media
90+
`.executeAndLogStats();
91+
}
92+
8593
private async dropAllDuplicatedMedia() {
8694
await this.db.query().raw`
8795
match (fv:FileVersion)-->(media:Media)

src/components/file/media/media.dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export class Image extends VisualMedia {
120120
@ObjectType({
121121
implements: [VisualMedia, TemporalMedia, Media],
122122
})
123+
@DbLabel('Video', 'VisualMedia', 'TemporalMedia', 'Media') // IntersectionType blocks label inheritance
123124
export class Video extends IntersectionType(VisualMedia, TemporalMedia) {
124125
static readonly Props = keysOf<Video>();
125126
static readonly SecuredProps = keysOf<SecuredProps<Video>>();

0 commit comments

Comments
 (0)