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
7
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 5.0.4 to 5.0.5-optim-2

28

models/customer.js

@@ -41,13 +41,14 @@ module.exports = (sequelizeConnection, DataTypes, Sequelize) => {

const offset = parseInt(page) * limitInt - limitInt;
try {
const { rows, count } = await Customer.findAndCountAll({
const result = await Customer.findAll({
limit: limitInt,
offset,
attributes: ['email', 'first_name', 'last_name', 'state'],
include: [
{
model: sequelizeConnection.models.LoyaltyCard,
required: true,
required: false,
include: [
{
attributes: ['balance', 'code'],
model: sequelizeConnection.models.GiftCard,

@@ -66,6 +67,6 @@ required: true

},
order: [['id', 'DESC'], ['updated_at', 'DESC']]
order: [['updated_at', 'DESC']]
});
return { rows, count };
return result;
} catch (error) {

@@ -122,6 +123,6 @@ throw new Error(`Unable to get all customers page - ${page} for shop - ${shop_url}, ${error}`);

Customer.getCustomersByName = (shop_url, email) => {
Customer.getCustomersSearch = (shop_url, search) => {
const sanitizedSearchQuery = search.trim().toLowerCase();
const searchQueryTokens = sanitizedSearchQuery.split(/\s+/);
const fields = ['first_name', 'last_name'];
const fields = ['email', 'first_name', 'last_name', 'tags', 'platform_customer_id'];

@@ -137,3 +138,3 @@ const operatorsFields = fields.map(field => {

return Customer.findAll({
limit: 5,
limit: 20,
where: {

@@ -143,2 +144,12 @@ shop_url,

},
include: [
{
model: sequelizeConnection.models.LoyaltyCard,
include: [
{
model: sequelizeConnection.models.GiftCard
}
]
}
]
})

@@ -152,3 +163,2 @@ .then(customers => {

};
Customer.updateLoyaltyCard = (shop_url, customerId, giftCardId) => {

@@ -155,0 +165,0 @@ return sequelizeConnection.models.LoyaltyCard.create({ gift_card_id: giftCardId })

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

@@ -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