@mondart/nestjs-common-module 1.1.29 → 1.1.31
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.
|
@@ -2,8 +2,8 @@ export declare class BaseSuccessResponse<type> {
|
|
|
2
2
|
data: type;
|
|
3
3
|
metadata: object;
|
|
4
4
|
message: string;
|
|
5
|
-
|
|
5
|
+
status: number;
|
|
6
6
|
}
|
|
7
7
|
export declare class SuccessResponse<type> extends BaseSuccessResponse<type> {
|
|
8
|
-
constructor(data: type, message?: string,
|
|
8
|
+
constructor(data: type, message?: string, status?: number, metadata?: any);
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SuccessResponse = exports.BaseSuccessResponse = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
-
const
|
|
14
|
+
const enums_1 = require("../../enums");
|
|
15
15
|
class BaseSuccessResponse {
|
|
16
16
|
}
|
|
17
17
|
exports.BaseSuccessResponse = BaseSuccessResponse;
|
|
@@ -24,19 +24,19 @@ __decorate([
|
|
|
24
24
|
__metadata("design:type", Object)
|
|
25
25
|
], BaseSuccessResponse.prototype, "metadata", void 0);
|
|
26
26
|
__decorate([
|
|
27
|
-
(0, swagger_1.ApiProperty)({ type: String, default:
|
|
27
|
+
(0, swagger_1.ApiProperty)({ type: String, default: enums_1.SharedMessages.SUCCESSFUL }),
|
|
28
28
|
__metadata("design:type", String)
|
|
29
29
|
], BaseSuccessResponse.prototype, "message", void 0);
|
|
30
30
|
__decorate([
|
|
31
31
|
(0, swagger_1.ApiProperty)({ type: Number, default: 200 }),
|
|
32
32
|
__metadata("design:type", Number)
|
|
33
|
-
], BaseSuccessResponse.prototype, "
|
|
33
|
+
], BaseSuccessResponse.prototype, "status", void 0);
|
|
34
34
|
class SuccessResponse extends BaseSuccessResponse {
|
|
35
|
-
constructor(data, message = null,
|
|
35
|
+
constructor(data, message = null, status = 200, metadata = null) {
|
|
36
36
|
super();
|
|
37
37
|
this.data = data;
|
|
38
38
|
this.message = message;
|
|
39
|
-
this.
|
|
39
|
+
this.status = status;
|
|
40
40
|
this.metadata = metadata;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -80,8 +80,8 @@ class CoreCrudService {
|
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
82
|
result = await this.repository.findOne({
|
|
83
|
+
relations: options?.relations ? options?.relations : this.relationsPath,
|
|
83
84
|
...query,
|
|
84
|
-
relations: query?.relations ? query?.relations : this.relationsPath,
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
if (options?.existsCheck && !result) {
|
|
@@ -94,14 +94,14 @@ class CoreCrudService {
|
|
|
94
94
|
query.where = this.whereQueryTransformer(query.where) ?? undefined;
|
|
95
95
|
if (options?.entityManager) {
|
|
96
96
|
result = await options?.entityManager.exists(this.repository.target, {
|
|
97
|
-
relations:
|
|
97
|
+
relations: options?.relations ? options?.relations : this.relationsPath,
|
|
98
98
|
...query,
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
else {
|
|
102
102
|
result = await this.repository.exists({
|
|
103
|
+
relations: options?.relations ? options?.relations : this.relationsPath,
|
|
103
104
|
...query,
|
|
104
|
-
relations: query?.relations ? query?.relations : this.relationsPath,
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
return result;
|
|
@@ -111,14 +111,14 @@ class CoreCrudService {
|
|
|
111
111
|
query.where = this.whereQueryTransformer(query.where) ?? undefined;
|
|
112
112
|
if (options?.entityManager) {
|
|
113
113
|
result = await options?.entityManager.count(this.repository.target, {
|
|
114
|
-
relations:
|
|
114
|
+
relations: options?.relations ? options?.relations : this.relationsPath,
|
|
115
115
|
...query,
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
else {
|
|
119
119
|
result = await this.repository.count({
|
|
120
|
+
relations: options?.relations ? options?.relations : this.relationsPath,
|
|
120
121
|
...query,
|
|
121
|
-
relations: query?.relations ? query?.relations : this.relationsPath,
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
return result;
|