lakehouse-sequelize-restapi-keycloak-cache
Advanced tools
Comparing version
{ | ||
"name": "lakehouse-sequelize-restapi-keycloak-cache", | ||
"version": "1.5.4", | ||
"version": "1.5.5", | ||
"description": "caching for all types of data cached on redis hosts/cluster: data from database and sequelize ORM, rest API, keycloak admin api library", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -105,3 +105,5 @@ class CachingUtils { | ||
.map(([as, association]) => { | ||
const associatedModel = model.sequelize.model(association.target.name) | ||
// console.log(model); | ||
// console.log(model.sequelize.models(association.target.name)); | ||
const associatedModel = association.target | ||
return { | ||
@@ -113,3 +115,22 @@ model: associatedModel, | ||
}) | ||
} | ||
} | ||
// static generateIncludeRecurse(model, depth = 1) { | ||
// if (depth > 5) { | ||
// return [] | ||
// } | ||
// return Object.entries(model.associations || []) | ||
// .filter(([as, association]) => { | ||
// const hasOptions = Object.prototype.hasOwnProperty.call(association, 'options') | ||
// return hasOptions | ||
// }) | ||
// .map(([as, association]) => { | ||
// const associatedModel = model.sequelize.model(association.target.name) | ||
// return { | ||
// model: associatedModel, | ||
// include: CachingUtils.generateIncludeRecurse(associatedModel, depth + 1), | ||
// as | ||
// } | ||
// }) | ||
// } | ||
@@ -116,0 +137,0 @@ static getInstanceModel(instance) { |
@@ -165,4 +165,3 @@ // this class is to support caching for Class / sequelizeModel Methods: | ||
return CachingUtils.saveHashAndCountAll(cacheClient, sequelizeModel, countAndInstances, compositeKey); | ||
}); | ||
return | ||
}); | ||
} | ||
@@ -169,0 +168,0 @@ |
53453
1.42%970
2%