Table,
UpdatedAt
} from 'sequelize-typescript'
-import { throwIfNotValid } from '../utils'
-import { UserModel } from './user'
-import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
+import { MNotificationSettingFormattable } from '@server/types/models'
import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model'
+import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
import { clearCacheByUserId } from '../../lib/oauth-model'
-import { MNotificationSettingFormattable } from '@server/typings/models'
+import { throwIfNotValid } from '../utils'
+import { UserModel } from './user'
@Table({
tableName: 'userNotificationSetting',
@AllowNull(false)
@Default(null)
@Is(
- 'UserNotificationSettingVideoAbuseAsModerator',
- value => throwIfNotValid(value, isUserNotificationSettingValid, 'videoAbuseAsModerator')
+ 'UserNotificationSettingAbuseAsModerator',
+ value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseAsModerator')
)
@Column
- videoAbuseAsModerator: UserNotificationSettingValue
+ abuseAsModerator: UserNotificationSettingValue
@AllowNull(false)
@Default(null)
@Column
newInstanceFollower: UserNotificationSettingValue
+ @AllowNull(false)
+ @Default(null)
+ @Is(
+ 'UserNotificationSettingNewInstanceFollower',
+ value => throwIfNotValid(value, isUserNotificationSettingValid, 'autoInstanceFollowing')
+ )
+ @Column
+ autoInstanceFollowing: UserNotificationSettingValue
+
@AllowNull(false)
@Default(null)
@Is(
@Column
commentMention: UserNotificationSettingValue
+ @AllowNull(false)
+ @Default(null)
+ @Is(
+ 'UserNotificationSettingAbuseStateChange',
+ value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseStateChange')
+ )
+ @Column
+ abuseStateChange: UserNotificationSettingValue
+
+ @AllowNull(false)
+ @Default(null)
+ @Is(
+ 'UserNotificationSettingAbuseNewMessage',
+ value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseNewMessage')
+ )
+ @Column
+ abuseNewMessage: UserNotificationSettingValue
+
@ForeignKey(() => UserModel)
@Column
userId: number
return {
newCommentOnMyVideo: this.newCommentOnMyVideo,
newVideoFromSubscription: this.newVideoFromSubscription,
- videoAbuseAsModerator: this.videoAbuseAsModerator,
+ abuseAsModerator: this.abuseAsModerator,
videoAutoBlacklistAsModerator: this.videoAutoBlacklistAsModerator,
blacklistOnMyVideo: this.blacklistOnMyVideo,
myVideoPublished: this.myVideoPublished,
newUserRegistration: this.newUserRegistration,
commentMention: this.commentMention,
newFollow: this.newFollow,
- newInstanceFollower: this.newInstanceFollower
+ newInstanceFollower: this.newInstanceFollower,
+ autoInstanceFollowing: this.autoInstanceFollowing,
+ abuseNewMessage: this.abuseNewMessage,
+ abuseStateChange: this.abuseStateChange
}
}
}