@provis/provis-common-be-module 2.2.2 → 2.2.3

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.
@@ -193,7 +193,12 @@ class MainRepository extends typeorm_1.Repository {
193
193
  relations.forEach((relation) => {
194
194
  var _a, _b;
195
195
  if (relation) {
196
- query.innerJoin(`${modelName}.${relation.model}`, relation.model);
196
+ if (relation && relation.join == "left" /* Join.LEFT */) {
197
+ query.leftJoin(`${modelName}.${relation.model}`, relation.model);
198
+ }
199
+ else {
200
+ query.innerJoin(`${modelName}.${relation.model}`, relation.model);
201
+ }
197
202
  (_a = relation.searchs) === null || _a === void 0 ? void 0 : _a.forEach((valueSearch) => {
198
203
  if (valueSearch) {
199
204
  query = query.andWhere(`${relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
@@ -0,0 +1,5 @@
1
+ declare const enum Join {
2
+ INNER = "inner",
3
+ LEFT = "left"
4
+ }
5
+ export default Join;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,8 @@
1
+ import Join from "../constants/join";
1
2
  import ISearchQuery from "./search.query.interface";
2
3
  export default interface IMultiJoin {
3
4
  model: string;
4
- searchs: ISearchQuery[];
5
+ join?: Join;
6
+ searchs?: ISearchQuery[];
5
7
  additionalSearchOr?: ISearchQuery[][];
6
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@provis/provis-common-be-module",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "This common module for Provis internal backend use lib",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {