Fix #3192 filter on timestamp attributes

This commit is contained in:
Jim LAURIE 2019-04-30 18:33:14 +02:00
parent 541b00041a
commit ca46db9b31
3 changed files with 7 additions and 1 deletions

View File

@ -834,6 +834,9 @@ module.exports = function(strapi) {
};
}
// Save all attributes (with timestamps)
target[model].allAttributes = _.clone(definition.attributes);
// Equilize tables
if (connection.options && connection.options.autoMigration !== false) {
await handler(loadedModel.tableName, definition.attributes);

View File

@ -303,6 +303,9 @@ module.exports = function(strapi) {
_.get(definition, 'options.minimize', false) === true
);
// Save all attributes (with timestamps)
target[model].allAttributes = _.clone(definition.attributes);
collection.schema.options.toObject = collection.schema.options.toJSON = {
virtuals: true,
transform: function(doc, returned, opts) {

View File

@ -5,7 +5,7 @@ const findModelByAssoc = assoc => {
return models[assoc.collection || assoc.model];
};
const isAttribute = (model, field) => _.has(model.attributes, field) || model.primaryKey === field;
const isAttribute = (model, field) => _.has(model.allAttributes, field) || model.primaryKey === field;
/**
* Returns the model, attribute name and association from a path of relation