File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -260,7 +260,9 @@ export class SongService {
260
260
publicId : string ,
261
261
user : UserDocument | null ,
262
262
) : Promise < SongViewDto > {
263
- const foundSong = await this . songModel . findOne ( { publicId : publicId } ) ;
263
+ const foundSong = await this . songModel . findOne ( {
264
+ publicId : publicId ,
265
+ } ) ;
264
266
265
267
if ( ! foundSong ) {
266
268
throw new HttpException ( 'Song not found' , HttpStatus . NOT_FOUND ) ;
@@ -278,7 +280,11 @@ export class SongService {
278
280
279
281
// increment view count
280
282
foundSong . playCount ++ ;
281
- await foundSong . save ( ) ;
283
+
284
+ this . songModel . updateOne (
285
+ { publicId : publicId } ,
286
+ { playCount : foundSong . playCount } ,
287
+ ) ;
282
288
283
289
const populatedSong = await foundSong . populate (
284
290
'uploader' ,
You can’t perform that action at this time.
0 commit comments