setDefaultSort,
userNotificationsSortValidator
} from '../../../middlewares'
-import { UserModel } from '../../../models/account/user'
import { getFormattedObjects } from '../../../helpers/utils'
import { UserNotificationModel } from '../../../models/account/user-notification'
import { meRouter } from './me'
// ---------------------------------------------------------------------------
async function updateNotificationSettings (req: express.Request, res: express.Response) {
- const user: UserModel = res.locals.oauth.token.User
- const body = req.body
+ const user = res.locals.oauth.token.User
+ const body = req.body as UserNotificationSetting
const query = {
where: {
newVideoFromSubscription: body.newVideoFromSubscription,
newCommentOnMyVideo: body.newCommentOnMyVideo,
videoAbuseAsModerator: body.videoAbuseAsModerator,
+ videoAutoBlacklistAsModerator: body.videoAutoBlacklistAsModerator,
blacklistOnMyVideo: body.blacklistOnMyVideo,
myVideoPublished: body.myVideoPublished,
myVideoImportFinished: body.myVideoImportFinished,
newFollow: body.newFollow,
newUserRegistration: body.newUserRegistration,
- commentMention: body.commentMention
+ commentMention: body.commentMention,
+ newInstanceFollower: body.newInstanceFollower
}
await UserNotificationSettingModel.update(values, query)
}
async function listUserNotifications (req: express.Request, res: express.Response) {
- const user: UserModel = res.locals.oauth.token.User
+ const user = res.locals.oauth.token.User
const resultList = await UserNotificationModel.listForApi(user.id, req.query.start, req.query.count, req.query.sort, req.query.unread)
}
async function markAsReadUserNotifications (req: express.Request, res: express.Response) {
- const user: UserModel = res.locals.oauth.token.User
+ const user = res.locals.oauth.token.User
await UserNotificationModel.markAsRead(user.id, req.body.ids)
}
async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) {
- const user: UserModel = res.locals.oauth.token.User
+ const user = res.locals.oauth.token.User
await UserNotificationModel.markAllAsRead(user.id)