Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Sequelize.BLOB( 'tiny' );
Sequelize.BLOB( 'medium' );
Sequelize.BLOB( { length : 'medium' } );
Sequelize.BLOB( 'long' );
Sequelize.ARRAY( Sequelize.STRING );
Sequelize.ARRAY( Sequelize.STRING( 100 ) );
Sequelize.ARRAY( Sequelize.INTEGER );
Sequelize.ARRAY( Sequelize.HSTORE );
Sequelize.ARRAY( Sequelize.ARRAY( Sequelize.STRING ) );
Sequelize.ARRAY( Sequelize.TEXT );
Sequelize.ARRAY( Sequelize.DATE );
Sequelize.ARRAY( Sequelize.BOOLEAN );
Sequelize.ARRAY( Sequelize.DECIMAL );
Sequelize.ARRAY( Sequelize.DECIMAL( 6 ) );
Sequelize.ARRAY( Sequelize.DECIMAL( 6, 4 ) );
Sequelize.ARRAY( Sequelize.DOUBLE );
Sequelize.ARRAY( Sequelize.REAL );
Sequelize.ARRAY( Sequelize.JSON );
Sequelize.ARRAY( Sequelize.JSONB );
Sequelize.GEOMETRY;
Sequelize.GEOMETRY( 'POINT' );
Sequelize.GEOMETRY( 'LINESTRING' );
Sequelize.GEOMETRY( 'POLYGON' );
Sequelize.GEOMETRY( 'POINT', 4326 );
Sequelize.VIRTUAL;
Sequelize.VIRTUAL( Sequelize.STRING );
Sequelize.VIRTUAL( Sequelize.DATE , ['property1', 'property2']);
new Sequelize.VIRTUAL( Sequelize.STRING );
new Sequelize.VIRTUAL( Sequelize.DATE , ['property1', 'property2']);
//
// Deferrable
Sequelize.BLOB( 'long' );
Sequelize.ARRAY( Sequelize.STRING );
Sequelize.ARRAY( Sequelize.STRING( 100 ) );
Sequelize.ARRAY( Sequelize.INTEGER );
Sequelize.ARRAY( Sequelize.HSTORE );
Sequelize.ARRAY( Sequelize.ARRAY( Sequelize.STRING ) );
Sequelize.ARRAY( Sequelize.TEXT );
Sequelize.ARRAY( Sequelize.DATE );
Sequelize.ARRAY( Sequelize.BOOLEAN );
Sequelize.ARRAY( Sequelize.DECIMAL );
Sequelize.ARRAY( Sequelize.DECIMAL( 6 ) );
Sequelize.ARRAY( Sequelize.DECIMAL( 6, 4 ) );
Sequelize.ARRAY( Sequelize.DOUBLE );
Sequelize.ARRAY( Sequelize.REAL );
Sequelize.ARRAY( Sequelize.JSON );
Sequelize.ARRAY( Sequelize.JSONB );
Sequelize.GEOMETRY;
Sequelize.GEOMETRY( 'POINT' );
Sequelize.GEOMETRY( 'LINESTRING' );
Sequelize.GEOMETRY( 'POLYGON' );
Sequelize.GEOMETRY( 'POINT', 4326 );
Sequelize.VIRTUAL;
Sequelize.VIRTUAL( Sequelize.STRING );
Sequelize.VIRTUAL( Sequelize.DATE , ['property1', 'property2']);
new Sequelize.VIRTUAL( Sequelize.STRING );
new Sequelize.VIRTUAL( Sequelize.DATE , ['property1', 'property2']);
//
// Deferrable
// ~~~~~~~~~~~~
//
// https://github.com/sequelize/sequelize/blob/v3.4.1/test/integration/sequelize/deferrable.test.js
Twitter Model
****************/
/* * Imports * */
var Sequelize = require('sequelize');
var sql = require('../connection.js');
/* * Schema * */
module.exports = sql.define('twitter', {
fullName: { type: Sequelize.STRING, allowNull: false, primaryKey: true },
handle: { type: Sequelize.STRING },
twitterId: {type: Sequelize.STRING },
profilePic: {type: Sequelize.STRING, defaultValue: '' },
tweets: { type: Sequelize.ARRAY(Sequelize.TEXT), defaultValue: [] },
backgroundPic: {type: Sequelize.STRING, defaultValue: '' },
followers: { type: Sequelize.INTEGER, defaultValue: 0 },
followerschange: { type: Sequelize.INTEGER, defaultValue: 0 },
score: { type: Sequelize.INTEGER, defaultValue: 0 },
scorechange: { type: Sequelize.INTEGER, defaultValue: 0 },
scorecounter: { type: Sequelize.INTEGER, defaultValue: 0 },
scoreminute: { type: Sequelize.ARRAY(Sequelize.INTEGER), defaultValue: [] },
scorehour: { type: Sequelize.ARRAY(Sequelize.INTEGER), defaultValue: [] },
scoreday: { type: Sequelize.ARRAY(Sequelize.INTEGER), defaultValue: [] },
scoreweek: { type: Sequelize.ARRAY(Sequelize.INTEGER), defaultValue: [] },
scoremonth: { type: Sequelize.ARRAY(Sequelize.INTEGER), defaultValue: [] }
});
module.exports.sync();
},
authorID: {
type: Sequelize.STRING,
allowNull: false
},
starboardMessageID: {
type: Sequelize.STRING,
allowNull: false
},
stars: {
type: Sequelize.INTEGER,
allowNull: false,
defaultValue: 0
},
starredBy: {
type: Sequelize.ARRAY(Sequelize.STRING), // eslint-disable-line new-cap
allowNull: false
}
});
module.exports = Star;
// Add your service(s)
const model = user(this.get('sequelize')),
options = {
Model: model,
paginate: {
default: 5,
max: 25
}
};
const doc = {
description: 'Operations about Users.',
definitions: {
'UserPaginate': swagger.definition({
attributes: {
data: Sequelize.ARRAY('users')
}
}, {
extends: ['paginate']
})
},
definition: swagger.definition(model),
securities: ['find'],
find: {
parameters: [{
description: 'Get examples by name',
in: 'query',
required: false,
name: 'email',
type: 'string'
}],
responses: {
Sequelize.DECIMAL( { precision : 10, scale : 2 } );
Sequelize.DECIMAL( 10 );
Sequelize.DECIMAL( { precision : 10 } );
Sequelize.ENUM( 'value 1', 'value 2' );
Sequelize.BLOB;
Sequelize.BLOB( 'tiny' );
Sequelize.BLOB( 'medium' );
Sequelize.BLOB( { length : 'medium' } );
Sequelize.BLOB( 'long' );
Sequelize.ARRAY( Sequelize.STRING );
Sequelize.ARRAY( Sequelize.STRING( 100 ) );
Sequelize.ARRAY( Sequelize.INTEGER );
Sequelize.ARRAY( Sequelize.HSTORE );
Sequelize.ARRAY( Sequelize.ARRAY( Sequelize.STRING ) );
Sequelize.ARRAY( Sequelize.TEXT );
Sequelize.ARRAY( Sequelize.DATE );
Sequelize.ARRAY( Sequelize.BOOLEAN );
Sequelize.ARRAY( Sequelize.DECIMAL );
Sequelize.ARRAY( Sequelize.DECIMAL( 6 ) );
Sequelize.ARRAY( Sequelize.DECIMAL( 6, 4 ) );
Sequelize.ARRAY( Sequelize.DOUBLE );
Sequelize.ARRAY( Sequelize.REAL );
Sequelize.ARRAY( Sequelize.JSON );
Sequelize.ARRAY( Sequelize.JSONB );
Sequelize.GEOMETRY;
Sequelize.GEOMETRY( 'POINT' );
Sequelize.GEOMETRY( 'LINESTRING' );
Sequelize.GEOMETRY( 'POLYGON' );
Sequelize.GEOMETRY( 'POINT', 4326 );
Sequelize.VIRTUAL;
Sequelize.VIRTUAL( Sequelize.STRING );
Sequelize.VIRTUAL( Sequelize.DATE , ['property1', 'property2']);
Sequelize.DECIMAL( 10, 2 );
Sequelize.DECIMAL( { precision : 10, scale : 2 } );
Sequelize.DECIMAL( 10 );
Sequelize.DECIMAL( { precision : 10 } );
Sequelize.ENUM( 'value 1', 'value 2' );
Sequelize.BLOB;
Sequelize.BLOB( 'tiny' );
Sequelize.BLOB( 'medium' );
Sequelize.BLOB( { length : 'medium' } );
Sequelize.BLOB( 'long' );
Sequelize.ARRAY( Sequelize.STRING );
Sequelize.ARRAY( Sequelize.STRING( 100 ) );
Sequelize.ARRAY( Sequelize.INTEGER );
Sequelize.ARRAY( Sequelize.HSTORE );
Sequelize.ARRAY( Sequelize.ARRAY( Sequelize.STRING ) );
Sequelize.ARRAY( Sequelize.TEXT );
Sequelize.ARRAY( Sequelize.DATE );
Sequelize.ARRAY( Sequelize.BOOLEAN );
Sequelize.ARRAY( Sequelize.DECIMAL );
Sequelize.ARRAY( Sequelize.DECIMAL( 6 ) );
Sequelize.ARRAY( Sequelize.DECIMAL( 6, 4 ) );
Sequelize.ARRAY( Sequelize.DOUBLE );
Sequelize.ARRAY( Sequelize.REAL );
Sequelize.ARRAY( Sequelize.JSON );
Sequelize.ARRAY( Sequelize.JSONB );
Sequelize.GEOMETRY;
Sequelize.GEOMETRY( 'POINT' );
Sequelize.GEOMETRY( 'LINESTRING' );
Sequelize.GEOMETRY( 'POLYGON' );
Sequelize.GEOMETRY( 'POINT', 4326 );
Sequelize.VIRTUAL;
Sequelize.VIRTUAL( Sequelize.STRING );
const db = new Sequelize(DATABASE_URL, {
dialect: 'postgres'
});
const Student = db.define('student', {
id: {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
education: Sequelize.ARRAY(Sequelize.JSON),
skills: Sequelize.ARRAY(Sequelize.JSON),
compLanguages: Sequelize.ARRAY(Sequelize.JSON),
projects: Sequelize.ARRAY(Sequelize.JSON),
trainings: Sequelize.ARRAY(Sequelize.JSON),
cbStudent: {type: Sequelize.BOOLEAN, defaultValue: false},
cbCourses: Sequelize.ARRAY(Sequelize.STRING),
});
const CompanyManager = db.define('companymanager', {
id: {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
designation: Sequelize.STRING,
});
const Admin = db.define('admin', {
id: {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
cbCentre: Sequelize.STRING,
cbDesignation: Sequelize.STRING
});
const User = db.define('user', {
id: {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
email: {
type: Sequelize.STRING,
unique: true,
allowNull: false
},
password: {
type: Sequelize.STRING
},
salt: {
type: Sequelize.STRING
},
googleId: {
type: Sequelize.STRING
},
favoriteFood: {
type: Sequelize.ARRAY(Sequelize.STRING),
defaultValue: []
}
})
module.exports = User
/**
* instanceMethods
*/
User.prototype.correctPassword = function (candidatePwd) {
return User.encryptPassword(candidatePwd, this.salt) === this.password
}
/**
* classMethods
*/
const DATABASE_URL = process.env.DATABASE_URL || ('postgres://' + secret.DB_USER + ":" + secret.DB_PASSWORD + "@" + secret.DB_HOST + ":5432/" + secret.DATABASE);
const db = new Sequelize(DATABASE_URL, {
dialect: 'postgres'
});
const Student = db.define('student', {
id: {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
education: Sequelize.ARRAY(Sequelize.JSON),
skills: Sequelize.ARRAY(Sequelize.JSON),
compLanguages: Sequelize.ARRAY(Sequelize.JSON),
projects: Sequelize.ARRAY(Sequelize.JSON),
trainings: Sequelize.ARRAY(Sequelize.JSON),
cbStudent: {type: Sequelize.BOOLEAN, defaultValue: false},
cbCourses: Sequelize.ARRAY(Sequelize.STRING),
});
const CompanyManager = db.define('companymanager', {
id: {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
designation: Sequelize.STRING,
});
const Admin = db.define('admin', {
id: {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
cbCentre: Sequelize.STRING,
cbDesignation: Sequelize.STRING
});