Skip to content

Commit

Permalink
Update adding views endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
n1klaus committed May 14, 2023
1 parent 951b62b commit 5204b2f
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions backend/src/controllers/video.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { NextFunction, Request, Response } from 'express';
import User from '../models/user.model';
import Video from '../models/video.model';
import createError from '../error';

Expand Down Expand Up @@ -149,13 +148,6 @@ class VideoController {
if (!video) {
return next(createError(404, 'Video not found!'));
}
if (resp?.locals?.user?._id) {
const user = await User.findById(String(resp.locals.user._id));
if (user) {
user.history.push(video.id);
user.save();
}
}
return resp.status(200).json('The view has been increased.');
} catch (err) {
return next(err);
Expand Down

0 comments on commit 5204b2f

Please sign in to comment.