-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JCN-373-campos-opcionales #9
Conversation
lib/helpers/client-formatter.js
Outdated
if(!additionalFields) | ||
return formattedClient; | ||
|
||
additionalFields.forEach(field => { | ||
|
||
if(client[field]) | ||
formattedClient[field] = client[field]; | ||
}); | ||
|
||
return formattedClient; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(!additionalFields) | |
return formattedClient; | |
additionalFields.forEach(field => { | |
if(client[field]) | |
formattedClient[field] = client[field]; | |
}); | |
return formattedClient; | |
if(additionalFields) { | |
additionalFields.forEach(field => { | |
if(client[field]) | |
formattedClient[field] = client[field]; | |
}); | |
} | |
return formattedClient; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comentarios chicos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dejé unos ajustes chiquitos para hacer..
additionalFields.forEach(field => { | ||
|
||
if(client[field]) | ||
formattedClient[field] = client[field]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ojo, si el campo en el cliente tiene un valor falsy (más que nada 0
o false
) no los está guardando. Debería chequear algo como typeof client[field] !== 'undefined'
o algo parecido..
Agreguemos estos casos en los tests para asegurarnos que no se rompa en una próxima versión!
lib/listener-updated.js
Outdated
|
||
ClientModel.additionalFields.forEach(fieldName => { | ||
|
||
if(updatedClient[fieldName]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acá está el mismo problema con los valores falsy..
lib/model-client.js
Outdated
static async formatForCreate(clientCodes) { | ||
/** | ||
* Get additional fields | ||
* @returns {undefined} returns undefined by default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @returns {undefined} returns undefined by default | |
* @returns {string[]|undefined} returns undefined by default |
LINK AL TICKET
https://fizzmod.atlassian.net/browse/JCN-373
LINK A LA HISTORIA
https://fizzmod.atlassian.net/browse/JCN-372
DESCRIPCIÓN DEL REQUERIMIENTO
Se necesita que se puedan guardar (es decir crear o actualizar) datos extras propios del Cliente en JID.
Esto se debe hacer para que funcione en:
Logicamente actualizar el README con la nueva caracteristicas 😌
DESCRIPCIÓN DE LA SOLUCIÓN
postSaveHook
ya que puede ser util en futuros desarrollos.