- password: {
- type: DataTypes.STRING,
- allowNull: false,
- validate: {
- passwordValid: value => {
- const res = isUserPasswordValid(value)
- if (res === false) throw new Error('Password not valid.')
- }
- }
- },
- username: {
- type: DataTypes.STRING,
- allowNull: false,
- validate: {
- usernameValid: value => {
- const res = isUserUsernameValid(value)
- if (res === false) throw new Error('Username not valid.')
- }
- }
- },
- email: {
- type: DataTypes.STRING(400),
- allowNull: false,
- validate: {
- isEmail: true
- }
- },
- displayNSFW: {
- type: DataTypes.BOOLEAN,
- allowNull: false,
- defaultValue: false,
- validate: {
- nsfwValid: value => {
- const res = isUserDisplayNSFWValid(value)
- if (res === false) throw new Error('Display NSFW is not valid.')
- }
- }
- },
- role: {
- type: DataTypes.INTEGER,
- allowNull: false,
- validate: {
- roleValid: value => {
- const res = isUserRoleValid(value)
- if (res === false) throw new Error('Role is not valid.')
- }
- }
- },
- videoQuota: {
- type: DataTypes.BIGINT,
- allowNull: false,
- validate: {
- videoQuotaValid: value => {
- const res = isUserVideoQuotaValid(value)
- if (res === false) throw new Error('Video quota is not valid.')
- }
- }
+ model: () => AccountModel,
+ required: true
+ }
+ ]
+})
+@Scopes({
+ [ScopeNames.WITH_VIDEO_CHANNEL]: {
+ include: [
+ {
+ model: () => AccountModel,
+ required: true,
+ include: [ () => VideoChannelModel ]