@@ -8,7 +8,6 @@ import { Connection } from 'cypher-query-builder';
8
8
import { intersection } from 'lodash' ;
9
9
import { Duration } from 'luxon' ;
10
10
import { Readable } from 'stream' ;
11
- import { withAddedPath } from '~/common/url.util' ;
12
11
import {
13
12
DuplicateException ,
14
13
DurationIn ,
@@ -19,8 +18,9 @@ import {
19
18
ServerException ,
20
19
Session ,
21
20
UnauthorizedException ,
22
- } from '../../common' ;
23
- import { ConfigService , ILogger , Logger } from '../../core' ;
21
+ } from '~/common' ;
22
+ import { withAddedPath } from '~/common/url.util' ;
23
+ import { ConfigService , IEventBus , ILogger , Logger } from '~/core' ;
24
24
import { FileBucket } from './bucket' ;
25
25
import {
26
26
CreateDefinedFileVersionInput ,
@@ -41,6 +41,7 @@ import {
41
41
RenameFileInput ,
42
42
RequestUploadOutput ,
43
43
} from './dto' ;
44
+ import { AfterFileUploadEvent } from './events/after-file-upload.event' ;
44
45
import { FileUrlController as FileUrl } from './file-url.controller' ;
45
46
import { FileRepository } from './file.repository' ;
46
47
import { MediaService } from './media/media.service' ;
@@ -53,6 +54,7 @@ export class FileService {
53
54
private readonly db : Connection ,
54
55
private readonly config : ConfigService ,
55
56
private readonly mediaService : MediaService ,
57
+ private readonly eventBus : IEventBus ,
56
58
@Logger ( 'file:service' ) private readonly logger : ILogger ,
57
59
) { }
58
60
@@ -361,7 +363,11 @@ export class FileService {
361
363
// Change the file's name to match the latest version name
362
364
await this . rename ( { id : fileId , name } , session ) ;
363
365
364
- return await this . getFile ( fileId , session ) ;
366
+ const file = await this . getFile ( fileId , session ) ;
367
+
368
+ await this . eventBus . publish ( new AfterFileUploadEvent ( file ) ) ;
369
+
370
+ return file ;
365
371
}
366
372
367
373
private async validateParentNode (
0 commit comments