})
}
- static removeHistoryBefore (user: UserModel, beforeDate: string, t: Transaction) {
+ static removeUserHistoryBefore (user: UserModel, beforeDate: string, t: Transaction) {
const query: DestroyOptions = {
where: {
userId: user.id
}
if (beforeDate) {
- query.where.updatedAt = {
+ query.where['updatedAt'] = {
[Op.lt]: beforeDate
}
}
return UserVideoHistoryModel.destroy(query)
}
+
+ static removeOldHistory (beforeDate: string) {
+ const query: DestroyOptions = {
+ where: {
+ updatedAt: {
+ [Op.lt]: beforeDate
+ }
+ }
+ }
+
+ return UserVideoHistoryModel.destroy(query)
+ }
}