refactor: refs #7950 Created cmr model #3180

Merged
guillermo merged 6 commits from 7950-cmrModelUnify into dev 2024-11-15 06:07:17 +00:00
Member
No description provided.
guillermo added 1 commit 2024-11-12 07:25:45 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
90e7ab1ec1
refactor: refs #7950 Created cmr model
guillermo requested review from jgallego 2024-11-12 07:28:33 +00:00
jgallego requested changes 2024-11-12 08:13:52 +00:00
Dismissed
@ -55,3 +55,2 @@
ctx.args.id = ticket.cmrFk;
const response = await models.Route.cmr(ctx, myOptions);
ctx.args.id = ticket.$cmrFk;
Owner

el $ no el solem gastar, si no te un objectiu clar jo meu pensaria be antes de gastarlo, @alexm com ho veus ?

el $ no el solem gastar, si no te un objectiu clar jo meu pensaria be antes de gastarlo, @alexm com ho veus ?
Author
Member

El problema es que ara com es un model, te que accedir de una altra forma, ticket.cmrFk ja no val.

Es pot gastar ticket.cmrFk().id, pero ticket.$cmrFk es mes curt

El problema es que ara com es un model, te que accedir de una altra forma, ticket.cmrFk ja no val. Es pot gastar ticket.cmrFk().id, pero ticket.$cmrFk es mes curt
Member

Mai havia vist ticket.$cmrFk si funciona i es natiu de loopback supose que abant

Mai havia vist ticket.$cmrFk si funciona i es natiu de loopback supose que abant
jgallego marked this conversation as resolved
guillermo requested review from jgallego 2024-11-12 09:11:53 +00:00
jgallego requested changes 2024-11-12 12:19:00 +00:00
Dismissed
@ -56,2 +56,2 @@
ctx.args.id = ticket.cmrFk;
const response = await models.Route.cmr(ctx, myOptions);
ctx.args.id = ticket.$cmrFk;
const response = await models.Cmr.print(ctx, myOptions);
Owner

ho he comentat en Juan i m'ha dit lo mateix, que si es natiu de loopback avant.
Pero que l'objecte ctx no hi ha que alterarlo.

ho he comentat en Juan i m'ha dit lo mateix, que si es natiu de loopback avant. **Pero** que l'objecte ctx no hi ha que alterarlo.
Author
Member

Entonces com li pase el id? Es que es un param que va per URL, crec que en el seu moment no vaig trovar altra forma...

Entonces com li pase el id? Es que es un param que va per URL, crec que en el seu moment no vaig trovar altra forma...
Member

En este cas seria await models.Cmr.print(ctx, ticket.$cmrFk);
Son els parametres que te el back 90e7ab1ec1/modules/route/back/methods/cmr/print.js (L36)

En este cas seria `await models.Cmr.print(ctx, ticket.$cmrFk); ` Son els parametres que te el back https://gitea.verdnatura.es/verdnatura/salix/src/commit/90e7ab1ec1d18366c7b1a394ddfaa03e90c01d52/modules/route/back/methods/cmr/print.js#L36
Author
Member

Ya lo comprobé en su momento y no pude, lo he vuelto a comprobar por si acaso y lo mismo:

const response = await models.Cmr.print(ctx, ticket.$cmrFk, myOptions);

1) ticket saveCmr() should save cmr
  - Error: Required properties not found [id]
Ya lo comprobé en su momento y no pude, lo he vuelto a comprobar por si acaso y lo mismo: const response = await models.Cmr.print(ctx, ticket.$cmrFk, myOptions); ``` 1) ticket saveCmr() should save cmr - Error: Required properties not found [id] ```
Member

Se pot posar en 6ab431f8ef/loopback/common/methods/vn-model/printService.js (L5)

const args = Object.assign({id}, ctx.args);

Se pot posar en https://gitea.verdnatura.es/verdnatura/salix/src/commit/6ab431f8efec6e80495451332064c6eeb8b6684f/loopback/common/methods/vn-model/printService.js#L5 `const args = Object.assign({id}, ctx.args);`
Owner

Cuidao @guillermo el assign tal com l'has posat actualiza l'objecte ctx, que es el que no volem.
Amb la proposata d'Alex es crea uno nou, gasta ixa opcio.

Cuidao @guillermo el assign tal com l'has posat actualiza l'objecte ctx, que es el que no volem. Amb la proposata d'Alex es crea uno nou, gasta ixa opcio.
guillermo marked this conversation as resolved
guillermo added 1 commit 2024-11-12 12:25:13 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
6427a90c44
Merge branch 'dev' into 7950-cmrModelUnify
guillermo added 1 commit 2024-11-12 13:54:15 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
3c8ef7cdba
refactor: refs #7950 Requested changes
guillermo requested review from jgallego 2024-11-12 13:54:24 +00:00
jgallego requested changes 2024-11-14 06:46:09 +00:00
Dismissed
jgallego left a comment
Owner

hi ha un comentari nou

hi ha un comentari nou
guillermo requested review from jgallego 2024-11-14 06:57:19 +00:00
guillermo added 1 commit 2024-11-14 06:57:20 +00:00
gitea/salix/pipeline/pr-dev Build queued... Details
9c0af7f7c6
refactor: refs #7950 Requested changes
guillermo added 1 commit 2024-11-14 06:57:29 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
97e53b2ef8
Merge branch 'dev' into 7950-cmrModelUnify
jgallego requested changes 2024-11-14 07:55:56 +00:00
Dismissed
@ -3,3 +3,3 @@
module.exports = Self => {
Self.printReport = async function(ctx, id, reportName) {
const args = Object.assign({}, ctx.args);
const args = Object.assign({id}, ctx.args);
Owner

bajar el id a params.

bajar el id a params.
Author
Member

He revisado el código, y habiamos visto printEmail, en printReport no se hace.
Por lo que el cambio es correcto.

Además, he probado a poner params.id = id; y da error, ya que no es lo mismo.

He revisado el código, y habiamos visto printEmail, en printReport no se hace. Por lo que el cambio es correcto. Además, he probado a poner `params.id = id;` y da error, ya que no es lo mismo.
guillermo marked this conversation as resolved
guillermo requested review from jgallego 2024-11-14 08:50:12 +00:00
jgallego approved these changes 2024-11-14 15:27:42 +00:00
guillermo added 1 commit 2024-11-15 06:03:38 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
d1c528c8fd
Merge branch 'dev' into 7950-cmrModelUnify
guillermo merged commit 96b85701d8 into dev 2024-11-15 06:07:17 +00:00
guillermo deleted branch 7950-cmrModelUnify 2024-11-15 06:07:17 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: verdnatura/salix#3180
No description provided.