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

@giftwizard/db-models

Package Overview
Dependencies
Maintainers
8
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@giftwizard/db-models - npm Package Compare versions

Comparing version 12.0.0 to 12.0.1

models/map-rise-to-scp-codes.js

112

models/gift-card.js

@@ -14,3 +14,3 @@ const _ = require('lodash');

primaryKey: true,
autoIncrement: true
autoIncrement: true,
},

@@ -20,13 +20,13 @@ gift_card_id: {

type: DataTypes.UUID,
defaultValue: () => uuid()
defaultValue: () => uuid(),
},
shop_url: {
type: DataTypes.TEXT
type: DataTypes.TEXT,
},
cart_id: {
type: DataTypes.TEXT,
allowNull: true
allowNull: true,
},
shopify_gift_card_id: {
type: DataTypes.TEXT
type: DataTypes.TEXT,
},

@@ -36,11 +36,11 @@ created_at: {

allowNull: false,
defaultValue: DataTypes.NOW
defaultValue: DataTypes.NOW,
},
code: {
type: DataTypes.TEXT,
allowNull: true
allowNull: true,
},
initial_value: {
type: DataTypes.FLOAT,
allowNull: true
allowNull: true,
},

@@ -50,7 +50,7 @@ balance: {

allowNull: true,
defaultValue: '0'
defaultValue: '0',
},
gift_card_type: {
type: DataTypes.ENUM('regular', 'coupon'),
allowNull: true
allowNull: true,
},

@@ -68,79 +68,76 @@ collections: {

const collectionsArray = collectionsValue.split(',');
return collectionsArray.map(collectionId => {
return parseInt(collectionId);
});
} else {
return [];
return collectionsArray.map(collectionId => parseInt(collectionId));
}
}
return [];
},
},
gift_card_source: {
type: DataTypes.TEXT
type: DataTypes.TEXT,
},
notified: {
type: DataTypes.INTEGER
type: DataTypes.INTEGER,
},
expires_on: {
type: DataTypes.DATE,
allowNull: true
allowNull: true,
},
disabled_at: {
type: DataTypes.DATE,
allowNull: true
allowNull: true,
},
campaign_id: {
type: DataTypes.TEXT,
allowNull: true
allowNull: true,
},
platform: {
type: DataTypes.TEXT
type: DataTypes.TEXT,
},
customer_email: {
type: DataTypes.TEXT,
allowNull: true
allowNull: true,
},
customer_name: {
type: DataTypes.TEXT,
allowNull: true
allowNull: true,
},
order_id: {
type: DataTypes.TEXT,
allowNull: true
allowNull: true,
},
note: {
type: DataTypes.TEXT,
allowNull: true
allowNull: true,
},
fulfilled_at: {
type: DataTypes.DATE,
allowNull: true
allowNull: true,
},
reason: {
type: DataTypes.TEXT,
allowNull: true
allowNull: true,
},
customer_id: {
type: DataTypes.INTEGER(10).UNSIGNED,
allowNull: true
allowNull: true,
},
api_client_id: {
type: DataTypes.INTEGER(10).UNSIGNED,
allowNull: true
allowNull: true,
},
workflow_id: {
type: DataTypes.INTEGER(10).UNSIGNED,
allowNull: true
allowNull: true,
},
reminders_count: {
type: DataTypes.INTEGER(11).UNSIGNED,
allowNull: true
allowNull: true,
},
last_reminder_triggered_at: {
type: DataTypes.DATE,
allowNull: true
allowNull: true,
},
order_risk_level: {
type: DataTypes.INTEGER(11).UNSIGNED,
allowNull: true
}
allowNull: true,
},
},

@@ -154,12 +151,12 @@ {

updatedAt: 'updated_at',
deletedAt: 'deleted_at'
}
deletedAt: 'deleted_at',
},
);
GiftCard.getMatchingPhysicalGiftCardInBrand = async function(last_chars, brand, shop_url) {
GiftCard.getMatchingPhysicalGiftCardInBrand = async function (last_chars, brand, shop_url) {
return this.findOne({
where: {
code: {
[Op.like]: `%${last_chars}`
}
[Op.like]: `%${last_chars}`,
},
},

@@ -175,16 +172,16 @@ include: [

shop_url: {
[Op.ne]: shop_url
}
}
]
}
}
]
[Op.ne]: shop_url,
},
},
],
},
},
],
});
};
GiftCard.getMatchingGiftCardsInBrand = async function(code, brand, shop_url) {
GiftCard.getMatchingGiftCardsInBrand = async function (code, brand, shop_url) {
return this.findAll({
where: {
code
code,
},

@@ -200,13 +197,14 @@ include: [

shop_url: {
[Op.ne]: shop_url
}
}
]
}
}
]
[Op.ne]: shop_url,
},
},
],
},
},
],
});
};
GiftCard.associate = models => {
GiftCard.associate = (models) => {
GiftCard.hasOne(models.MapRiseToScpCodes);
GiftCard.hasOne(models.LoyaltyCard);

@@ -213,0 +211,0 @@

@@ -0,1 +1,3 @@

const { v4: uuid } = require('uuid');
module.exports = (sequelizeConnection, DataTypes) => {

@@ -9,6 +11,8 @@ const Gift = sequelizeConnection.define(

primaryKey: true,
autoIncrement: true,
},
gift_id: {
type: DataTypes.STRING,
allowNull: false,
type: DataTypes.UUID,
defaultValue: () => uuid(),
},

@@ -15,0 +19,0 @@ shop_url: {

@@ -20,3 +20,3 @@ module.exports = (sequelizeConnection, DataTypes) => {

MapCardsToGift.associate = (models) => {
MapCardsToGift.belongsTo(models.Gift, { foreignKey: 'gift_id', sourceKey: 'id' });
MapCardsToGift.belongsTo(models.Gift, { foreignKey: 'gift_id', sourceKey: 'gift_id' });
models.GiftCard.hasOne(MapCardsToGift, { foreignKey: 'gift_card_id', sourceKey: 'id' });

@@ -23,0 +23,0 @@ };

{
"name": "@giftwizard/db-models",
"version": "12.0.0",
"version": "12.0.1",
"description": "Rise.ai package for 'sequelize' models used by several projects.",

@@ -39,2 +39,2 @@ "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