aws-service-stack 0.18.308 → 0.18.311
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/dist/_examples/controller/commission/commission.config.d.ts +1 -1
- package/dist/_examples/controller/commission/commission.config.js +3 -3
- package/dist/_examples/controller/commission/commission.config.js.map +1 -1
- package/dist/_examples/controller/supplier/supplier-config.js +0 -1
- package/dist/_examples/controller/supplier/supplier-config.js.map +1 -1
- package/dist/_examples/controller/supplier/supplier-controller-api.d.ts +2 -2
- package/dist/_examples/controller/supplier/supplier-controller-api.js +4 -6
- package/dist/_examples/controller/supplier/supplier-controller-api.js.map +1 -1
- package/dist/_examples/model-shared/supplier-portal.model.d.ts +1 -10
- package/dist/_examples/model-shared/supplier-portal.model.js.map +1 -1
- package/dist/_examples/repositories/supplier/supplier-repo-db.d.ts +2 -2
- package/dist/_examples/repositories/supplier/supplier-repo-db.interface.d.ts +2 -2
- package/dist/_examples/repositories/supplier/supplier-repo-db.interface.js.map +1 -1
- package/dist/_examples/repositories/supplier/supplier-repo-db.js.map +1 -1
- package/dist/_examples/repositories/supplier/supplier-repo-es.d.ts +2 -2
- package/dist/_examples/repositories/supplier/supplier-repo-es.interface.d.ts +2 -2
- package/dist/_examples/repositories/supplier/supplier-repo-es.interface.js.map +1 -1
- package/dist/_examples/repositories/supplier/supplier-repo-es.js.map +1 -1
- package/dist/_examples/service/commission/commission-service.js +2 -0
- package/dist/_examples/service/commission/commission-service.js.map +1 -1
- package/dist/_examples/service/rorder/rorder-service.interface.d.ts +2 -1
- package/dist/_examples/service/rorder/rorder-service.interface.js.map +1 -1
- package/dist/_examples/service/supplier/supplier-service-crud.d.ts +17 -6
- package/dist/_examples/service/supplier/supplier-service-crud.interface.d.ts +12 -5
- package/dist/_examples/service/supplier/supplier-service-crud.interface.js.map +1 -1
- package/dist/_examples/service/supplier/supplier-service-crud.js +61 -76
- package/dist/_examples/service/supplier/supplier-service-crud.js.map +1 -1
- package/dist/_examples/service/supplier/supplier-service-stream.d.ts +5 -5
- package/dist/_examples/service/supplier/supplier-service-stream.interface.d.ts +2 -2
- package/dist/_examples/service/supplier/supplier-service-stream.interface.js.map +1 -1
- package/dist/_examples/service/supplier/supplier-service-stream.js.map +1 -1
- package/dist/model/filter.model.d.ts +1 -0
- package/dist/model/filter.model.js.map +1 -1
- package/dist/service/base.service.d.ts +1 -1
- package/dist/service/base.service.js +6 -0
- package/dist/service/base.service.js.map +1 -1
- package/dist/service/crud.service.js +2 -0
- package/dist/service/crud.service.js.map +1 -1
- package/dist/utils/opensearch.utils.d.ts +2 -0
- package/dist/utils/opensearch.utils.js +93 -0
- package/dist/utils/opensearch.utils.js.map +1 -1
- package/dist/utils/reflection.util.js +1 -1
- package/dist/utils/reflection.util.js.map +1 -1
- package/dist/utils/validation.util.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRepoDBImpl } from "../../../index.js";
|
|
2
|
-
import { SAccount } from "../../model-shared/suppler.model-to-remove";
|
|
3
2
|
import { SupplierRepoDB } from "./supplier-repo-db.interface";
|
|
4
3
|
import "./supplier-repo-db";
|
|
5
|
-
|
|
4
|
+
import { Supplier } from "../../model-shared/supplier.model";
|
|
5
|
+
export declare class SupplierRepoDBImpl extends BaseRepoDBImpl<Supplier> implements SupplierRepoDB {
|
|
6
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BaseRepoDB } from "../../../index.js";
|
|
2
|
-
import {
|
|
3
|
-
export interface SupplierRepoDB extends BaseRepoDB<
|
|
2
|
+
import { Supplier } from "../../model-shared/supplier.model";
|
|
3
|
+
export interface SupplierRepoDB extends BaseRepoDB<Supplier> {
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier-repo-db.interface.js","sourceRoot":"","sources":["../../../../src/_examples/repositories/supplier/supplier-repo-db.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { BaseRepoDB } from \"@chinggis/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"supplier-repo-db.interface.js","sourceRoot":"","sources":["../../../../src/_examples/repositories/supplier/supplier-repo-db.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { BaseRepoDB } from \"@chinggis/core\";\nimport { Supplier } from \"../../model-shared/supplier.model\";\n\nexport interface SupplierRepoDB extends BaseRepoDB<Supplier> {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier-repo-db.js","sourceRoot":"","sources":["../../../../src/_examples/repositories/supplier/supplier-repo-db.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAAiC;AACjC,yCAAgD;
|
|
1
|
+
{"version":3,"file":"supplier-repo-db.js","sourceRoot":"","sources":["../../../../src/_examples/repositories/supplier/supplier-repo-db.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAAiC;AACjC,yCAAgD;AAEhD,8BAA4B;AAIrB,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,qBAAwB;CAA6B,CAAA;AAAhF,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,gBAAO,EAAC,gBAAgB,CAAC;GACb,kBAAkB,CAA8D","sourcesContent":["import { Service } from \"typedi\";\nimport { BaseRepoDBImpl } from \"@chinggis/core\";\nimport { SupplierRepoDB } from \"./supplier-repo-db.interface\";\nimport \"./supplier-repo-db\";\nimport { Supplier } from \"../../model-shared/supplier.model\";\n\n@Service(\"SupplierRepoDB\")\nexport class SupplierRepoDBImpl extends BaseRepoDBImpl<Supplier> implements SupplierRepoDB {}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRepoESImpl } from "../../../index.js";
|
|
2
|
-
import { SAccount } from "../../model-shared/suppler.model-to-remove";
|
|
3
2
|
import { SupplierRepoES } from "./supplier-repo-es.interface";
|
|
4
3
|
import "./supplier-repo-es";
|
|
5
|
-
|
|
4
|
+
import { Supplier } from "src/_examples/model-shared/supplier.model";
|
|
5
|
+
export declare class SupplierRepoESImpl extends BaseRepoESImpl<Supplier> implements SupplierRepoES {
|
|
6
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BaseRepoES } from "../../../index.js";
|
|
2
|
-
import {
|
|
3
|
-
export interface SupplierRepoES extends BaseRepoES<
|
|
2
|
+
import { Supplier } from "../../model-shared/supplier.model";
|
|
3
|
+
export interface SupplierRepoES extends BaseRepoES<Supplier> {
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier-repo-es.interface.js","sourceRoot":"","sources":["../../../../src/_examples/repositories/supplier/supplier-repo-es.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { BaseRepoES } from \"@chinggis/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"supplier-repo-es.interface.js","sourceRoot":"","sources":["../../../../src/_examples/repositories/supplier/supplier-repo-es.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { BaseRepoES } from \"@chinggis/core\";\nimport { Supplier } from \"../../model-shared/supplier.model\";\n\nexport interface SupplierRepoES extends BaseRepoES<Supplier> {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier-repo-es.js","sourceRoot":"","sources":["../../../../src/_examples/repositories/supplier/supplier-repo-es.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAAiC;AACjC,yCAAgD;
|
|
1
|
+
{"version":3,"file":"supplier-repo-es.js","sourceRoot":"","sources":["../../../../src/_examples/repositories/supplier/supplier-repo-es.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAAiC;AACjC,yCAAgD;AAEhD,8BAA4B;AAIrB,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,qBAAwB;CAA6B,CAAA;AAAhF,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,gBAAO,EAAC,gBAAgB,CAAC;GACb,kBAAkB,CAA8D","sourcesContent":["import { Service } from \"typedi\";\nimport { BaseRepoESImpl } from \"@chinggis/core\";\nimport { SupplierRepoES } from \"./supplier-repo-es.interface\";\nimport \"./supplier-repo-es\";\nimport { Supplier } from \"src/_examples/model-shared/supplier.model\";\n\n@Service(\"SupplierRepoES\")\nexport class SupplierRepoESImpl extends BaseRepoESImpl<Supplier> implements SupplierRepoES {}\n"]}
|
|
@@ -54,6 +54,7 @@ require("src/_examples/repositories/commission/commission-repo-db");
|
|
|
54
54
|
require("../supplier/supplier-service-crud");
|
|
55
55
|
require("../raccount/raccount-service");
|
|
56
56
|
const raccount_model_1 = require("src/_examples/model-shared/raccount.model");
|
|
57
|
+
const commission_config_1 = require("../../controller/commission/commission.config");
|
|
57
58
|
let CommissionServiceImpl = class CommissionServiceImpl extends service_1.CrudServiceImpl {
|
|
58
59
|
feePool;
|
|
59
60
|
supplierService;
|
|
@@ -64,6 +65,7 @@ let CommissionServiceImpl = class CommissionServiceImpl extends service_1.CrudSe
|
|
|
64
65
|
this.feePool = new Map();
|
|
65
66
|
this.supplierService = typedi_1.default.get("SupplierCrudService");
|
|
66
67
|
this.rAccountService = typedi_1.default.get("RAccountService");
|
|
68
|
+
this.setConfig(commission_config_1.CONFIG_COMMISSION.toObject());
|
|
67
69
|
}
|
|
68
70
|
async create(supplierUsername, retailerUsername, toRetailerPercent) {
|
|
69
71
|
const supplier = (await this.supplierService.find({ username: supplierUsername })).items[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commission-service.js","sourceRoot":"","sources":["../../../../src/_examples/service/commission/commission-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA8C;AAC9C,uEAAuD;AACvD,kDAA0B;AAC1B,iDAA4C;AAG5C,oEAAkE;AAGlE,6CAA2C;AAG3C,wCAAsC;AAGtC,8EAAqF;
|
|
1
|
+
{"version":3,"file":"commission-service.js","sourceRoot":"","sources":["../../../../src/_examples/service/commission/commission-service.ts"],"names":[],"mappings":";;;;;;;;;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AM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,KAAK,cAAc,CAAC;aAC1D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;QAE5C,OAAO,GAAG,IAAI,CAAC,CAAC;IAClB,CAAC;CACF,CAAA;AA1EY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,gBAAO,EAAC,mBAAmB,CAAC;;GAChB,qBAAqB,CA0EjC","sourcesContent":["import { CrudServiceImpl } from \"src/service\";\nimport { HTTP } from \"src/exception/exception-handler\";\nimport dayjs from \"dayjs\";\nimport Container, { Service } from \"typedi\";\n\nimport { CommissionRepoDB } from \"src/_examples/repositories/commission/commission-repo-db.interface\";\nimport \"src/_examples/repositories/commission/commission-repo-db\";\n\nimport { SupplierService } from \"../supplier/supplier-service-crud.interface\";\nimport \"../supplier/supplier-service-crud\";\n\nimport { RAccountService } from \"../raccount/raccount-service.interface\";\nimport \"../raccount/raccount-service\";\n\nimport { Commission } from \"src/_examples/model-shared/commission.model\";\nimport { ContractStatus, Retailer } from \"src/_examples/model-shared/raccount.model\";\n\nimport { CommissionService } from \"./commission-service.interface\";\nimport { CONFIG_COMMISSION } from \"../../controller/commission/commission.config\";\n\n@Service(\"CommissionService\")\nexport class CommissionServiceImpl\n extends CrudServiceImpl<Commission, CommissionRepoDB, null>\n implements CommissionService\n{\n private readonly feePool: Map<string, number>;\n private readonly supplierService: SupplierService;\n private readonly rAccountService: RAccountService;\n\n constructor() {\n const repoDB: CommissionRepoDB = Container.get(\"CommissionRepoDB\");\n super(repoDB, null);\n this.feePool = new Map<string, number>();\n\n this.supplierService = Container.get(\"SupplierCrudService\");\n this.rAccountService = Container.get(\"RAccountService\");\n\n this.setConfig(CONFIG_COMMISSION.toObject());\n }\n\n async create(supplierUsername: string, retailerUsername: string, toRetailerPercent?: number): Promise<Commission> {\n const supplier = (await this.supplierService.find({ username: supplierUsername })).items[0];\n const retailer = (await this.rAccountService.find({ username: retailerUsername })).items[0];\n\n if (retailer.contractStatus === ContractStatus.EXPIRED) {\n this.throwError(HTTP.BAD_REQUEST.code, \"Уг retailer идэвхжээгүй байна.\");\n }\n\n const existingFee = await this.find({\n supplierUsername,\n retailerUsername,\n });\n\n if (existingFee.items.length > 0) {\n this.throwError(\n HTTP.BAD_REQUEST.code,\n `Fee already exist on supplier: ${supplierUsername} and retailer: ${retailerUsername}`,\n );\n return;\n }\n\n const percentage = retailer.commission1 ?? retailer.commission2;\n\n return this.save(\n {\n supplierUsername: supplierUsername,\n retailerUsername: retailerUsername,\n toRetailerPercent: toRetailerPercent ?? percentage,\n supplier: {\n firstName: supplier.firstName + \" \" + supplier.lastName,\n username: supplier.username,\n taxPayer: supplier.taxPayer,\n },\n retailer: retailer as Retailer,\n isActive: true,\n createdMonth: dayjs(new Date()).format(\"YYYY-MM-DD\"),\n },\n retailerUsername,\n );\n }\n\n async getRetailerCommissionBySupplier(retailerRegNum: string, supplierRegNum: string): Promise<number> {\n if (!retailerRegNum || !supplierRegNum) {\n console.error(\"retailerRegNum or supplierRegNum is missing\");\n return 0;\n }\n\n const percentList = await this.findAllByIndex(\"byOwner\", supplierRegNum);\n\n const fee = percentList\n .filter((item) => item.retailerUsername === retailerRegNum)\n .map((item) => item.toRetailerPercent)[0];\n\n return fee || 0;\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CrudService } from "src/service";
|
|
2
|
-
import { Retailer, ROrder, ROrderItem
|
|
2
|
+
import { Retailer, ROrder, ROrderItem } from "src/_examples/model-shared/supplier-portal.model";
|
|
3
|
+
import { Supplier } from "../../model-shared/supplier.model";
|
|
3
4
|
export type ReportData = {
|
|
4
5
|
supplierToItemsMap: Map<Supplier, Partial<ROrderItem>[]>;
|
|
5
6
|
retailer: Retailer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rorder-service.interface.js","sourceRoot":"","sources":["../../../../src/_examples/service/rorder/rorder-service.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { CrudService } from \"src/service\";\nimport { Retailer, ROrder, ROrderItem
|
|
1
|
+
{"version":3,"file":"rorder-service.interface.js","sourceRoot":"","sources":["../../../../src/_examples/service/rorder/rorder-service.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { CrudService } from \"src/service\";\nimport { Retailer, ROrder, ROrderItem } from \"src/_examples/model-shared/supplier-portal.model\";\nimport { Supplier } from \"../../model-shared/supplier.model\";\n\nexport type ReportData = {\n supplierToItemsMap: Map<Supplier, Partial<ROrderItem>[]>;\n retailer: Retailer;\n retailerOrder: ROrder;\n};\n\nexport interface ROrderService extends CrudService<ROrder> {}\n"]}
|
|
@@ -3,12 +3,23 @@ import { SupplierRepoDB } from "../../repositories/supplier/supplier-repo-db.int
|
|
|
3
3
|
import "../../repositories/supplier/supplier-repo-db";
|
|
4
4
|
import { SupplierRepoES } from "../../repositories/supplier/supplier-repo-es.interface";
|
|
5
5
|
import "../../repositories/supplier/supplier-repo-es";
|
|
6
|
-
import { ActionDynamoDB,
|
|
7
|
-
import { SAccount } from "../../model-shared/suppler.model-to-remove";
|
|
6
|
+
import { ActionDynamoDB, CognitoUserStatus } from "../../../index.js";
|
|
8
7
|
import { CrudServiceImpl } from "../../../service/crud.service";
|
|
9
|
-
|
|
8
|
+
import "../entity/entity-service";
|
|
9
|
+
import "../commission/commission-service";
|
|
10
|
+
import { Supplier } from "../../model-shared/supplier.model";
|
|
11
|
+
import { Entity, ROrderItem, SOrder } from "../../model-shared/supplier-portal.model";
|
|
12
|
+
export declare class SupplierServiceImpl extends CrudServiceImpl<Supplier, SupplierRepoDB, SupplierRepoES> implements SupplierService {
|
|
13
|
+
private readonly entityService;
|
|
14
|
+
private readonly commissionService;
|
|
10
15
|
constructor();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
calculateItemCounts(entities: Entity[]): Promise<Map<Entity, number>>;
|
|
17
|
+
createDraftSOrder(entities: Map<Entity, number>): SOrder;
|
|
18
|
+
updateCognitoStatus(username: string, status: CognitoUserStatus): Promise<void>;
|
|
19
|
+
listNonPartners(retailerUsername: string, page: number, size: number): Promise<Partial<Supplier>[]>;
|
|
20
|
+
updateItems(supplierListModified: Supplier[], strings: string[]): void;
|
|
21
|
+
sendOrderToSupplier(sOrder: SOrder): Promise<boolean>;
|
|
22
|
+
getSupplierAll(): Promise<Supplier[]>;
|
|
23
|
+
saveSalesReportItems(rOrderItems: ROrderItem[]): Promise<boolean>;
|
|
24
|
+
processChanges(itemOld: Supplier, itemNew: Supplier, action: ActionDynamoDB, tableName: string): Promise<any>;
|
|
14
25
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { Filter, List } from "../../../index.js";
|
|
2
|
-
import { SAccount } from "../../model-shared/suppler.model-to-remove";
|
|
3
1
|
import { CrudService } from "../../../service/crud.service.interface";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { Entity, SOrder } from "../../model-shared/supplier-portal.model";
|
|
3
|
+
import { CognitoUserStatus } from "../../../index.js";
|
|
4
|
+
import { Supplier } from "../../model-shared/supplier.model";
|
|
5
|
+
export interface SupplierService extends CrudService<Supplier> {
|
|
6
|
+
calculateItemCounts(entities: Entity[]): Promise<Map<Entity, number>>;
|
|
7
|
+
createDraftSOrder(entities: Map<Entity, number>): SOrder;
|
|
8
|
+
sendOrderToSupplier(sOrder: SOrder): Promise<boolean>;
|
|
9
|
+
getSupplierAll(): Promise<Supplier[]>;
|
|
10
|
+
updateItems(supplierListModified: Supplier[], strings: string[]): any;
|
|
11
|
+
sendOrderToSupplier(sOrder: SOrder): Promise<boolean>;
|
|
12
|
+
updateCognitoStatus(username: string, status: CognitoUserStatus): Promise<void>;
|
|
13
|
+
listNonPartners(retailerUsername: string, page: number, size: number): Promise<Partial<Supplier>[]>;
|
|
7
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier-service-crud.interface.js","sourceRoot":"","sources":["../../../../src/_examples/service/supplier/supplier-service-crud.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"supplier-service-crud.interface.js","sourceRoot":"","sources":["../../../../src/_examples/service/supplier/supplier-service-crud.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { CrudService } from \"../../../service/crud.service.interface\";\nimport { Entity, SOrder } from \"../../model-shared/supplier-portal.model\";\nimport { CognitoUserStatus } from \"@chinggis/core\";\nimport { Supplier } from \"../../model-shared/supplier.model\";\n\nexport interface SupplierService extends CrudService<Supplier> {\n calculateItemCounts(entities: Entity[]): Promise<Map<Entity, number>>;\n\n createDraftSOrder(entities: Map<Entity, number>): SOrder;\n\n sendOrderToSupplier(sOrder: SOrder): Promise<boolean>;\n\n getSupplierAll(): Promise<Supplier[]>;\n\n updateItems(supplierListModified: Supplier[], strings: string[]): any;\n\n sendOrderToSupplier(sOrder: SOrder): Promise<boolean>;\n\n updateCognitoStatus(username: string, status: CognitoUserStatus): Promise<void>;\n\n listNonPartners(retailerUsername: string, page: number, size: number): Promise<Partial<Supplier>[]>;\n}\n"]}
|
|
@@ -42,103 +42,88 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
42
42
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.
|
|
45
|
+
exports.SupplierServiceImpl = void 0;
|
|
46
46
|
const typedi_1 = __importStar(require("typedi"));
|
|
47
47
|
require("../../repositories/supplier/supplier-repo-db");
|
|
48
48
|
require("../../repositories/supplier/supplier-repo-es");
|
|
49
49
|
const core_1 = require("../../../index.js");
|
|
50
50
|
const supplier_config_1 = require("../../controller/supplier/supplier-config");
|
|
51
51
|
const crud_service_1 = require("../../../service/crud.service");
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
require("../entity/entity-service");
|
|
53
|
+
require("../commission/commission-service");
|
|
54
|
+
let SupplierServiceImpl = class SupplierServiceImpl extends crud_service_1.CrudServiceImpl {
|
|
55
|
+
// @Inject("EOrderService") private readonly ecomOrderService: EOrderService;
|
|
54
56
|
// @Inject("ROrderService") private readonly rOrderService: ROrderService;
|
|
57
|
+
entityService;
|
|
58
|
+
commissionService;
|
|
55
59
|
//
|
|
56
60
|
constructor() {
|
|
57
61
|
const repoDB = typedi_1.default.get("SupplierRepoDB");
|
|
58
62
|
const repoES = typedi_1.default.get("SupplierRepoES");
|
|
59
63
|
super(repoDB, repoES);
|
|
64
|
+
this.setConfig(supplier_config_1.CONFIG_SUPPLIER.toObject());
|
|
60
65
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (!supplier)
|
|
64
|
-
return this.throwError(core_1.HTTP.BAD_REQUEST.code, "supplier not found!");
|
|
65
|
-
if (supplier?.loginStatus === "pending")
|
|
66
|
-
return this.throwError(core_1.HTTP.BAD_REQUEST.code, "already pending user!");
|
|
67
|
-
if (supplier?.loginStatus === "confirmed")
|
|
68
|
-
return this.throwError(core_1.HTTP.BAD_REQUEST.code, "already confirmed user!");
|
|
66
|
+
calculateItemCounts(entities) {
|
|
67
|
+
throw new Error("Method not implemented.");
|
|
69
68
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
query: {
|
|
77
|
-
bool: {
|
|
78
|
-
must_not: [
|
|
79
|
-
{
|
|
80
|
-
term: {
|
|
81
|
-
accountType: "level1",
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
should: [],
|
|
86
|
-
minimum_should_match: 1,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
from: filterAndSort.page * filterAndSort.size,
|
|
90
|
-
size: filterAndSort.size,
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
if (filterAndSort.page && filterAndSort.size) {
|
|
94
|
-
filter.body.from = filterAndSort.page * filterAndSort.size;
|
|
95
|
-
}
|
|
96
|
-
if (filterAndSort.size) {
|
|
97
|
-
filter.body.size = filterAndSort.size;
|
|
98
|
-
}
|
|
99
|
-
if (!filterAndSort.searchKeyword) {
|
|
100
|
-
const result = await this.repoES.search(filter, true);
|
|
101
|
-
return {
|
|
102
|
-
items: result,
|
|
103
|
-
lastKey: null,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
let searchKeyword = filterAndSort.searchKeyword.trim();
|
|
107
|
-
const searchFields = ["username", "firstName", "lastName", "phoneList", "bankAccountNumber", "bankName"];
|
|
108
|
-
searchKeyword = (0, core_1.toCaseInsensitive)(searchKeyword);
|
|
109
|
-
searchFields.forEach((field) => {
|
|
110
|
-
filter.body.query.bool.should.push({
|
|
111
|
-
regexp: {
|
|
112
|
-
[field]: {
|
|
113
|
-
value: `.*${searchKeyword}.*`,
|
|
114
|
-
case_insensitive: true,
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
});
|
|
69
|
+
createDraftSOrder(entities) {
|
|
70
|
+
throw new Error("Method not implemented.");
|
|
71
|
+
}
|
|
72
|
+
async updateCognitoStatus(username, status) {
|
|
73
|
+
const supplierList = await this.find({
|
|
74
|
+
username,
|
|
118
75
|
});
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
});
|
|
76
|
+
const supplier = supplierList.items[0];
|
|
77
|
+
supplier.cognitoStatus = status;
|
|
78
|
+
await this.update(supplier);
|
|
79
|
+
}
|
|
80
|
+
async listNonPartners(retailerUsername, page, size) {
|
|
81
|
+
try {
|
|
82
|
+
const partnerCommissions = await this.commissionService.findAllByIndex("byRetailer", retailerUsername);
|
|
83
|
+
const partnerUsernames = new Set(partnerCommissions.map((c) => c.supplierUsername));
|
|
84
|
+
const filter = (0, core_1.parseFilter)(`size=${size}&page=${page}&accountType=level3,level4`);
|
|
85
|
+
const suppliers = await this.search(filter);
|
|
86
|
+
return suppliers.filter((s) => !partnerUsernames.has(s.username));
|
|
128
87
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.log(error);
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
updateItems(supplierListModified, strings) {
|
|
94
|
+
throw new Error("Method not implemented.");
|
|
95
|
+
}
|
|
96
|
+
sendOrderToSupplier(sOrder) {
|
|
97
|
+
throw new Error("Method not implemented.");
|
|
98
|
+
}
|
|
99
|
+
async getSupplierAll() {
|
|
100
|
+
const supplierList = [];
|
|
101
|
+
// while (true) {
|
|
102
|
+
// const response = await this.repoDB.find(parseIndexFilter("", DYNAMO_DB.SUPPLIER.MAP));
|
|
103
|
+
// if (response.items.length > 0) supplierList.push(...(response.items as unknown as Supplier[]));
|
|
104
|
+
//
|
|
105
|
+
// if (!response.lastKey) break;
|
|
106
|
+
// }
|
|
107
|
+
return supplierList;
|
|
108
|
+
}
|
|
109
|
+
async saveSalesReportItems(rOrderItems) {
|
|
110
|
+
return true;
|
|
134
111
|
}
|
|
135
112
|
async processChanges(itemOld, itemNew, action, tableName) {
|
|
136
113
|
throw new Error("Method not implemented.");
|
|
137
114
|
}
|
|
138
115
|
};
|
|
139
|
-
exports.
|
|
140
|
-
|
|
116
|
+
exports.SupplierServiceImpl = SupplierServiceImpl;
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, typedi_1.Inject)("EntityService"),
|
|
119
|
+
__metadata("design:type", Object)
|
|
120
|
+
], SupplierServiceImpl.prototype, "entityService", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, typedi_1.Inject)("CommissionService"),
|
|
123
|
+
__metadata("design:type", Object)
|
|
124
|
+
], SupplierServiceImpl.prototype, "commissionService", void 0);
|
|
125
|
+
exports.SupplierServiceImpl = SupplierServiceImpl = __decorate([
|
|
141
126
|
(0, typedi_1.Service)("SupplierCrudService"),
|
|
142
127
|
__metadata("design:paramtypes", [])
|
|
143
|
-
],
|
|
128
|
+
], SupplierServiceImpl);
|
|
144
129
|
//# sourceMappingURL=supplier-service-crud.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier-service-crud.js","sourceRoot":"","sources":["../../../../src/_examples/service/supplier/supplier-service-crud.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"supplier-service-crud.js","sourceRoot":"","sources":["../../../../src/_examples/service/supplier/supplier-service-crud.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAoD;AAKpD,wDAAsD;AAGtD,wDAAsD;AACtD,yCAAgF;AAChF,+EAA4E;AAC5E,gEAAgE;AAGhE,oCAAkC;AAElC,4CAA0C;AAKnC,IAAM,mBAAmB,GAAzB,MAAM,mBACX,SAAQ,8BAAyD;IAGjE,6EAA6E;IAC7E,0EAA0E;IAChC,aAAa,CAAgB;IACzB,iBAAiB,CAAoB;IAEnF,EAAE;IACF;QACE,MAAM,MAAM,GAAmB,gBAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAmB,gBAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC/D,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,iCAAe,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,mBAAmB,CAAC,QAAkB;QACpC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,iBAAiB,CAAC,QAA6B;QAC7C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,mBA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IAC7C,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,MAAM,YAAY,GAAe,EAAE,CAAC;QACpC,oBAAoB;QACpB,8FAA8F;QAC9F,uGAAuG;QACvG,EAAE;QACF,qCAAqC;QACrC,OAAO;QACP,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,WAAyB;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAiB,EAAE,OAAiB,EAAE,MAAsB,EAAE,SAAiB;QAClG,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF,CAAA;AA5EY,kDAAmB;AAMY;IAAzC,IAAA,eAAM,EAAC,eAAe,CAAC;;0DAA+C;AACzB;IAA7C,IAAA,eAAM,EAAC,mBAAmB,CAAC;;8DAAuD;8BAPxE,mBAAmB;IAD/B,IAAA,gBAAO,EAAC,qBAAqB,CAAC;;GAClB,mBAAmB,CA4E/B","sourcesContent":["import Container, { Inject, Service } from \"typedi\";\n\nimport { SupplierService } from \"./supplier-service-crud.interface\";\n\nimport { SupplierRepoDB } from \"../../repositories/supplier/supplier-repo-db.interface\";\nimport \"../../repositories/supplier/supplier-repo-db\";\n\nimport { SupplierRepoES } from \"../../repositories/supplier/supplier-repo-es.interface\";\nimport \"../../repositories/supplier/supplier-repo-es\";\nimport { ActionDynamoDB, CognitoUserStatus, parseFilter } from \"@chinggis/core\";\nimport { CONFIG_SUPPLIER } from \"../../controller/supplier/supplier-config\";\nimport { CrudServiceImpl } from \"../../../service/crud.service\";\n\nimport { EntityService } from \"../entity/entity-service.interface\";\nimport \"../entity/entity-service\";\nimport { CommissionService } from \"../commission/commission-service.interface\";\nimport \"../commission/commission-service\";\nimport { Supplier } from \"../../model-shared/supplier.model\";\nimport { Entity, ROrderItem, SOrder } from \"../../model-shared/supplier-portal.model\";\n\n@Service(\"SupplierCrudService\")\nexport class SupplierServiceImpl\n extends CrudServiceImpl<Supplier, SupplierRepoDB, SupplierRepoES>\n implements SupplierService\n{\n // @Inject(\"EOrderService\") private readonly ecomOrderService: EOrderService;\n // @Inject(\"ROrderService\") private readonly rOrderService: ROrderService;\n @Inject(\"EntityService\") private readonly entityService: EntityService;\n @Inject(\"CommissionService\") private readonly commissionService: CommissionService;\n\n //\n constructor() {\n const repoDB: SupplierRepoDB = Container.get(\"SupplierRepoDB\");\n const repoES: SupplierRepoES = Container.get(\"SupplierRepoES\");\n super(repoDB, repoES);\n this.setConfig(CONFIG_SUPPLIER.toObject());\n }\n calculateItemCounts(entities: Entity[]): Promise<Map<Entity, number>> {\n throw new Error(\"Method not implemented.\");\n }\n createDraftSOrder(entities: Map<Entity, number>): SOrder {\n throw new Error(\"Method not implemented.\");\n }\n\n async updateCognitoStatus(username: string, status: CognitoUserStatus): Promise<void> {\n const supplierList = await this.find({\n username,\n });\n const supplier = supplierList.items[0];\n supplier.cognitoStatus = status;\n\n await this.update(supplier as Supplier);\n }\n\n async listNonPartners(retailerUsername: string, page: number, size: number): Promise<Partial<Supplier>[]> {\n try {\n const partnerCommissions = await this.commissionService.findAllByIndex(\"byRetailer\", retailerUsername);\n\n const partnerUsernames = new Set(partnerCommissions.map((c) => c.supplierUsername));\n\n const filter = parseFilter(`size=${size}&page=${page}&accountType=level3,level4`);\n const suppliers = await this.search(filter);\n\n return suppliers.filter((s) => !partnerUsernames.has(s.username));\n } catch (error) {\n console.log(error);\n\n throw error;\n }\n }\n\n updateItems(supplierListModified: Supplier[], strings: string[]) {\n throw new Error(\"Method not implemented.\");\n }\n\n sendOrderToSupplier(sOrder: SOrder): Promise<boolean> {\n throw new Error(\"Method not implemented.\");\n }\n\n async getSupplierAll(): Promise<Supplier[]> {\n const supplierList: Supplier[] = [];\n // while (true) {\n // const response = await this.repoDB.find(parseIndexFilter(\"\", DYNAMO_DB.SUPPLIER.MAP));\n // if (response.items.length > 0) supplierList.push(...(response.items as unknown as Supplier[]));\n //\n // if (!response.lastKey) break;\n // }\n return supplierList;\n }\n\n async saveSalesReportItems(rOrderItems: ROrderItem[]): Promise<boolean> {\n return true;\n }\n\n async processChanges(itemOld: Supplier, itemNew: Supplier, action: ActionDynamoDB, tableName: string): Promise<any> {\n throw new Error(\"Method not implemented.\");\n }\n}\n"]}
|
|
@@ -2,12 +2,12 @@ import { SupplierRepoDB } from "../../repositories/supplier/supplier-repo-db.int
|
|
|
2
2
|
import "../../repositories/supplier/supplier-repo-db";
|
|
3
3
|
import { SupplierRepoES } from "../../repositories/supplier/supplier-repo-es.interface";
|
|
4
4
|
import "../../repositories/supplier/supplier-repo-es";
|
|
5
|
-
import { SAccount } from "../../model-shared/suppler.model-to-remove";
|
|
6
5
|
import { SupplierServiceStream } from "./supplier-service-stream.interface";
|
|
7
6
|
import { StreamServiceImpl } from "../../../service/stream.service";
|
|
8
|
-
|
|
7
|
+
import { Supplier } from "../../model-shared/supplier.model";
|
|
8
|
+
export declare class SupplierServiceStreamImpl extends StreamServiceImpl<Supplier, SupplierRepoDB, SupplierRepoES> implements SupplierServiceStream {
|
|
9
9
|
constructor();
|
|
10
|
-
processDeletion(oldItem:
|
|
11
|
-
processInsertion(newItem:
|
|
12
|
-
processModification(itemOld:
|
|
10
|
+
processDeletion(oldItem: Supplier, newItem: Supplier, tableName?: string): Promise<any>;
|
|
11
|
+
processInsertion(newItem: Supplier, tableName: string): Promise<any>;
|
|
12
|
+
processModification(itemOld: Supplier, itemNew: Supplier, tableName?: string): Promise<any>;
|
|
13
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SAccount } from "../../model-shared/suppler.model-to-remove";
|
|
2
1
|
import { StreamService } from "../../../service/stream.service.interface";
|
|
3
2
|
import "../../../service/stream.service";
|
|
4
|
-
|
|
3
|
+
import { Supplier } from "../../model-shared/supplier.model";
|
|
4
|
+
export interface SupplierServiceStream extends StreamService<Supplier> {
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier-service-stream.interface.js","sourceRoot":"","sources":["../../../../src/_examples/service/supplier/supplier-service-stream.interface.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"supplier-service-stream.interface.js","sourceRoot":"","sources":["../../../../src/_examples/service/supplier/supplier-service-stream.interface.ts"],"names":[],"mappings":";;AACA,2CAAyC","sourcesContent":["import { StreamService } from \"../../../service/stream.service.interface\";\nimport \"../../../service/stream.service\";\nimport { Supplier } from \"../../model-shared/supplier.model\";\n\nexport interface SupplierServiceStream extends StreamService<Supplier> {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier-service-stream.js","sourceRoot":"","sources":["../../../../src/_examples/service/supplier/supplier-service-stream.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAG5C,wDAAsD;AAGtD,wDAAsD;
|
|
1
|
+
{"version":3,"file":"supplier-service-stream.js","sourceRoot":"","sources":["../../../../src/_examples/service/supplier/supplier-service-stream.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAG5C,wDAAsD;AAGtD,wDAAsD;AAEtD,oEAAoE;AAI7D,IAAM,yBAAyB,GAA/B,MAAM,yBACX,SAAQ,kCAA2D;IAGnE,EAAE;IACF;QACE,MAAM,MAAM,GAAmB,gBAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAmB,gBAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC/D,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxB,CAAC;IAED,eAAe,CAAC,OAAiB,EAAE,OAAiB,EAAE,SAAkB;QACtE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,gBAAgB,CAAC,OAAiB,EAAE,SAAiB;QACnD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,mBAAmB,CAAC,OAAiB,EAAE,OAAiB,EAAE,SAAkB;QAC1E,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF,CAAA;AApBY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,gBAAO,EAAC,uBAAuB,CAAC;;GACpB,yBAAyB,CAoBrC","sourcesContent":["import Container, { Service } from \"typedi\";\n\nimport { SupplierRepoDB } from \"../../repositories/supplier/supplier-repo-db.interface\";\nimport \"../../repositories/supplier/supplier-repo-db\";\n\nimport { SupplierRepoES } from \"../../repositories/supplier/supplier-repo-es.interface\";\nimport \"../../repositories/supplier/supplier-repo-es\";\nimport { SupplierServiceStream } from \"./supplier-service-stream.interface\";\nimport { StreamServiceImpl } from \"../../../service/stream.service\";\nimport { Supplier } from \"../../model-shared/supplier.model\";\n\n@Service(\"SupplierStreamService\")\nexport class SupplierServiceStreamImpl\n extends StreamServiceImpl<Supplier, SupplierRepoDB, SupplierRepoES>\n implements SupplierServiceStream\n{\n //\n constructor() {\n const repoDB: SupplierRepoDB = Container.get(\"SupplierRepoDB\");\n const repoES: SupplierRepoES = Container.get(\"SupplierRepoES\");\n super(repoDB, repoES);\n }\n\n processDeletion(oldItem: Supplier, newItem: Supplier, tableName?: string): Promise<any> {\n throw new Error(\"Method not implemented.\");\n }\n processInsertion(newItem: Supplier, tableName: string): Promise<any> {\n throw new Error(\"Method not implemented.\");\n }\n processModification(itemOld: Supplier, itemNew: Supplier, tableName?: string): Promise<any> {\n throw new Error(\"Method not implemented.\");\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.model.js","sourceRoot":"","sources":["../../src/model/filter.model.ts"],"names":[],"mappings":"","sourcesContent":["import { SortOrder } from \"@chinggis/core\";\n\nexport interface Filter extends Record<string, any> {\n page?: number; // The page number for pagination\n size?: number; // The size of items per page\n sortBy?: string; // The field to sort by\n sort?: SortOrder; // Sorting order, either ascending or descending\n searchBy?: string[]; // The field to search in\n searchKeyword?: string; // The keyword to search for\n rangeFilters?: RangeFilter[]; // The field to apply range filtering on\n lastKey?: string;\n indexName?: string;\n indexValue?: string;\n fieldsInclude?: string[];\n fieldsExclude?: string[];\n}\n\nexport type RangeFilter = {\n fieldName: string;\n minValue?: number | Date;\n maxValue?: number | Date;\n minExclude?: boolean;\n maxExclude?: boolean;\n};\n\nexport type NumberRange = {\n gte?: number;\n lte?: number;\n};\n\nexport type DateRange = {\n gte?: string;\n lte?: string;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"filter.model.js","sourceRoot":"","sources":["../../src/model/filter.model.ts"],"names":[],"mappings":"","sourcesContent":["import { SortOrder } from \"@chinggis/core\";\n\nexport interface Filter extends Record<string, any> {\n page?: number; // The page number for pagination\n size?: number; // The size of items per page\n sortBy?: string; // The field to sort by\n sort?: SortOrder; // Sorting order, either ascending or descending\n searchBy?: string[]; // The field to search in\n searchKeyword?: string; // The keyword to search for\n rangeFilters?: RangeFilter[]; // The field to apply range filtering on\n lastKey?: string;\n indexName?: string;\n indexValue?: string;\n fieldsInclude?: string[];\n fieldsExclude?: string[];\n urlRaw?: string;\n}\n\nexport type RangeFilter = {\n fieldName: string;\n minValue?: number | Date;\n maxValue?: number | Date;\n minExclude?: boolean;\n maxExclude?: boolean;\n};\n\nexport type NumberRange = {\n gte?: number;\n lte?: number;\n};\n\nexport type DateRange = {\n gte?: string;\n lte?: string;\n};\n"]}
|
|
@@ -26,7 +26,7 @@ export declare abstract class BaseServiceImpl<T extends BaseEntity, D extends Ba
|
|
|
26
26
|
getIndexES(): string;
|
|
27
27
|
getIndexMapDB(): DynamoIndexMap;
|
|
28
28
|
findAll(): Promise<T[]>;
|
|
29
|
-
findAllMatch(filter: Filter): Promise<T[]>;
|
|
29
|
+
findAllMatch(filter: Filter | string): Promise<T[]>;
|
|
30
30
|
findAllByIndex(indexName: string, indexValue: any): Promise<T[]>;
|
|
31
31
|
findByField(fieldName: string, fieldValue: any): Promise<List<T>>;
|
|
32
32
|
findFirst(fieldName: string, fieldValue: string | boolean | number | Date): Promise<T>;
|
|
@@ -121,6 +121,8 @@ class BaseServiceImpl extends socket_service_1.BaseSocketServiceIml {
|
|
|
121
121
|
return result;
|
|
122
122
|
}
|
|
123
123
|
async findAllMatch(filter) {
|
|
124
|
+
if (typeof filter === "string")
|
|
125
|
+
filter = (0, index_1.parseIndexFilter)(filter);
|
|
124
126
|
this.checkIsIndexedField(filter);
|
|
125
127
|
return await this.fetchAll(filter);
|
|
126
128
|
}
|
|
@@ -261,6 +263,10 @@ class BaseServiceImpl extends socket_service_1.BaseSocketServiceIml {
|
|
|
261
263
|
const response = await this.repoDB.find(filter);
|
|
262
264
|
result.push(...response.items);
|
|
263
265
|
filter.lastKey = response.lastKey;
|
|
266
|
+
if (result.length >= 5000) {
|
|
267
|
+
console.warn("too many items returned, breaking loop.");
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
264
270
|
} while (filter.lastKey);
|
|
265
271
|
return result;
|
|
266
272
|
}
|