mirror of
https://github.com/strapi/strapi.git
synced 2025-09-01 21:03:02 +00:00
Merge pull request #3209 from strapi/fix/filter-timestamp
Fix filters on timestamp attributes
This commit is contained in:
commit
c099c33d94
@ -834,6 +834,9 @@ module.exports = function(strapi) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save all attributes (with timestamps)
|
||||||
|
target[model].allAttributes = _.clone(definition.attributes);
|
||||||
|
|
||||||
// Equilize tables
|
// Equilize tables
|
||||||
if (connection.options && connection.options.autoMigration !== false) {
|
if (connection.options && connection.options.autoMigration !== false) {
|
||||||
await handler(loadedModel.tableName, definition.attributes);
|
await handler(loadedModel.tableName, definition.attributes);
|
||||||
|
@ -303,6 +303,9 @@ module.exports = function(strapi) {
|
|||||||
_.get(definition, 'options.minimize', false) === true
|
_.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 = {
|
collection.schema.options.toObject = collection.schema.options.toJSON = {
|
||||||
virtuals: true,
|
virtuals: true,
|
||||||
transform: function(doc, returned, opts) {
|
transform: function(doc, returned, opts) {
|
||||||
|
@ -5,7 +5,7 @@ const findModelByAssoc = assoc => {
|
|||||||
return models[assoc.collection || assoc.model];
|
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
|
* Returns the model, attribute name and association from a path of relation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user