test-entity-library-asm 3.9.38 → 3.9.40

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.
@@ -22,4 +22,8 @@ export declare class CustomRepository<T extends ObjectLiteral> extends Repositor
22
22
  data: any[];
23
23
  totalRecords: number;
24
24
  }>;
25
+ getLocalsCompanyInformationForTheTableWrapper(params: IBasicCompany): Promise<{
26
+ data: any[];
27
+ totalRecords: number;
28
+ }>;
25
29
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CustomRepository = void 0;
4
4
  const typeorm_1 = require("typeorm");
5
5
  const _1 = require(".");
6
+ const LocalsCompanyInformationForTheTable_1 = require("./filters/LocalsCompanyInformationForTheTable");
6
7
  class CustomRepository extends typeorm_1.Repository {
7
8
  constructor(target, dataSource) {
8
9
  super(target, dataSource.manager);
@@ -22,5 +23,8 @@ class CustomRepository extends typeorm_1.Repository {
22
23
  async getLocalReservesInformationWrapper(params) {
23
24
  return await (0, _1.getLocalReservesInformation)(this, params);
24
25
  }
26
+ async getLocalsCompanyInformationForTheTableWrapper(params) {
27
+ return await (0, LocalsCompanyInformationForTheTable_1.getLocalsCompanyInformationTable)(this, params);
28
+ }
25
29
  }
26
30
  exports.CustomRepository = CustomRepository;
@@ -1,6 +1,6 @@
1
1
  import { Repository } from "typeorm";
2
2
  import { IBasicCompany } from "../interfaces";
3
- export declare function getLocalsCompanyInformation(repository: Repository<any>, { company, status, visible, lazyEvent, filter_visualization, }: IBasicCompany): Promise<{
3
+ export declare function getLocalsCompanyInformationTable(repository: Repository<any>, { company, status, visible, lazyEvent, filter_visualization, }: IBasicCompany): Promise<{
4
4
  data: any[];
5
5
  totalRecords: number;
6
6
  }>;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLocalsCompanyInformation = void 0;
4
- async function getLocalsCompanyInformation(repository, { company, status, visible, lazyEvent, filter_visualization = "no-in-review-rejected", }) {
3
+ exports.getLocalsCompanyInformationTable = void 0;
4
+ async function getLocalsCompanyInformationTable(repository, { company, status, visible, lazyEvent, filter_visualization = 2, // "no-in-review-rejected"
5
+ }) {
5
6
  try {
6
7
  const queryBuilder = repository
7
8
  .createQueryBuilder("locals_company_information_for_the_table")
@@ -33,10 +34,12 @@ async function getLocalsCompanyInformation(repository, { company, status, visibl
33
34
  // DOC: la columna filter_visualization se utiliza para aplicar el filtro review_status y operation_type.
34
35
  // DOC: Si filter_visualization es "in-review-rejected", se muestran los locales que están en revisión o rechazados, es decir, review_status = 1 o 3 y operation_type = 1 o 2.
35
36
  // DOC: Si filter_visualization es "no-in-review-rejected", se muestran los locales que no están en revisión ni rechazados, es decir, review_status es null y operation_type es null.
36
- if (filter_visualization === "in-review-rejected") {
37
+ if (filter_visualization === 1) {
38
+ // "in-review-rejected"
37
39
  queryBuilder.andWhere("(locals_company_information_for_the_table.review_status IN (1, 3) AND locals_company_information_for_the_table.operation_type IN (1, 2))");
38
40
  }
39
- else if (filter_visualization === "no-in-review-rejected") {
41
+ else if (filter_visualization === 2) {
42
+ // "no-in-review-rejected"
40
43
  queryBuilder.andWhere("(locals_company_information_for_the_table.review_status IS NULL AND locals_company_information_for_the_table.operation_type IS NULL)");
41
44
  }
42
45
  // DOC: Acá vienen los otros filtros, por las columnas de la tabla.
@@ -172,4 +175,4 @@ async function getLocalsCompanyInformation(repository, { company, status, visibl
172
175
  };
173
176
  }
174
177
  }
175
- exports.getLocalsCompanyInformation = getLocalsCompanyInformation;
178
+ exports.getLocalsCompanyInformationTable = getLocalsCompanyInformationTable;
package/dist/index.js CHANGED
@@ -113,13 +113,22 @@ function getTimezoneOffset(timezone) {
113
113
  return offset;
114
114
  }
115
115
  exports.getTimezoneOffset = getTimezoneOffset;
116
+ // export const getRepositoryByEntity = async <T extends ObjectLiteral>(
117
+ // entity: EntityTarget<T>,
118
+ // ): Promise<CustomRepository<T>> => {
119
+ // if (!connection) {
120
+ // connection = createDataBaseSource();
121
+ // await connection.initialize();
122
+ // }
123
+ // return connection
124
+ // .getRepository(entity)
125
+ // .extend(CustomRepository.prototype) as CustomRepository<T>;
126
+ // };
116
127
  const getRepositoryByEntity = async (entity) => {
117
128
  if (!connection) {
118
129
  connection = createDataBaseSource();
119
130
  await connection.initialize();
120
131
  }
121
- return connection
122
- .getRepository(entity)
123
- .extend(_1.CustomRepository.prototype);
132
+ return new _1.CustomRepository(entity, connection);
124
133
  };
125
134
  exports.getRepositoryByEntity = getRepositoryByEntity;
@@ -28,7 +28,7 @@ export interface IBasicCompany extends IBasicLazyEvent {
28
28
  company: number | null;
29
29
  visible?: number | null;
30
30
  owner?: number | null;
31
- filter_visualization: TLocalsCompanyTypeVisualization;
31
+ filter_visualization?: number | null;
32
32
  }
33
33
  export interface IPropsQueryVerifyLocalInformation extends IPropsQueryVerifyLocal {
34
34
  partner: number | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "3.9.38",
3
+ "version": "3.9.40",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,6 +13,7 @@ import {
13
13
  getLocalsCompanyInformation,
14
14
  getVerifyLocalsInformation,
15
15
  } from ".";
16
+ import { getLocalsCompanyInformationTable } from "./filters/LocalsCompanyInformationForTheTable";
16
17
 
17
18
  export class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
18
19
  constructor(target: EntityTarget<T>, dataSource: DataSource) {
@@ -32,7 +33,7 @@ export class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
32
33
  }
33
34
 
34
35
  async getVerifyLocalsInformationWrapper(
35
- params: IPropsQueryVerifyLocalInformation
36
+ params: IPropsQueryVerifyLocalInformation,
36
37
  ) {
37
38
  return await getVerifyLocalsInformation(this, params);
38
39
  }
@@ -41,6 +42,10 @@ export class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
41
42
  return await getLocalReservesInformation(this, params);
42
43
  }
43
44
 
45
+ async getLocalsCompanyInformationForTheTableWrapper(params: IBasicCompany) {
46
+ return await getLocalsCompanyInformationTable(this, params);
47
+ }
48
+
44
49
  //! DOC: ¿Necesita implementar un método personalizado aquí?
45
50
  // async anyOtherRepository(args: any) {
46
51
  // // Implementa otro método personalizado aquí
@@ -1,14 +1,14 @@
1
1
  import { Repository } from "typeorm";
2
2
  import { IBasicCompany } from "../interfaces";
3
3
 
4
- export async function getLocalsCompanyInformation(
4
+ export async function getLocalsCompanyInformationTable(
5
5
  repository: Repository<any>,
6
6
  {
7
7
  company,
8
8
  status,
9
9
  visible,
10
10
  lazyEvent,
11
- filter_visualization = "no-in-review-rejected",
11
+ filter_visualization = 2, // "no-in-review-rejected"
12
12
  }: IBasicCompany,
13
13
  ) {
14
14
  try {
@@ -61,11 +61,13 @@ export async function getLocalsCompanyInformation(
61
61
  // DOC: la columna filter_visualization se utiliza para aplicar el filtro review_status y operation_type.
62
62
  // DOC: Si filter_visualization es "in-review-rejected", se muestran los locales que están en revisión o rechazados, es decir, review_status = 1 o 3 y operation_type = 1 o 2.
63
63
  // DOC: Si filter_visualization es "no-in-review-rejected", se muestran los locales que no están en revisión ni rechazados, es decir, review_status es null y operation_type es null.
64
- if (filter_visualization === "in-review-rejected") {
64
+ if (filter_visualization === 1) {
65
+ // "in-review-rejected"
65
66
  queryBuilder.andWhere(
66
67
  "(locals_company_information_for_the_table.review_status IN (1, 3) AND locals_company_information_for_the_table.operation_type IN (1, 2))",
67
68
  );
68
- } else if (filter_visualization === "no-in-review-rejected") {
69
+ } else if (filter_visualization === 2) {
70
+ // "no-in-review-rejected"
69
71
  queryBuilder.andWhere(
70
72
  "(locals_company_information_for_the_table.review_status IS NULL AND locals_company_information_for_the_table.operation_type IS NULL)",
71
73
  );
package/src/index.ts CHANGED
@@ -116,6 +116,17 @@ export function getTimezoneOffset(timezone: string) {
116
116
  return offset;
117
117
  }
118
118
 
119
+ // export const getRepositoryByEntity = async <T extends ObjectLiteral>(
120
+ // entity: EntityTarget<T>,
121
+ // ): Promise<CustomRepository<T>> => {
122
+ // if (!connection) {
123
+ // connection = createDataBaseSource();
124
+ // await connection.initialize();
125
+ // }
126
+ // return connection
127
+ // .getRepository(entity)
128
+ // .extend(CustomRepository.prototype) as CustomRepository<T>;
129
+ // };
119
130
  export const getRepositoryByEntity = async <T extends ObjectLiteral>(
120
131
  entity: EntityTarget<T>,
121
132
  ): Promise<CustomRepository<T>> => {
@@ -123,7 +134,6 @@ export const getRepositoryByEntity = async <T extends ObjectLiteral>(
123
134
  connection = createDataBaseSource();
124
135
  await connection.initialize();
125
136
  }
126
- return connection
127
- .getRepository(entity)
128
- .extend(CustomRepository.prototype) as CustomRepository<T>;
137
+
138
+ return new CustomRepository<T>(entity, connection);
129
139
  };
package/src/interfaces.ts CHANGED
@@ -32,7 +32,7 @@ export interface IBasicCompany extends IBasicLazyEvent {
32
32
  company: number | null;
33
33
  visible?: number | null;
34
34
  owner?: number | null;
35
- filter_visualization: TLocalsCompanyTypeVisualization;
35
+ filter_visualization?: number | null;
36
36
  }
37
37
 
38
38
  export interface IPropsQueryVerifyLocalInformation extends IPropsQueryVerifyLocal {