X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fusers%2Fmy-history.ts;h=cff1697ab719320ba07ad5b54708011f5ec8cccf;hb=1c5e49e75284100b7b1fc8b4e73c8ba53fe22e89;hp=4da1f34963e01638947c3a9565ea0ee808ee906a;hpb=282e61e6c11f79e919c543871783fe1a00298d18;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts index 4da1f3496..cff1697ab 100644 --- a/server/controllers/api/users/my-history.ts +++ b/server/controllers/api/users/my-history.ts @@ -5,11 +5,13 @@ import { authenticate, paginationValidator, setDefaultPagination, + userHistoryListValidator, userHistoryRemoveValidator } from '../../../middlewares' import { getFormattedObjects } from '../../../helpers/utils' -import { UserVideoHistoryModel } from '../../../models/account/user-video-history' -import { sequelizeTypescript } from '../../../initializers' +import { UserVideoHistoryModel } from '../../../models/user/user-video-history' +import { sequelizeTypescript } from '../../../initializers/database' +import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' const myVideosHistoryRouter = express.Router() @@ -17,6 +19,7 @@ myVideosHistoryRouter.get('/me/history/videos', authenticate, paginationValidator, setDefaultPagination, + userHistoryListValidator, asyncMiddleware(listMyVideosHistory) ) @@ -37,7 +40,7 @@ export { async function listMyVideosHistory (req: express.Request, res: express.Response) { const user = res.locals.oauth.token.User - const resultList = await UserVideoHistoryModel.listForApi(user, req.query.start, req.query.count) + const resultList = await UserVideoHistoryModel.listForApi(user, req.query.start, req.query.count, req.query.search) return res.json(getFormattedObjects(resultList.data, resultList.total)) } @@ -50,7 +53,7 @@ async function removeUserHistory (req: express.Request, res: express.Response) { return UserVideoHistoryModel.removeUserHistoryBefore(user, beforeDate, t) }) - // Do not send the delete to other instances, we delete OUR copy of this video abuse - - return res.type('json').status(204).end() + return res.type('json') + .status(HttpStatusCode.NO_CONTENT_204) + .end() }