Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// user
- username:{
- type:DataTypes.STRING,
- validate: {
- min: {
- args: 1,
- msg: 'user.username.min.'
- },
- max: {
- args: 30,
- msg: 'Username must less than 40 characters.'
- },
- notEmpty: {
- args:true,
- msg: "user.username.empty",
- // errorCo:2010
- },
- unique: {
- args: true,
- message: 'user.username.unique',
- fields: [sequelize.fn('lower', sequelize.col('username'))]
- },
- is: {
- args: /^[A-Za-z][A-Za-z0-9-]+$/i, // must start with letter and only have letters, numbers, dashes
- msg: 'Username must no spaces'
- },
- },
- },
- password: {
- type:DataTypes.STRING,
- min:{
- args:6,
- msg:
- "Password min length is 6 characters"
- },
- max:{
- args:30,
- msg:
- "Password maximum length must be 30 characters"
- },
- is:{
- args:['/^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{6,}$','i'],
- msg:'Password should contain at least one letter and one digit'
- }
- },
- password_comfirm: {
- type:DataTypes.STRING,
- },
- email: {
- type: DataTypes.STRING,
- lowercase:true,
- validate: {
- // is: ['^\S+(?: \S+)*$','u'],
- len: {
- args: [0, 129],
- msg:
- "Email address max 129 characters in length"
- },
- max: {
- args: 129,
- msg: "Email address max 129 characters in length"
- },
- // notEmpty: true,
- notEmpty: {
- args:true,
- msg: "Email address not empty"
- },
- isEmail: {
- args:true,
- msg: "Email address must be valid"
- },
- },
- unique: {
- args: true,
- msg: 'Looks like you already have an account with this email address. Please try to login.',
- // fields: [sequelize.fn('lower', sequelize.col('email'))]
- },
- },
- dob:{
- type: DataTypes.DATE,
- validate:{
- min:{
- // args:
- }
- }
- },
- //comment
- user_id: {
- type:DataTypes.INTEGER,
- foreignKey:true,
- validate:{
- notEmpty: {
- args:true,
- msg: "user_id not empty",
- },
- isInt: {
- args:true,
- msg: "type user_id not mask",
- }
- },
- },
- content: DataTypes.STRING,
- feed_id: {
- type:DataTypes.INTEGER,
- validate:{
- notEmpty: {
- args:true,
- msg: "feed_id not empty",
- },
- isInt: {
- args:true,
- msg: "feed_id not found",
- }
- },
- },
- /// like
- user_id: {
- type:DataTypes.INTEGER,
- validate:{
- notEmpty: {
- args:true,
- msg: "user_id not empty",
- },
- isInt: {
- args:true,
- msg: "user_id not found",
- }
- },
- },
- type: {
- type:DataTypes.STRING,
- validate:{
- notEmpty: true,
- }
- },
- feed_id: {
- type:DataTypes.INTEGER,
- validate:{
- notEmpty: {
- args:true,
- msg: "feed_id not empty",
- },
- isInt: {
- args:true,
- msg: "feed_id not found",
- }
- },
- },
- /// post feed
- categories_id: {
- type:DataTypes.INTEGER,
- notEmpty: {
- args:true,
- msg: "categories_id not empty",
- },
- isInt: true,
- },
- user_id: {
- type:DataTypes.INTEGER,
- foreignKey:true,
- validate:{
- notEmpty: {
- args:true,
- msg: "user_id not empty",
- },
- isInt: {
- args:true,
- msg: "user_id not found",
- }
- },
- },
- content:{
- type:DataTypes.TEXT,
- notEmpty: {
- args:true,
- msg: "content not empty",
- },
- },
- //report
- reason: {
- type:DataTypes.STRING,
- validate:{
- notEmpty: {
- args:true,
- msg: "reason not empty",
- },
- },
- },
- message:{
- type:DataTypes.TEXT,
- validate:{
- notEmpty: {
- args:true,
- msg: "message not empty",
- },
- },
- },
- feed_id:{
- type:DataTypes.INTEGER,
- validate:{
- notEmpty: {
- args:true,
- msg: "feed_id not empty",
- },
- isInt: {
- args:true,
- msg: "feed_id not found",
- }
- },
- },
- user_id: {
- type:DataTypes.INTEGER,
- validate:{
- notEmpty: {
- args:true,
- msg: "user_id not empty",
- },
- isInt: {
- args:true,
- msg: "user_id not found",
- }
- },
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement