@infrab4a/connect 4.3.9-beta.11 → 4.3.9-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -4114,9 +4114,7 @@ const withFindHasuraGraphQL = (MixinBase) => {
4114
4114
  ...acc,
4115
4115
  {
4116
4116
  [AttributeOptionHelper.FindByAttribute(current, fields)
4117
- .columnName]: orderBy[current] === 'asc'
4118
- ? 'asc_nulls_last'
4119
- : 'desc_nulls_last',
4117
+ .columnName]: orderBy[current],
4120
4118
  },
4121
4119
  ], []);
4122
4120
  this.bindAggretageAttributes = (aggregates, fields) => {
@@ -5177,10 +5175,12 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5177
5175
  ], []);
5178
5176
  }
5179
5177
  async findCatalog(params, mainGender) {
5180
- return this.find(Object.assign(Object.assign({}, params), { filters: Object.assign(Object.assign({}, params.filters), { published: true, gender: mainGender, stock: {
5181
- quantity: { operator: exports.Where.GT, value: 0 },
5182
- } }), orderBy: Object.assign({}, lodash.omit(params.orderBy, ['hasStock', 'intGender'])) }));
5183
- // se a busca retornar menos que 24, faz consulta pelos sem estoque ou gender diferente
5178
+ return this.find(Object.assign(Object.assign({}, params), { filters: Object.assign(Object.assign({}, params.filters), { published: true }), orderBy: Object.assign(Object.assign({ hasStock: 'desc' }, (!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' })), lodash.omit(params.orderBy, ['hasStock', 'intGender'])) }));
5179
+ // order by stock tbm maior menor
5180
+ // sempre duas condições
5181
+ // verificar se tem empate
5182
+ // null tá aparecendo primeiro no melhor rating
5183
+ // testear com desc null last e verificar empate
5184
5184
  }
5185
5185
  async updateCategories(productId, { categories }) {
5186
5186
  if ('action' in categories && categories.action === 'remove') {
package/index.esm.js CHANGED
@@ -4090,9 +4090,7 @@ const withFindHasuraGraphQL = (MixinBase) => {
4090
4090
  ...acc,
4091
4091
  {
4092
4092
  [AttributeOptionHelper.FindByAttribute(current, fields)
4093
- .columnName]: orderBy[current] === 'asc'
4094
- ? 'asc_nulls_last'
4095
- : 'desc_nulls_last',
4093
+ .columnName]: orderBy[current],
4096
4094
  },
4097
4095
  ], []);
4098
4096
  this.bindAggretageAttributes = (aggregates, fields) => {
@@ -5153,10 +5151,12 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5153
5151
  ], []);
5154
5152
  }
5155
5153
  async findCatalog(params, mainGender) {
5156
- return this.find(Object.assign(Object.assign({}, params), { filters: Object.assign(Object.assign({}, params.filters), { published: true, gender: mainGender, stock: {
5157
- quantity: { operator: Where.GT, value: 0 },
5158
- } }), orderBy: Object.assign({}, omit(params.orderBy, ['hasStock', 'intGender'])) }));
5159
- // se a busca retornar menos que 24, faz consulta pelos sem estoque ou gender diferente
5154
+ return this.find(Object.assign(Object.assign({}, params), { filters: Object.assign(Object.assign({}, params.filters), { published: true }), orderBy: Object.assign(Object.assign({ hasStock: 'desc' }, (!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' })), omit(params.orderBy, ['hasStock', 'intGender'])) }));
5155
+ // order by stock tbm maior menor
5156
+ // sempre duas condições
5157
+ // verificar se tem empate
5158
+ // null tá aparecendo primeiro no melhor rating
5159
+ // testear com desc null last e verificar empate
5160
5160
  }
5161
5161
  async updateCategories(productId, { categories }) {
5162
5162
  if ('action' in categories && categories.action === 'remove') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.3.9-beta.11",
3
+ "version": "4.3.9-beta.13",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -1,5 +1,5 @@
1
1
  import { NonFunctionAndIdentifierPropertyNames } from '../../model/types/non-function-property-name.type';
2
2
  export type RepositoryOrderBy<Model> = {
3
- [key in NonFunctionAndIdentifierPropertyNames<Model>]?: 'asc' | 'desc';
3
+ [key in NonFunctionAndIdentifierPropertyNames<Model>]?: 'asc' | 'desc' | 'desc_nulls_last' | 'asc_nulls_last';
4
4
  };
5
5
  export type RepositoryOrderByList<Model> = RepositoryOrderBy<Model>[];