mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Cleanup express locals typings
This commit is contained in:
parent
e65c0c5b1f
commit
dae86118ed
45 changed files with 270 additions and 234 deletions
|
@ -17,10 +17,8 @@ import {
|
|||
videoAbuseUpdateValidator
|
||||
} from '../../../middlewares'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
import { VideoAbuseModel } from '../../../models/video/video-abuse'
|
||||
import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
import { Notifier } from '../../../lib/notifier'
|
||||
import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag'
|
||||
|
||||
|
@ -69,7 +67,7 @@ async function listVideoAbuses (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function updateVideoAbuse (req: express.Request, res: express.Response) {
|
||||
const videoAbuse: VideoAbuseModel = res.locals.videoAbuse
|
||||
const videoAbuse = res.locals.videoAbuse
|
||||
|
||||
if (req.body.moderationComment !== undefined) videoAbuse.moderationComment = req.body.moderationComment
|
||||
if (req.body.state !== undefined) videoAbuse.state = req.body.state
|
||||
|
@ -84,7 +82,7 @@ async function updateVideoAbuse (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function deleteVideoAbuse (req: express.Request, res: express.Response) {
|
||||
const videoAbuse: VideoAbuseModel = res.locals.videoAbuse
|
||||
const videoAbuse = res.locals.videoAbuse
|
||||
|
||||
await sequelizeTypescript.transaction(t => {
|
||||
return videoAbuse.destroy({ transaction: t })
|
||||
|
@ -96,11 +94,11 @@ async function deleteVideoAbuse (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function reportVideoAbuse (req: express.Request, res: express.Response) {
|
||||
const videoInstance = res.locals.video as VideoModel
|
||||
const videoInstance = res.locals.video
|
||||
const body: VideoAbuseCreate = req.body
|
||||
|
||||
const videoAbuse: VideoAbuseModel = await sequelizeTypescript.transaction(async t => {
|
||||
const reporterAccount = await AccountModel.load((res.locals.oauth.token.User as UserModel).Account.id, t)
|
||||
const reporterAccount = await AccountModel.load(res.locals.oauth.token.User.Account.id, t)
|
||||
|
||||
const abuseToCreate = {
|
||||
reporterAccountId: reporterAccount.id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue