How to use the sequelize.BOOLEAN function in sequelize

To help you get started, we’ve selected a few sequelize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kinecosystem / marketplace-server / scripts / src / models / all.ts View on Github external
}) as GenericModel);

const OfferContent = models.push(sequelize.define("offer_content", {
	content: Sequelize.JSON,
	offer_id: Sequelize.STRING,
}) as GenericModel);

const AppOffer = models.push(sequelize.define("app_offers", {
	app_id: Sequelize.STRING,
	offer_id: Sequelize.STRING,
}) as GenericModel);

// pre-bought coupons
const Asset = models.push(sequelize.define("assets", {
	created_date: Sequelize.DATE,
	is_used: Sequelize.BOOLEAN,
	id: { type: Sequelize.STRING, primaryKey: true, defaultValue: () => generateId(IdPrefix.None)  },
	type: Sequelize.STRING,
	value: Sequelize.JSON,
}) as GenericModel);

const Transaction = models.push(sequelize.define("transactions", {
	blockchain_txid: Sequelize.STRING,
	created_date: Sequelize.DATE,
	meta: Sequelize.JSON, // title, description, call_to_action, some human readable data for UI
	order_id: {type: Sequelize.STRING, defaultValue: () => generateId(IdPrefix.Transaction) },
	type: Sequelize.STRING,  // earn, spend
	user_id: Sequelize.STRING, // redundant
	value: Sequelize.JSON,  // coupon codes
}) as GenericModel);

// models.sync().then(synced => console.log(`finished syncing all models (${ synced.length })`));
github bellsaladin / Keystone-Mysql / _core / keystone / _dbObj / utils.js View on Github external
function transformTypeToSequlizeType(type){
	if( type === String ){
		return Sequelize.STRING;
	}
	if( type === Number ){
		return Sequelize.INTEGER;
	}

	if( type === Boolean ){
		return Sequelize.BOOLEAN;
	}

	if( type === Date ){
		return Sequelize.DATE;
	}

	// IMPORTANT : for other types (ex: mongoose relationships based on models : put integer for foreing keys)
	return Sequelize.INTEGER;
}
github madhurjain / passport-local-sequelize / lib / passport-local-sequelize.js View on Github external
allowNull: false
    },
    salt: {
        type: Sequelize.STRING,
        allowNull: false
    },
    activationKey: {
        type: Sequelize.STRING,
        allowNull: true
    },
    resetPasswordKey: {
        type: Sequelize.STRING,
        allowNull: true
    },
    verified: {
        type: Sequelize.BOOLEAN,
        allowNull: true
    }
};

var attachToUser = function (UserSchema, options) {
    // Get our options with default values for things not passed in
    options = _.defaults(options || {}, defaultAttachOptions);

    UserSchema.beforeCreate(function(user, op, next) {
        // if specified, convert the username to lowercase
        if (options.usernameLowerCase) {
            user[options.usernameField] = user[options.usernameField].toLowerCase();
        }
        if (typeof(next) === 'function') {
            next(null, user);
        }
github kingsquare / swagger-sequelize / index.js View on Github external
case "array":
      if (dialect === "postgres") {
        return Sequelize.ARRAY(getSequalizeType(swaggerPropertySchema.items));
      }
      console.log(
        "Warning: encountered",
        JSON.stringify(swaggerPropertySchema)
      );
      console.log(
        "Can only handle array for postgres (yet?), see http://docs.sequelizejs.com/en/latest/api/datatypes/#array, falling back to blob"
      );
      return Sequelize.BLOB;

    case "boolean":
      return Sequelize.BOOLEAN;

    case "integer":
      switch (swaggerPropertySchema.format || "") {
        case "int32":
          if (
            typeof swaggerPropertySchema.minimum === "number" &&
            swaggerPropertySchema.minimum >= 0
          ) {
            return Sequelize.INTEGER.UNSIGNED;
          }
          return Sequelize.INTEGER;

        default:
          if (
            typeof swaggerPropertySchema.minimum === "number" &&
            swaggerPropertySchema.minimum >= 0
github LibreTubeApp / LibreTube / src / graphql / connectors.js View on Github external
export const queryInterface = db.getQueryInterface();

db.authenticate()
  .then(() => {
    console.log('Connection has been established successfully.');
  })
  .catch(error => {
    console.error('Unable to connect to the database:', error);
    throw error;
  });

export const User = db.define('user', {
  username: Sequelize.STRING,
  password: Sequelize.STRING,
  active: Sequelize.BOOLEAN,
  email: Sequelize.STRING,
  apiToken: Sequelize.STRING,
});

export const Channel = db.define('channel', {
  id: { type: Sequelize.STRING, primaryKey: true },
  title: Sequelize.STRING,
  description: Sequelize.TEXT,
  username: Sequelize.STRING,
  etag: Sequelize.STRING,
});

export const Video = db.define('video', {
  id: { type: Sequelize.STRING, primaryKey: true },
  title: Sequelize.STRING,
  description: Sequelize.TEXT,
github ubports / devices.ubports.com / src / models / db.js View on Github external
device: Sequelize.STRING,
    pri: Sequelize.INTEGER,
    donates: Sequelize.INTEGER,
    price: Sequelize.INTEGER,
    wiki: Sequelize.STRING,
    systemImage: Sequelize.TEXT,
    status: Sequelize.INTEGER,
    whatIsWorking: Sequelize.TEXT,
    about: Sequelize.TEXT,
    type: Sequelize.STRING,
    votes: Sequelize.INTEGER,
    bitcoin: Sequelize.STRING,
    maintainer: Sequelize.STRING,
    multirom: Sequelize.BOOLEAN,
    done: Sequelize.INTEGER,
    request: Sequelize.BOOLEAN,
    comment: Sequelize.STRING,
    adbRecovery: Sequelize.STRING,
    mdt: Sequelize.BOOLEAN
  });

};
exports.db = db;
github ripple / ripple-rest / models / outgoingTx.js View on Github external
module.exports = function(db) {

  var OutgoingTx = db.define('outgoing_transactions', {

    submitted_at_ledger: sequelize.INTEGER,
    source_address: sequelize.TEXT,
    source_transaction_id: sequelize.TEXT,
    tx_json: sequelize.TEXT,
    type: sequelize.TEXT,
    state: sequelize.TEXT,
    submitted_ids: sequelize.TEXT,
    submission_attempts: sequelize.TEXT,
    engine_result: sequelize.TEXT,
    engine_result_message: sequelize.TEXT,
    hash: sequelize.TEXT,
    reported: sequelize.BOOLEAN

  });

  return OutgoingTx;

};
github galtproject / geesome-node / components / database / mysql / models / tag.ts View on Github external
type: Sequelize.STRING
    },
    description: {
      type: Sequelize.STRING
    },
    credentials: {
      type: Sequelize.STRING
    },
    avatarImageId: {
      type: Sequelize.INTEGER
    },
    coverImageId: {
      type: Sequelize.INTEGER
    },
    isGlobal: {
      type: Sequelize.BOOLEAN
    },
    storageId: {
      type: Sequelize.STRING(200)
    },
    staticStorageId: {
      type: Sequelize.STRING(200)
    },
    storageAccountId: {
      type: Sequelize.STRING(200)
    },
    manifestStorageId: {
      type: Sequelize.STRING(200)
    },
    manifestStaticStorageId: {
      type: Sequelize.STRING(200)
    }
github Dev-Snippets / java-snippets / js / typed-entity-decorators / scripts / decorator-x / src / transform / entity / sequelize.js View on Github external
function _mapType(type: string) {
  if (type === 'integer') {
    return Sequelize.INTEGER;
  } else if (type === 'string') {
    return Sequelize.STRING;
  } else if (type === 'boolean') {
    return Sequelize.BOOLEAN;
  } else if (type === 'dateTime' || type === 'date') {
    return Sequelize.DATE;
  } else if (type === 'object' || type === 'array') {
    return Sequelize.STRING;
  }
}
github twinlabs / forum / models / User.orm.js View on Github external
type: Sequelize.STRING,
      },
      custom_code: {
        type: Sequelize.STRING,
      },
      hide_connected: {
        type: Sequelize.BOOLEAN,
      },
      signature: {
        type: Sequelize.STRING,
      },
      is_supporter: {
        type: Sequelize.DATE,
      },
      is_v2: {
        type: Sequelize.BOOLEAN,
      },
      last_visited: {
        type: Sequelize.JSON,
      },
    },
    {
      underscored: true,
      tableName: 'forum_user',
    },
  );

  user.associate = function(models) {
    user.hasMany(models.post, { foreignKey: 'user_id' });
  };

  user.prototype.isValidPassword = function(password, callback) {

sequelize

Sequelize is a promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Amazon Redshift and Snowflake’s Data Cloud. It features solid transaction support, relations, eager and lazy loading, read replication and more.

MIT
Latest version published 28 days ago

Package Health Score

95 / 100
Full package analysis