refs #6641 fix PR changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
jcasado 2024-04-10 13:16:41 +02:00
parent 26c74a3e71
commit 7d925bac87
3 changed files with 17 additions and 17 deletions

View File

@ -3747,6 +3747,6 @@ INSERT INTO `vn`.`supplierDms`(`supplierFk`, `dmsFk`, `editorFk`)
VALUES
(1, 10, 9);
INSERT INTO vn.workerTeam
(id, team, workerFk)
VALUES(8, 1, 19);
INSERT INTO vn.workerTeam(id, team, workerFk)
VALUES
(8, 1, 19);

View File

@ -4,15 +4,10 @@ const buildFilter = require('vn-loopback/util/filter').buildFilter;
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
module.exports = Self => {
Self.remoteMethod('filter', {
Self.remoteMethodCtx('filter', {
description: 'Find all instances of the model matched by filter from the data source.',
accessType: 'READ',
accepts: [
{
arg: 'ctx',
type: 'object',
http: {source: 'context'}
},
{
arg: 'filter',
type: 'object',

View File

@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
const models = require('vn-loopback/server/server').models;
describe('claim filter()', () => {
fdescribe('claim filter()', () => {
let ctx;
beforeEach(() => {
ctx = {
@ -18,7 +18,8 @@ describe('claim filter()', () => {
try {
const options = {transaction: tx};
const result = await app.models.Claim.filter({...ctx, args: {filter: {}, search: 1}}, null, options);
ctx.args = {search: 1};
const result = await app.models.Claim.filter(ctx, null, options);
expect(result.length).toEqual(1);
expect(result[0].id).toEqual(1);
@ -36,7 +37,8 @@ describe('claim filter()', () => {
try {
const options = {transaction: tx};
const result = await app.models.Claim.filter({...ctx, args: {filter: {}, search: 'Tony Stark'}}, null, options);
ctx.args = {search: 'Tony Stark'};
const result = await app.models.Claim.filter(ctx, null, options);
expect(result.length).toEqual(1);
expect(result[0].id).toEqual(4);
@ -54,7 +56,8 @@ describe('claim filter()', () => {
try {
const options = {transaction: tx};
const result = await app.models.Claim.filter({...ctx, args: {filter: {}, workerFk: 18}}, null, options);
ctx.args = {workerFk: 18};
const result = await app.models.Claim.filter(ctx, null, options);
expect(result.length).toEqual(4);
expect(result[0].id).toEqual(1);
@ -75,7 +78,8 @@ describe('claim filter()', () => {
try {
const options = {transaction: tx};
const result = await app.models.Claim.filter({...ctx, args: {filter: {}, itemFk: 2}}, null, options);
ctx.args = {itemFk: 2};
const result = await app.models.Claim.filter(ctx, null, options);
expect(result.length).toEqual(3);
expect(result[0].id).toEqual(1);
@ -95,7 +99,8 @@ describe('claim filter()', () => {
try {
const options = {transaction: tx};
const result = await app.models.Claim.filter({...ctx, args: {filter: {}, claimResponsibleFk: 7}}, null, options);
ctx.args = {claimResponsibleFk: 7};
const result = await app.models.Claim.filter(ctx, null, options);
expect(result.length).toEqual(3);
expect(result[0].id).toEqual(2);
@ -115,8 +120,8 @@ describe('claim filter()', () => {
try {
const options = {transaction: tx};
const filter = {};
const result = await models.Claim.filter({...ctx, args: {filter: {}, itemFk: null, myTeam: true}}, filter, options);
ctx.args = {itemFk: null, myTeam: true};
const result = await app.models.Claim.filter(ctx, null, options);
expect(result.length).toEqual(2);