Commit 163b7bf 1 parent 0dcaca9 commit 163b7bf Copy full SHA for 163b7bf
File tree 2 files changed +11
-3
lines changed
backend/src/bundles/videos
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { type UpdateVideoRequestDto } from '~/bundles/videos/types/types.js' ;
2
2
import { VideoEntity } from '~/bundles/videos/video.entity.js' ;
3
3
import { type VideoModel } from '~/bundles/videos/video.model.js' ;
4
+ import { type ImageService } from '~/common/services/image/image.service.js' ;
4
5
import { type Repository } from '~/common/types/types.js' ;
5
6
6
7
class VideoRepository implements Repository {
7
8
private videoModel : typeof VideoModel ;
9
+ private imageService : ImageService ;
8
10
9
- public constructor ( videoModel : typeof VideoModel ) {
11
+ public constructor (
12
+ videoModel : typeof VideoModel ,
13
+ imageService : ImageService ,
14
+ ) {
10
15
this . videoModel = videoModel ;
16
+ this . imageService = imageService ;
11
17
}
12
18
13
19
public async findById ( id : string ) : Promise < VideoEntity | null > {
@@ -58,7 +64,9 @@ class VideoRepository implements Repository {
58
64
59
65
if ( payload . composition ) {
60
66
data . composition = payload . composition ;
61
- data . previewUrl = payload . composition . scenes [ 0 ] ?. avatar ?. url ?? '' ;
67
+ data . previewUrl = await this . imageService . generatePreview (
68
+ payload . composition ,
69
+ ) ;
62
70
}
63
71
64
72
if ( payload . name ) {
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { VideoModel } from './video.model.js';
6
6
import { VideoRepository } from './video.repository.js' ;
7
7
import { VideoService } from './video.service.js' ;
8
8
9
- const videoRepository = new VideoRepository ( VideoModel ) ;
9
+ const videoRepository = new VideoRepository ( VideoModel , imageService ) ;
10
10
const videoService = new VideoService (
11
11
videoRepository ,
12
12
fileService ,
You can’t perform that action at this time.
0 commit comments