1 import { Transaction } from 'sequelize'
2 import { AccountModel } from '../../models/account/account'
3 import { VideoModel } from '../../models/video/video'
4 import { sendCreateDislike, sendLike, sendUndoDislike, sendUndoLike } from './send'
6 async function sendVideoRateChange (account: AccountModel,
11 const actor = account.Actor
13 // Keep the order: first we undo and then we create
16 if (likes < 0) await sendUndoLike(actor, video, t)
18 if (dislikes < 0) await sendUndoDislike(actor, video, t)
21 if (likes > 0) await sendLike(actor, video, t)
23 if (dislikes > 0) await sendCreateDislike(actor, video, t)