@infrab4a/connect 4.27.0-beta.0 → 4.27.0

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
@@ -6028,6 +6028,18 @@ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withH
6028
6028
  },
6029
6029
  });
6030
6030
  }
6031
+ async removeProductFromCategories(productId, categoryIds) {
6032
+ await this.mutation('delete_category_product', ['affected_rows'], {
6033
+ where: {
6034
+ type: 'category_product_bool_exp',
6035
+ required: true,
6036
+ value: {
6037
+ product_id: { _eq: productId },
6038
+ category_id: { _in: categoryIds },
6039
+ },
6040
+ },
6041
+ });
6042
+ }
6031
6043
  async addProductsToCategory(categoryId, productIds) {
6032
6044
  await this.mutation('insert_category_product', ['affected_rows'], {
6033
6045
  objects: {
@@ -6041,6 +6053,19 @@ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withH
6041
6053
  },
6042
6054
  });
6043
6055
  }
6056
+ async addProductToCategories(productId, categoryIds) {
6057
+ await this.mutation('insert_category_product', ['affected_rows'], {
6058
+ objects: {
6059
+ type: '[category_product_insert_input!]',
6060
+ required: true,
6061
+ value: categoryIds.map((categoryId) => ({
6062
+ category_id: categoryId,
6063
+ product_id: productId,
6064
+ order: 0,
6065
+ })),
6066
+ },
6067
+ });
6068
+ }
6044
6069
  }
6045
6070
 
6046
6071
  class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
package/index.esm.js CHANGED
@@ -6003,6 +6003,18 @@ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withH
6003
6003
  },
6004
6004
  });
6005
6005
  }
6006
+ async removeProductFromCategories(productId, categoryIds) {
6007
+ await this.mutation('delete_category_product', ['affected_rows'], {
6008
+ where: {
6009
+ type: 'category_product_bool_exp',
6010
+ required: true,
6011
+ value: {
6012
+ product_id: { _eq: productId },
6013
+ category_id: { _in: categoryIds },
6014
+ },
6015
+ },
6016
+ });
6017
+ }
6006
6018
  async addProductsToCategory(categoryId, productIds) {
6007
6019
  await this.mutation('insert_category_product', ['affected_rows'], {
6008
6020
  objects: {
@@ -6016,6 +6028,19 @@ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withH
6016
6028
  },
6017
6029
  });
6018
6030
  }
6031
+ async addProductToCategories(productId, categoryIds) {
6032
+ await this.mutation('insert_category_product', ['affected_rows'], {
6033
+ objects: {
6034
+ type: '[category_product_insert_input!]',
6035
+ required: true,
6036
+ value: categoryIds.map((categoryId) => ({
6037
+ category_id: categoryId,
6038
+ product_id: productId,
6039
+ order: 0,
6040
+ })),
6041
+ },
6042
+ });
6043
+ }
6019
6044
  }
6020
6045
 
6021
6046
  class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.27.0-beta.0",
3
+ "version": "4.27.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -2,8 +2,10 @@ import { CrudRepository } from '../../generic/repository/crud.repository';
2
2
  import { CategoryProduct } from '../models';
3
3
  export interface CategoryProductRepository extends CrudRepository<CategoryProduct> {
4
4
  removeProductsFromCategory(categoryId: string, productIds: string[]): Promise<void>;
5
+ removeProductFromCategories(productId: string, categoryIds: string[]): Promise<void>;
5
6
  addProductsToCategory(categoryId: string, productIds: {
6
7
  productId: string;
7
8
  order: number;
8
9
  }[]): Promise<void>;
10
+ addProductToCategories(productId: string, categoryIds: string[]): Promise<void>;
9
11
  }
@@ -6,9 +6,11 @@ declare const CategoryProductHasuraGraphQLRepository_base: import("../../../../u
6
6
  export declare class CategoryProductHasuraGraphQLRepository extends CategoryProductHasuraGraphQLRepository_base implements CategoryProductRepository {
7
7
  constructor({ endpoint, authOptions, interceptors, cache, }: Pick<HasuraConstructorParams<CategoryProduct>, 'endpoint' | 'authOptions' | 'interceptors' | 'cache'>);
8
8
  removeProductsFromCategory(categoryId: string, productIds: string[]): Promise<void>;
9
+ removeProductFromCategories(productId: string, categoryIds: string[]): Promise<void>;
9
10
  addProductsToCategory(categoryId: string, productIds: {
10
11
  productId: string;
11
12
  order: number;
12
13
  }[]): Promise<void>;
14
+ addProductToCategories(productId: string, categoryIds: string[]): Promise<void>;
13
15
  }
14
16
  export {};