- const videoInstance = res.locals.videoAll
- const body: VideoAbuseCreate = req.body
- let reporterAccount: MAccountDefault
- let videoAbuseJSON: VideoAbuse
-
- const videoAbuseInstance = await sequelizeTypescript.transaction(async t => {
- reporterAccount = await AccountModel.load(res.locals.oauth.token.User.Account.id, t)
-
- const abuseToCreate = {
- reporterAccountId: reporterAccount.id,
- reason: body.reason,
- videoId: videoInstance.id,
- state: VideoAbuseState.PENDING
- }
-
- const videoAbuseInstance: MVideoAbuseAccountVideo = await VideoAbuseModel.create(abuseToCreate, { transaction: t })
- videoAbuseInstance.Video = videoInstance
- videoAbuseInstance.Account = reporterAccount