fix: refs #7524 backSuppliersPackaging
gitea/salix/pipeline/pr-master There was a failure building this commit
Details
gitea/salix/pipeline/pr-master There was a failure building this commit
Details
This commit is contained in:
parent
52e8bac168
commit
e90d48c777
|
@ -15,12 +15,17 @@ module.exports = Self => {
|
||||||
Self.getWithPackaging = async options => {
|
Self.getWithPackaging = async options => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
const oneYearAgo = new Date();
|
||||||
|
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const entries = await models.Entry.find({
|
const entries = await models.Entry.find({
|
||||||
where: {typeFk: 'packaging'},
|
where: {
|
||||||
|
typeFk: 'packaging',
|
||||||
|
created: {gte: oneYearAgo}
|
||||||
|
},
|
||||||
include: {
|
include: {
|
||||||
relation: 'supplier',
|
relation: 'supplier',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -18,6 +18,7 @@ describe('Supplier getWithPackaging()', () => {
|
||||||
|
|
||||||
await entry.updateAttributes({
|
await entry.updateAttributes({
|
||||||
typeFk: typeFk,
|
typeFk: typeFk,
|
||||||
|
created: new Date()
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await models.Supplier.getWithPackaging(myOptions);
|
const result = await models.Supplier.getWithPackaging(myOptions);
|
||||||
|
|
Loading…
Reference in New Issue