Skip to content
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

JTR-116-fieldtypes #9

Merged
merged 4 commits into from
Jun 23, 2020
Merged

JTR-116-fieldtypes #9

merged 4 commits into from
Jun 23, 2020

Conversation

Nataniel4
Copy link
Contributor

LINK AL TICKET
https://fizzmod.atlassian.net/browse/JTR-116

DESCRIPCIÓN DEL REQUERIMIENTO

  • Agregar la posibilidad de crear tipos de campo con el paquete Solr para permitir la posibilidad de usar campos personalizados de Solr.
  • Corregir el metodo ping() para arrojar un error en caso de falla.

DESCRIPCIÓN DE LA SOLUCIÓN
Se realizaron los cambios solicitados

@@ -62,6 +56,45 @@ class Schema {
return schema.filter(({ name }) => !IGNORED_FIELDS.includes(name));
}

static _buildFieldTypesQuery(fieldTypes, currentFieldTypes) {

fieldTypes = this._buildFieldTypes(fieldTypes);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • fieldTypes siempre llega?, siempre llega como objeto ?

Pregunto, porque no veo validación y como usas propiedades de Object.prototype como entries y por ahi si no llega bien ese dato se puede llegar a romper

Copy link

@gastonpereyra gastonpereyra Jun 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lo mismo para currentFieldTypes, pero con array

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Ya vi que llegan siempre con el formato, correcto. Asi qu esta bien esta parte

const fieldsToAdd = this._difference(schema, currentSchemas);

const fieldsToReplace = this._difference(schema, fieldsToAdd)
.filter(field => !currentSchemas.some(currentField => this._areEqualObjects(currentField, field)));
Copy link

@gastonpereyra gastonpereyra Jun 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵️

Es lo mismo, escrito diferente, pero talvés agrega claridad a quien lo vaya a leer a futuro.

Que te parece ?

Suggested change
.filter(field => !currentSchemas.some(currentField => this._areEqualObjects(currentField, field)));
.filter(field => currentSchemas.every(currentField => !this._areEqualObjects(currentField, field)));

lib/solr.js Outdated
Comment on lines 450 to 460
let res;

try {

const res = await this.request.get(endpoint);
res = await this.request.get(endpoint);

} catch(err) {
throw err;
}

try {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El try/catch esta de más si no haces ningún proceso con eso

Sugiero :

const res = await this.request.get(endpoint);

Si request.get falla, va a throwear como esta pasando ahora

Copy link

@gastonpereyra gastonpereyra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aprobado!

@juanhapes juanhapes merged commit 36ef50a into master Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants