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()
authenticate,
paginationValidator,
setDefaultPagination,
+ userHistoryListValidator,
asyncMiddleware(listMyVideosHistory)
)
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))
}
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()
}