refs #6641 add button my team #2254

Merged
jcasado merged 7 commits from 6641-checkboxMyTeam into dev 2024-04-15 08:11:37 +00:00
3 changed files with 17 additions and 17 deletions
Showing only changes of commit 7d925bac87 - Show all commits

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)
jcasado marked this conversation as resolved Outdated
Outdated
Review

Por seguir la convencion de SQL, añadir tabulaciones

Por seguir la convencion de SQL, añadir tabulaciones
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', {
jcasado marked this conversation as resolved Outdated
Outdated
Review

Pq se quita remoteMethodCtx y se pone?

	            {
                arg: 'ctx',
                type: 'object',
                http: {source: 'context'}
            },
Pq se quita remoteMethod**Ctx** y se pone? ``` { arg: 'ctx', type: 'object', http: {source: 'context'} }, ```
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};
jcasado marked this conversation as resolved Outdated
Outdated
Review

Veo mas como y legible poner en la linea de antes ctx.args = {search: 1}
Y luego usar directamente .. models.Claim.filter(ctx, null, options);

Igual en los otros casos

Veo mas como y legible poner en la linea de antes `ctx.args = {search: 1}` Y luego usar directamente `.. models.Claim.filter(ctx, null, options);` Igual en los otros casos
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);