asv-hlps 1.4.69 → 1.4.71

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.
@@ -1,6 +1,6 @@
1
1
  import Product from "../../products/models/Product";
2
2
  declare class StockPipe {
3
- transform(tob: Product, param: "valueInDepots" | "store" | "salable" | "reserve" | "all"): number;
3
+ transform(tob: Product, param: "valueInDepots" | "store" | "salable" | "reserve" | "all", stores?: string[]): number;
4
4
  }
5
5
  declare const _default: StockPipe;
6
6
  export default _default;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const hlpProduct_1 = __importDefault(require("../../products/hlpProduct"));
7
7
  class StockPipe {
8
- transform(tob, param) {
8
+ transform(tob, param, stores = ["cpaa"]) {
9
9
  // const storeName = (environment.host === 'cpa') ? 'eqeer' : 'cpa'
10
10
  switch (param) {
11
11
  case "valueInDepots":
@@ -15,7 +15,7 @@ class StockPipe {
15
15
  case "salable":
16
16
  return hlpProduct_1.default.getStockSalable(tob);
17
17
  case "reserve":
18
- return hlpProduct_1.default.qtityInAllDepotsExeptStore(tob === null || tob === void 0 ? void 0 : tob.ins, ["cpa"]) || 0;
18
+ return hlpProduct_1.default.qtityInAllDepotsExeptStore(tob === null || tob === void 0 ? void 0 : tob.ins, stores) || 0;
19
19
  case "all":
20
20
  return hlpProduct_1.default.qtityInAllDepots(tob === null || tob === void 0 ? void 0 : tob.ins) || 0;
21
21
  }
@@ -2,7 +2,7 @@ import { Entity } from "typeorm";
2
2
  export declare class HlpCrud {
3
3
  dataSource: any;
4
4
  constructor(dataSource: any);
5
- checkUniqProp(prop: string, model: any, body: any, bodyName: string): Promise<boolean>;
5
+ checkUniqProp(prop: string, model: any, body: any, bodyName?: string): Promise<boolean>;
6
6
  toggleProp(id: number, prop: string, model: typeof Entity | any): Promise<any>;
7
7
  create(tob: any, model: typeof Entity | any): any;
8
8
  del(id: number, model: typeof Entity | any): any;
@@ -15,8 +15,8 @@ class HlpCrud {
15
15
  constructor(dataSource) {
16
16
  this.dataSource = dataSource;
17
17
  }
18
- checkUniqProp(prop, model, body, bodyName) {
19
- return __awaiter(this, void 0, void 0, function* () {
18
+ checkUniqProp(prop_1, model_1, body_1) {
19
+ return __awaiter(this, arguments, void 0, function* (prop, model, body, bodyName = "name") {
20
20
  try {
21
21
  const obj = yield this.dataSource.manager.findOneBy(model, { [prop]: body[bodyName] });
22
22
  // ------ no obj ------
@@ -1,6 +1,6 @@
1
1
  import Product from "../../products/models/Product";
2
2
  declare class StockPipe {
3
- transform(tob: Product, param: "valueInDepots" | "store" | "salable" | "reserve" | "all"): number;
3
+ transform(tob: Product, param: "valueInDepots" | "store" | "salable" | "reserve" | "all", stores?: string[]): number;
4
4
  }
5
5
  declare const _default: StockPipe;
6
6
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import HlpProduct from "../../products/hlpProduct";
2
2
  class StockPipe {
3
- transform(tob, param) {
3
+ transform(tob, param, stores = ["cpaa"]) {
4
4
  // const storeName = (environment.host === 'cpa') ? 'eqeer' : 'cpa'
5
5
  switch (param) {
6
6
  case "valueInDepots":
@@ -10,7 +10,7 @@ class StockPipe {
10
10
  case "salable":
11
11
  return HlpProduct.getStockSalable(tob);
12
12
  case "reserve":
13
- return HlpProduct.qtityInAllDepotsExeptStore(tob === null || tob === void 0 ? void 0 : tob.ins, ["cpa"]) || 0;
13
+ return HlpProduct.qtityInAllDepotsExeptStore(tob === null || tob === void 0 ? void 0 : tob.ins, stores) || 0;
14
14
  case "all":
15
15
  return HlpProduct.qtityInAllDepots(tob === null || tob === void 0 ? void 0 : tob.ins) || 0;
16
16
  }
@@ -2,7 +2,7 @@ import { Entity } from "typeorm";
2
2
  export declare class HlpCrud {
3
3
  dataSource: any;
4
4
  constructor(dataSource: any);
5
- checkUniqProp(prop: string, model: any, body: any, bodyName: string): Promise<boolean>;
5
+ checkUniqProp(prop: string, model: any, body: any, bodyName?: string): Promise<boolean>;
6
6
  toggleProp(id: number, prop: string, model: typeof Entity | any): Promise<any>;
7
7
  create(tob: any, model: typeof Entity | any): any;
8
8
  del(id: number, model: typeof Entity | any): any;
@@ -12,8 +12,8 @@ export class HlpCrud {
12
12
  constructor(dataSource) {
13
13
  this.dataSource = dataSource;
14
14
  }
15
- checkUniqProp(prop, model, body, bodyName) {
16
- return __awaiter(this, void 0, void 0, function* () {
15
+ checkUniqProp(prop_1, model_1, body_1) {
16
+ return __awaiter(this, arguments, void 0, function* (prop, model, body, bodyName = "name") {
17
17
  try {
18
18
  const obj = yield this.dataSource.manager.findOneBy(model, { [prop]: body[bodyName] });
19
19
  // ------ no obj ------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.4.69",
3
+ "version": "1.4.71",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",