New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tm-apps-db

Package Overview
Dependencies
Maintainers
5
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tm-apps-db - npm Package Compare versions

Comparing version 2.0.17 to 3.0.0

migrations/201610261136_change_tags.js

2

migrations/201610191536_ad_column_and_index_to_article_sections.js

@@ -18,5 +18,5 @@ module.exports = {

.then(() => {
return queryInterface.removeColumn('article_sections', 'published_date', sequelize.DATE)
return queryInterface.removeColumn('article_sections', 'published_date', sequelize.DATE);
});
}
};

@@ -88,4 +88,4 @@ "use strict";

associate: function(models) {
article.belongsToMany(models.tag, {through: 'articles_tags', constraints: false});
article.belongsTo(models.section, {as: 'home_section', constraints: false});
article.hasMany(models.article_tag, {constraints: false});
article.hasMany(models.article_section, {constraints: false});

@@ -126,2 +126,9 @@ article.hasMany(models.article_content, {constraints: false});

},
purgeTags: function (options) {
return sequelize.models.article_tag.destroy(R.merge({ where: {article_id: this.getDataValue('id')} }, options));
},
setTags: function (data, options) {
const relations = R.map(R.assoc('article_id', this.getDataValue('id')), data);
return sequelize.models.article_tag.bulkCreate(relations, options);
},
findOrCreateThenSetTags: function (data, options) {

@@ -128,0 +135,0 @@ const promises = R.map(tag => sequelize.models.tag.findOrCreate(R.merge(options, {where: { id: tag.id }, defaults: R.omit(['id'], tag)})).spread((a, b) => a), data);

"use strict";
const R = require('ramda');
const utils = require('../utils');

@@ -11,2 +11,14 @@ module.exports = function(sequelize, DataTypes) {

},
standardized_name: {
type: DataTypes.STRING,
allowNull: true
},
tag_id: {
type: DataTypes.STRING,
allowNull: true,
validate: {
is: /^(regionals|nationals)\.[0-9]+$/
},
set: utils.idSetter
},
name: {

@@ -16,3 +28,6 @@ type: DataTypes.STRING,

},
relevance: DataTypes.FLOAT
article_count: {
type: DataTypes.INTEGER,
allowNull: true
}
}, {

@@ -22,11 +37,13 @@ tableName: 'tags',

classMethods: {
associate: function (models) {
tag.belongsToMany(models.article, {
through: 'articles_tags',
constraints: false
});
associate: function(models) {
tag.hasMany(models.article_tag, {constraints: false});
}
}
},
indexes: [
{
fields: ['tag_id']
}
]
});
return tag;
};
{
"name": "tm-apps-db",
"version": "2.0.17",
"version": "3.0.0",
"description": "Apps consumer database initialiser",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc