test-entity-library-asm 3.9.45 → 3.9.46
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/index.d.ts +27 -2
- package/dist/index.js +35 -4
- package/package.json +1 -1
- package/src/index.ts +62 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextFunction, Request, Response } from "express";
|
|
2
2
|
import { DataSource, EntityTarget, ObjectLiteral, Repository } from "typeorm";
|
|
3
|
-
import {
|
|
3
|
+
import { IBasicCompany, IBasicLazyEvent, IPropsDiscountUserOrCompany, IPropsLocalReserve, IPropsQueryVerifyLocalInformation } from "./interfaces";
|
|
4
4
|
export * from "./entities.views.routes";
|
|
5
5
|
export declare function createDataBaseSource(): DataSource;
|
|
6
6
|
export declare function showEntityNameEntity<T extends ObjectLiteral>(entity: EntityTarget<T>): Promise<Repository<T>>;
|
|
@@ -9,4 +9,29 @@ export declare function callStoredProcedure(storedProcedure: any, elements: any)
|
|
|
9
9
|
export declare function timezoneMiddleware(req: Request, res: Response, next: NextFunction): void;
|
|
10
10
|
export declare function getTimeZone(): string;
|
|
11
11
|
export declare function getTimezoneOffset(timezone: string): string;
|
|
12
|
-
export declare const getRepositoryByEntity: <T extends ObjectLiteral>(entity: EntityTarget<T>) => Promise<
|
|
12
|
+
export declare const getRepositoryByEntity: <T extends ObjectLiteral>(entity: EntityTarget<T>) => Promise<Repository<T> & {
|
|
13
|
+
getDiscountsCodeUserWrapper(params: IPropsDiscountUserOrCompany): Promise<{
|
|
14
|
+
data: any[];
|
|
15
|
+
totalRecords: number;
|
|
16
|
+
}>;
|
|
17
|
+
getDiscountsCodeCompanyWrapper(params: IBasicLazyEvent): Promise<{
|
|
18
|
+
data: any[];
|
|
19
|
+
totalRecords: number;
|
|
20
|
+
}>;
|
|
21
|
+
getLocalsCompanyInformationWrapper(params: IBasicCompany): Promise<{
|
|
22
|
+
data: any[];
|
|
23
|
+
totalRecords: number;
|
|
24
|
+
}>;
|
|
25
|
+
getVerifyLocalsInformationWrapper(params: IPropsQueryVerifyLocalInformation): Promise<{
|
|
26
|
+
data: any[];
|
|
27
|
+
totalRecords: number;
|
|
28
|
+
}>;
|
|
29
|
+
getLocalReservesInformationWrapper(params: IPropsLocalReserve): Promise<{
|
|
30
|
+
data: any[];
|
|
31
|
+
totalRecords: number;
|
|
32
|
+
}>;
|
|
33
|
+
getLocalsCompanyInformationForTheTableWrapper(params: IBasicCompany): Promise<{
|
|
34
|
+
data: any[];
|
|
35
|
+
totalRecords: number;
|
|
36
|
+
}>;
|
|
37
|
+
}>;
|
package/dist/index.js
CHANGED
|
@@ -146,16 +146,47 @@ const getRepositoryByEntity = async (entity) => {
|
|
|
146
146
|
if (!connection || !connection.isInitialized) {
|
|
147
147
|
connection = createDataBaseSource();
|
|
148
148
|
await connection.initialize();
|
|
149
|
-
console.log("METADATA CARGADA:", connection.entityMetadatas.map((e) => e.name));
|
|
150
149
|
}
|
|
151
|
-
return connection
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
return connection.getRepository(entity).extend({
|
|
151
|
+
async getDiscountsCodeUserWrapper(params) {
|
|
152
|
+
return (0, entities_views_routes_1.getDiscountsCodeUserInformation)(this, params);
|
|
153
|
+
},
|
|
154
|
+
async getDiscountsCodeCompanyWrapper(params) {
|
|
155
|
+
return (0, entities_views_routes_1.getDiscountsCodeCompanyInformation)(this, params);
|
|
156
|
+
},
|
|
157
|
+
async getLocalsCompanyInformationWrapper(params) {
|
|
158
|
+
return (0, entities_views_routes_1.getLocalsCompanyInformation)(this, params);
|
|
159
|
+
},
|
|
160
|
+
async getVerifyLocalsInformationWrapper(params) {
|
|
161
|
+
return (0, entities_views_routes_1.getVerifyLocalsInformation)(this, params);
|
|
162
|
+
},
|
|
163
|
+
async getLocalReservesInformationWrapper(params) {
|
|
164
|
+
return (0, entities_views_routes_1.getLocalReservesInformation)(this, params);
|
|
165
|
+
},
|
|
166
|
+
async getLocalsCompanyInformationForTheTableWrapper(params) {
|
|
167
|
+
return (0, entities_views_routes_1.getLocalsCompanyInformationTable)(this, params);
|
|
168
|
+
},
|
|
169
|
+
});
|
|
154
170
|
};
|
|
155
171
|
exports.getRepositoryByEntity = getRepositoryByEntity;
|
|
156
172
|
// export const getRepositoryByEntity = async <T extends ObjectLiteral>(
|
|
157
173
|
// entity: EntityTarget<T>,
|
|
158
174
|
// ): Promise<CustomRepository<T>> => {
|
|
175
|
+
// if (!connection || !connection.isInitialized) {
|
|
176
|
+
// connection = createDataBaseSource();
|
|
177
|
+
// await connection.initialize();
|
|
178
|
+
// console.log(
|
|
179
|
+
// "METADATA CARGADA:",
|
|
180
|
+
// connection.entityMetadatas.map((e) => e.name),
|
|
181
|
+
// );
|
|
182
|
+
// }
|
|
183
|
+
// return connection
|
|
184
|
+
// .getRepository(entity)
|
|
185
|
+
// .extend(CustomRepository.prototype) as CustomRepository<T>;
|
|
186
|
+
// };
|
|
187
|
+
// export const getRepositoryByEntity = async <T extends ObjectLiteral>(
|
|
188
|
+
// entity: EntityTarget<T>,
|
|
189
|
+
// ): Promise<CustomRepository<T>> => {
|
|
159
190
|
// if (!connection) {
|
|
160
191
|
// connection = createDataBaseSource();
|
|
161
192
|
// await connection.initialize();
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,9 +3,24 @@ import { config } from "dotenv";
|
|
|
3
3
|
import { NextFunction, Request, Response } from "express";
|
|
4
4
|
import { resolve } from "path";
|
|
5
5
|
import { DataSource, EntityTarget, ObjectLiteral, Repository } from "typeorm";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
IBasicCompany,
|
|
8
|
+
IBasicLazyEvent,
|
|
9
|
+
IPropsDiscountUserOrCompany,
|
|
10
|
+
IPropsLocalReserve,
|
|
11
|
+
IPropsQueryVerifyLocalInformation,
|
|
12
|
+
IType,
|
|
13
|
+
} from "./interfaces";
|
|
7
14
|
import moment = require("moment-timezone");
|
|
8
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
CustomRepository,
|
|
17
|
+
getDiscountsCodeCompanyInformation,
|
|
18
|
+
getDiscountsCodeUserInformation,
|
|
19
|
+
getLocalReservesInformation,
|
|
20
|
+
getLocalsCompanyInformation,
|
|
21
|
+
getLocalsCompanyInformationTable,
|
|
22
|
+
getVerifyLocalsInformation,
|
|
23
|
+
} from "./entities.views.routes";
|
|
9
24
|
export * from "./entities.views.routes";
|
|
10
25
|
import * as EntitiesViewsRoutes from "./entities.index";
|
|
11
26
|
|
|
@@ -134,20 +149,57 @@ export function getTimezoneOffset(timezone: string) {
|
|
|
134
149
|
|
|
135
150
|
export const getRepositoryByEntity = async <T extends ObjectLiteral>(
|
|
136
151
|
entity: EntityTarget<T>,
|
|
137
|
-
)
|
|
152
|
+
) => {
|
|
138
153
|
if (!connection || !connection.isInitialized) {
|
|
139
154
|
connection = createDataBaseSource();
|
|
140
155
|
await connection.initialize();
|
|
141
|
-
console.log(
|
|
142
|
-
"METADATA CARGADA:",
|
|
143
|
-
connection.entityMetadatas.map((e) => e.name),
|
|
144
|
-
);
|
|
145
156
|
}
|
|
146
157
|
|
|
147
|
-
return connection
|
|
148
|
-
|
|
149
|
-
|
|
158
|
+
return connection.getRepository(entity).extend({
|
|
159
|
+
async getDiscountsCodeUserWrapper(params: IPropsDiscountUserOrCompany) {
|
|
160
|
+
return getDiscountsCodeUserInformation(this, params);
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
async getDiscountsCodeCompanyWrapper(params: IBasicLazyEvent) {
|
|
164
|
+
return getDiscountsCodeCompanyInformation(this, params);
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
async getLocalsCompanyInformationWrapper(params: IBasicCompany) {
|
|
168
|
+
return getLocalsCompanyInformation(this, params);
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
async getVerifyLocalsInformationWrapper(
|
|
172
|
+
params: IPropsQueryVerifyLocalInformation,
|
|
173
|
+
) {
|
|
174
|
+
return getVerifyLocalsInformation(this, params);
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
async getLocalReservesInformationWrapper(params: IPropsLocalReserve) {
|
|
178
|
+
return getLocalReservesInformation(this, params);
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
async getLocalsCompanyInformationForTheTableWrapper(params: IBasicCompany) {
|
|
182
|
+
return getLocalsCompanyInformationTable(this, params);
|
|
183
|
+
},
|
|
184
|
+
});
|
|
150
185
|
};
|
|
186
|
+
|
|
187
|
+
// export const getRepositoryByEntity = async <T extends ObjectLiteral>(
|
|
188
|
+
// entity: EntityTarget<T>,
|
|
189
|
+
// ): Promise<CustomRepository<T>> => {
|
|
190
|
+
// if (!connection || !connection.isInitialized) {
|
|
191
|
+
// connection = createDataBaseSource();
|
|
192
|
+
// await connection.initialize();
|
|
193
|
+
// console.log(
|
|
194
|
+
// "METADATA CARGADA:",
|
|
195
|
+
// connection.entityMetadatas.map((e) => e.name),
|
|
196
|
+
// );
|
|
197
|
+
// }
|
|
198
|
+
|
|
199
|
+
// return connection
|
|
200
|
+
// .getRepository(entity)
|
|
201
|
+
// .extend(CustomRepository.prototype) as CustomRepository<T>;
|
|
202
|
+
// };
|
|
151
203
|
// export const getRepositoryByEntity = async <T extends ObjectLiteral>(
|
|
152
204
|
// entity: EntityTarget<T>,
|
|
153
205
|
// ): Promise<CustomRepository<T>> => {
|