Merge pull request '5528-entry.latest-buys_fixEditBuys' (!1611) from 5528-entry.latest-buys_fixEditBuys into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1611 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
2d21da1faa
|
@ -75,7 +75,7 @@ module.exports = Self => {
|
||||||
value[field] = newValue;
|
value[field] = newValue;
|
||||||
|
|
||||||
if (filter) {
|
if (filter) {
|
||||||
ctx.args.filter = {where: filter, limit: null};
|
ctx.args = {where: filter, limit: null};
|
||||||
lines = await models.Buy.latestBuysFilter(ctx, null, myOptions);
|
lines = await models.Buy.latestBuysFilter(ctx, null, myOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,36 @@ describe('Buy editLatestsBuys()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filter = {'i.typeFk': 1};
|
const filter = {'categoryFk': 1, 'tags': []};
|
||||||
|
const ctx = {
|
||||||
|
args: {
|
||||||
|
filter: filter
|
||||||
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
|
};
|
||||||
|
|
||||||
|
const field = 'size';
|
||||||
|
const newValue = 88;
|
||||||
|
|
||||||
|
await models.Buy.editLatestBuys(ctx, field, newValue, null, filter, options);
|
||||||
|
|
||||||
|
const [result] = await models.Buy.latestBuysFilter(ctx, null, options);
|
||||||
|
|
||||||
|
expect(result[field]).toEqual(newValue);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should change the value of a given column for filter tags', async() => {
|
||||||
|
const tx = await models.Buy.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const filter = {'tags': [{tagFk: 1, value: 'Brown'}]};
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
filter: filter
|
filter: filter
|
||||||
|
|
Loading…
Reference in New Issue