@servicelabsco/nestjs-utility-services 1.2.90 → 1.2.91
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/app.controller.d.ts +3 -1
- package/dist/app.controller.js +5 -2
- package/dist/app.controller.js.map +1 -1
- package/dist/platformUtility/services/sql.service.d.ts +2 -2
- package/dist/platformUtility/services/sql.service.js +11 -5
- package/dist/platformUtility/services/sql.service.js.map +1 -1
- package/package.json +1 -1
package/dist/app.controller.d.ts
CHANGED
@@ -2,6 +2,7 @@ import { Request } from 'express';
|
|
2
2
|
import { TestJob } from './platformUtility/jobs/test.job';
|
3
3
|
import { MailService } from './platformUtility/services/mail.service';
|
4
4
|
import { QueueService } from './platformUtility/services/queue.service';
|
5
|
+
import { SqlService } from './platformUtility/services/sql.service';
|
5
6
|
import { SetScheduledEventJob } from './system/jobs/set.scheduled.event.job';
|
6
7
|
import { PropertyService } from './system/services/property.service';
|
7
8
|
export declare class AppController {
|
@@ -10,7 +11,8 @@ export declare class AppController {
|
|
10
11
|
protected readonly setScheduledEventJob: SetScheduledEventJob;
|
11
12
|
protected readonly mailService: MailService;
|
12
13
|
protected readonly propertyService: PropertyService;
|
13
|
-
|
14
|
+
protected readonly sqlService: SqlService;
|
15
|
+
constructor(queueService: QueueService, testJob: TestJob, setScheduledEventJob: SetScheduledEventJob, mailService: MailService, propertyService: PropertyService, sqlService: SqlService);
|
14
16
|
get(): Promise<{
|
15
17
|
message: string;
|
16
18
|
}>;
|
package/dist/app.controller.js
CHANGED
@@ -18,15 +18,17 @@ const auth_1 = require("./common/libraries/auth");
|
|
18
18
|
const test_job_1 = require("./platformUtility/jobs/test.job");
|
19
19
|
const mail_service_1 = require("./platformUtility/services/mail.service");
|
20
20
|
const queue_service_1 = require("./platformUtility/services/queue.service");
|
21
|
+
const sql_service_1 = require("./platformUtility/services/sql.service");
|
21
22
|
const set_scheduled_event_job_1 = require("./system/jobs/set.scheduled.event.job");
|
22
23
|
const property_service_1 = require("./system/services/property.service");
|
23
24
|
let AppController = class AppController {
|
24
|
-
constructor(queueService, testJob, setScheduledEventJob, mailService, propertyService) {
|
25
|
+
constructor(queueService, testJob, setScheduledEventJob, mailService, propertyService, sqlService) {
|
25
26
|
this.queueService = queueService;
|
26
27
|
this.testJob = testJob;
|
27
28
|
this.setScheduledEventJob = setScheduledEventJob;
|
28
29
|
this.mailService = mailService;
|
29
30
|
this.propertyService = propertyService;
|
31
|
+
this.sqlService = sqlService;
|
30
32
|
}
|
31
33
|
async get() {
|
32
34
|
return { message: 'Hello World!' };
|
@@ -98,6 +100,7 @@ exports.AppController = AppController = __decorate([
|
|
98
100
|
test_job_1.TestJob,
|
99
101
|
set_scheduled_event_job_1.SetScheduledEventJob,
|
100
102
|
mail_service_1.MailService,
|
101
|
-
property_service_1.PropertyService
|
103
|
+
property_service_1.PropertyService,
|
104
|
+
sql_service_1.SqlService])
|
102
105
|
], AppController);
|
103
106
|
//# sourceMappingURL=app.controller.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0E;AAE1E,kDAA+C;AAC/C,8DAA0D;AAC1D,0EAAsE;AACtE,4EAAwE;AACxE,mFAA6E;AAC7E,yEAAqE;AAG9D,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB,YACqB,YAA0B,EACxB,OAAgB,EAChB,oBAA0C,EAC1C,WAAwB,EACxB,eAAgC;
|
1
|
+
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0E;AAE1E,kDAA+C;AAC/C,8DAA0D;AAC1D,0EAAsE;AACtE,4EAAwE;AACxE,wEAAoE;AACpE,mFAA6E;AAC7E,yEAAqE;AAG9D,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB,YACqB,YAA0B,EACxB,OAAgB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AC,IAAI,CAAC,CAAA;;;;0CAEvB;AAGK;IADL,IAAA,aAAI,EAAC,MAAM,CAAC;IACF,WAAA,IAAA,YAAG,GAAE,CAAA;;;;wCAA+B;wBA5CtC,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAG0B,4BAAY;QACf,kBAAO;QACM,8CAAoB;QAC7B,0BAAW;QACP,kCAAe;QACpB,wBAAU;GAPpC,aAAa,CA6CzB"}
|
@@ -5,8 +5,8 @@ export declare class SqlService {
|
|
5
5
|
constructor(connection: DataSource, readReplica: DataSource);
|
6
6
|
sql(query: string): Promise<any>;
|
7
7
|
read(query: string): Promise<any>;
|
8
|
-
readFirst(query: string): Promise<any>;
|
9
|
-
first(query: string): Promise<any>;
|
8
|
+
readFirst(query: string, column?: string): Promise<any>;
|
9
|
+
first(query: string, column?: string): Promise<any>;
|
10
10
|
getConnection(): DataSource;
|
11
11
|
save(baseClass: any, dto: any): Promise<any>;
|
12
12
|
getAggregateSingle(repository: any, select: string, condition: string): Promise<any>;
|
@@ -15,10 +15,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.SqlService = void 0;
|
16
16
|
const common_1 = require("@nestjs/common");
|
17
17
|
const typeorm_1 = require("@nestjs/typeorm");
|
18
|
+
const Sentry = require("@sentry/node");
|
18
19
|
const class_transformer_1 = require("class-transformer");
|
19
20
|
const typeorm_2 = require("typeorm");
|
20
21
|
const operation_exception_1 = require("../../common/exceptions/operation.exception");
|
21
|
-
const Sentry = require("@sentry/node");
|
22
22
|
let SqlService = class SqlService {
|
23
23
|
constructor(connection, readReplica) {
|
24
24
|
this.connection = connection;
|
@@ -50,13 +50,19 @@ let SqlService = class SqlService {
|
|
50
50
|
}
|
51
51
|
return result;
|
52
52
|
}
|
53
|
-
async readFirst(query) {
|
53
|
+
async readFirst(query, column) {
|
54
54
|
const record = await this.read(query);
|
55
|
-
|
55
|
+
const data = Array.isArray(record) ? record[0] : null;
|
56
|
+
if (!column)
|
57
|
+
return data;
|
58
|
+
return data?.[column];
|
56
59
|
}
|
57
|
-
async first(query) {
|
60
|
+
async first(query, column) {
|
58
61
|
const record = await this.sql(query);
|
59
|
-
|
62
|
+
const data = Array.isArray(record) ? record[0] : null;
|
63
|
+
if (!column)
|
64
|
+
return data;
|
65
|
+
return data?.[column];
|
60
66
|
}
|
61
67
|
getConnection() {
|
62
68
|
return this.connection;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sql.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/sql.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,yDAAoD;AACpD,qCAAqC;AACrC,qFAAiF;
|
1
|
+
{"version":3,"file":"sql.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/sql.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,uCAAuC;AACvC,yDAAoD;AACpD,qCAAqC;AACrC,qFAAiF;AAG1E,IAAM,UAAU,GAAhB,MAAM,UAAU;IACnB,YAEqB,UAAsB,EAGtB,WAAuB;QAHvB,eAAU,GAAV,UAAU,CAAY;QAGtB,gBAAW,GAAX,WAAW,CAAY;IACzC,CAAC;IAQJ,KAAK,CAAC,GAAG,CAAC,KAAa;QACnB,IAAI,MAAM,CAAC;QACX,IAAI,CAAC;YACD,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;YAClD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACnC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAE/B,MAAM,IAAI,wCAAkB,CAAC,2BAA2B,CAAC,CAAC;QAC9D,CAA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