@flusys/nestjs-shared 5.1.1 → 5.1.2
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/cjs/classes/api-controller.class.js +16 -10
- package/cjs/classes/api-service.class.js +4 -6
- package/cjs/dtos/identity-response.dto.js +4 -8
- package/cjs/entities/identity.js +8 -2
- package/classes/api-controller.class.d.ts +1 -0
- package/fesm/classes/api-controller.class.js +16 -10
- package/fesm/classes/api-service.class.js +4 -6
- package/fesm/dtos/identity-response.dto.js +4 -8
- package/fesm/entities/identity.js +8 -2
- package/package.json +2 -2
|
@@ -11,11 +11,11 @@ Object.defineProperty(exports, "createApiController", {
|
|
|
11
11
|
const _common = require("@nestjs/common");
|
|
12
12
|
const _swagger = require("@nestjs/swagger");
|
|
13
13
|
const _classtransformer = require("class-transformer");
|
|
14
|
+
const _messagekeys = require("../constants/message-keys");
|
|
14
15
|
const _decorators = require("../decorators");
|
|
15
16
|
const _apiresponsedecorator = require("../decorators/api-response.decorator");
|
|
16
17
|
const _dtos = require("../dtos");
|
|
17
18
|
const _exceptions = require("../exceptions");
|
|
18
|
-
const _messagekeys = require("../constants/message-keys");
|
|
19
19
|
const _guards = require("../guards");
|
|
20
20
|
const _interceptors = require("../interceptors");
|
|
21
21
|
function _define_property(obj, key, value) {
|
|
@@ -108,6 +108,12 @@ function _ts_param(paramIndex, decorator) {
|
|
|
108
108
|
return (0, _common.applyDecorators)(...decorators);
|
|
109
109
|
}
|
|
110
110
|
function createApiController(createDtoClass, updateDtoClass, responseDtoClass, options = {}) {
|
|
111
|
+
const excludeExtraneousValues = options.excludeExtraneousValues ?? true;
|
|
112
|
+
function toDto(cls, input) {
|
|
113
|
+
return (0, _classtransformer.plainToInstance)(cls, input, {
|
|
114
|
+
excludeExtraneousValues
|
|
115
|
+
});
|
|
116
|
+
}
|
|
111
117
|
// Entity name for message keys (defaults to 'item')
|
|
112
118
|
const entityName = options.entityName ?? 'item';
|
|
113
119
|
// Determine if security is global (applies to all) or per-endpoint
|
|
@@ -163,7 +169,7 @@ function createApiController(createDtoClass, updateDtoClass, responseDtoClass, o
|
|
|
163
169
|
});
|
|
164
170
|
}
|
|
165
171
|
const entity = await this.service.insert(addDto, user);
|
|
166
|
-
const data = (
|
|
172
|
+
const data = toDto(responseDtoClass, entity);
|
|
167
173
|
return {
|
|
168
174
|
success: true,
|
|
169
175
|
message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} created successfully`,
|
|
@@ -183,7 +189,7 @@ function createApiController(createDtoClass, updateDtoClass, responseDtoClass, o
|
|
|
183
189
|
});
|
|
184
190
|
}
|
|
185
191
|
const entities = await this.service.insertMany(addDto, user);
|
|
186
|
-
const data = entities.map((item)=>(
|
|
192
|
+
const data = entities.map((item)=>toDto(responseDtoClass, item));
|
|
187
193
|
return {
|
|
188
194
|
success: true,
|
|
189
195
|
message: `${data.length} ${entityName}s created successfully`,
|
|
@@ -211,7 +217,7 @@ function createApiController(createDtoClass, updateDtoClass, responseDtoClass, o
|
|
|
211
217
|
});
|
|
212
218
|
}
|
|
213
219
|
const entity = await this.service.findById(id, user, body?.select);
|
|
214
|
-
const data = (
|
|
220
|
+
const data = toDto(responseDtoClass, entity);
|
|
215
221
|
return {
|
|
216
222
|
success: true,
|
|
217
223
|
message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} retrieved successfully`,
|
|
@@ -231,7 +237,7 @@ function createApiController(createDtoClass, updateDtoClass, responseDtoClass, o
|
|
|
231
237
|
});
|
|
232
238
|
}
|
|
233
239
|
const entities = await this.service.findByIds(body.ids, user, body?.select);
|
|
234
|
-
const data = (
|
|
240
|
+
const data = entities.map((item)=>toDto(responseDtoClass, item));
|
|
235
241
|
return {
|
|
236
242
|
success: true,
|
|
237
243
|
message: `${data.length} ${entityName}${data.length !== 1 ? 's' : ''} retrieved successfully`,
|
|
@@ -258,7 +264,7 @@ function createApiController(createDtoClass, updateDtoClass, responseDtoClass, o
|
|
|
258
264
|
});
|
|
259
265
|
}
|
|
260
266
|
const entity = await this.service.update(updateDto, user);
|
|
261
|
-
const data = (
|
|
267
|
+
const data = toDto(responseDtoClass, entity);
|
|
262
268
|
return {
|
|
263
269
|
success: true,
|
|
264
270
|
message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} updated successfully`,
|
|
@@ -278,7 +284,7 @@ function createApiController(createDtoClass, updateDtoClass, responseDtoClass, o
|
|
|
278
284
|
});
|
|
279
285
|
}
|
|
280
286
|
const entities = await this.service.updateMany(updateDtos, user);
|
|
281
|
-
const data = (
|
|
287
|
+
const data = entities.map((item)=>toDto(responseDtoClass, item));
|
|
282
288
|
return {
|
|
283
289
|
success: true,
|
|
284
290
|
message: `${data.length} ${entityName}s updated successfully`,
|
|
@@ -315,7 +321,7 @@ function createApiController(createDtoClass, updateDtoClass, responseDtoClass, o
|
|
|
315
321
|
}
|
|
316
322
|
}
|
|
317
323
|
const allEntities = await this.service.bulkUpsert(toInsert, toUpdate, user);
|
|
318
|
-
const data = (
|
|
324
|
+
const data = allEntities.map((item)=>toDto(responseDtoClass, item));
|
|
319
325
|
return {
|
|
320
326
|
success: true,
|
|
321
327
|
message: `${data.length} ${entityName}s upserted successfully`,
|
|
@@ -353,7 +359,7 @@ function createApiController(createDtoClass, updateDtoClass, responseDtoClass, o
|
|
|
353
359
|
throw new _exceptions.NotFoundException(entityName);
|
|
354
360
|
}
|
|
355
361
|
const entity = result.data[0];
|
|
356
|
-
const data = (
|
|
362
|
+
const data = toDto(responseDtoClass, entity);
|
|
357
363
|
return {
|
|
358
364
|
success: true,
|
|
359
365
|
message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} retrieved successfully`,
|
|
@@ -373,7 +379,7 @@ function createApiController(createDtoClass, updateDtoClass, responseDtoClass, o
|
|
|
373
379
|
});
|
|
374
380
|
}
|
|
375
381
|
const result = await this.service.getAll(search ?? '', filterAndPaginationDto, user);
|
|
376
|
-
const data = (
|
|
382
|
+
const data = result.data.map((item)=>toDto(responseDtoClass, item));
|
|
377
383
|
const page = filterAndPaginationDto.pagination?.currentPage ?? 0;
|
|
378
384
|
const pageSize = filterAndPaginationDto.pagination?.pageSize ?? data.length;
|
|
379
385
|
const totalPages = pageSize > 0 ? Math.ceil(result.total / pageSize) : 1;
|
|
@@ -195,12 +195,10 @@ let ApiService = class ApiService {
|
|
|
195
195
|
query = searchQuery;
|
|
196
196
|
isRaw = isRaw || searchIsRaw;
|
|
197
197
|
}
|
|
198
|
-
// Apply select
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
isRaw = isRaw || selectIsRaw;
|
|
203
|
-
}
|
|
198
|
+
// Apply select — always call so subclasses can define a default column set
|
|
199
|
+
const { query: selectQuery, isRaw: selectIsRaw } = await this.getSelectQuery(query, user, filterAndPaginationDto.select);
|
|
200
|
+
query = selectQuery;
|
|
201
|
+
isRaw = isRaw || selectIsRaw;
|
|
204
202
|
// Apply sort
|
|
205
203
|
if (filterAndPaginationDto.sort) {
|
|
206
204
|
const { query: sortQuery, isRaw: sortIsRaw } = await this.getSortQuery(query, filterAndPaginationDto.sort, user);
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "IdentityResponseDto", {
|
|
|
8
8
|
return IdentityResponseDto;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _classtransformer = require("class-transformer");
|
|
12
11
|
const _swagger = require("@nestjs/swagger");
|
|
12
|
+
const _classtransformer = require("class-transformer");
|
|
13
13
|
function _define_property(obj, key, value) {
|
|
14
14
|
if (key in obj) {
|
|
15
15
|
Object.defineProperty(obj, key, {
|
|
@@ -44,28 +44,28 @@ let IdentityResponseDto = class IdentityResponseDto {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
_ts_decorate([
|
|
47
|
+
(0, _classtransformer.Expose)(),
|
|
47
48
|
(0, _swagger.ApiProperty)({
|
|
48
49
|
type: String,
|
|
49
50
|
format: 'uuid'
|
|
50
51
|
}),
|
|
51
|
-
(0, _classtransformer.Expose)(),
|
|
52
52
|
_ts_metadata("design:type", String)
|
|
53
53
|
], IdentityResponseDto.prototype, "id", void 0);
|
|
54
54
|
_ts_decorate([
|
|
55
|
+
(0, _classtransformer.Expose)(),
|
|
55
56
|
(0, _swagger.ApiProperty)({
|
|
56
57
|
type: String,
|
|
57
58
|
format: 'date-time'
|
|
58
59
|
}),
|
|
59
|
-
(0, _classtransformer.Expose)(),
|
|
60
60
|
(0, _classtransformer.Type)(()=>Date),
|
|
61
61
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
62
62
|
], IdentityResponseDto.prototype, "createdAt", void 0);
|
|
63
63
|
_ts_decorate([
|
|
64
|
+
(0, _classtransformer.Expose)(),
|
|
64
65
|
(0, _swagger.ApiProperty)({
|
|
65
66
|
type: String,
|
|
66
67
|
format: 'date-time'
|
|
67
68
|
}),
|
|
68
|
-
(0, _classtransformer.Expose)(),
|
|
69
69
|
(0, _classtransformer.Type)(()=>Date),
|
|
70
70
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
71
71
|
], IdentityResponseDto.prototype, "updatedAt", void 0);
|
|
@@ -76,7 +76,6 @@ _ts_decorate([
|
|
|
76
76
|
nullable: true,
|
|
77
77
|
required: false
|
|
78
78
|
}),
|
|
79
|
-
(0, _classtransformer.Expose)(),
|
|
80
79
|
(0, _classtransformer.Type)(()=>Date),
|
|
81
80
|
_ts_metadata("design:type", Object)
|
|
82
81
|
], IdentityResponseDto.prototype, "deletedAt", void 0);
|
|
@@ -87,7 +86,6 @@ _ts_decorate([
|
|
|
87
86
|
nullable: true,
|
|
88
87
|
required: false
|
|
89
88
|
}),
|
|
90
|
-
(0, _classtransformer.Expose)(),
|
|
91
89
|
_ts_metadata("design:type", Object)
|
|
92
90
|
], IdentityResponseDto.prototype, "createdById", void 0);
|
|
93
91
|
_ts_decorate([
|
|
@@ -97,7 +95,6 @@ _ts_decorate([
|
|
|
97
95
|
nullable: true,
|
|
98
96
|
required: false
|
|
99
97
|
}),
|
|
100
|
-
(0, _classtransformer.Expose)(),
|
|
101
98
|
_ts_metadata("design:type", Object)
|
|
102
99
|
], IdentityResponseDto.prototype, "updatedById", void 0);
|
|
103
100
|
_ts_decorate([
|
|
@@ -107,6 +104,5 @@ _ts_decorate([
|
|
|
107
104
|
nullable: true,
|
|
108
105
|
required: false
|
|
109
106
|
}),
|
|
110
|
-
(0, _classtransformer.Expose)(),
|
|
111
107
|
_ts_metadata("design:type", Object)
|
|
112
108
|
], IdentityResponseDto.prototype, "deletedById", void 0);
|
package/cjs/entities/identity.js
CHANGED
|
@@ -49,14 +49,16 @@ _ts_decorate([
|
|
|
49
49
|
_ts_decorate([
|
|
50
50
|
(0, _typeorm.CreateDateColumn)({
|
|
51
51
|
name: 'created_at',
|
|
52
|
-
type: 'timestamp'
|
|
52
|
+
type: 'timestamp',
|
|
53
|
+
select: false
|
|
53
54
|
}),
|
|
54
55
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
55
56
|
], Identity.prototype, "createdAt", void 0);
|
|
56
57
|
_ts_decorate([
|
|
57
58
|
(0, _typeorm.UpdateDateColumn)({
|
|
58
59
|
name: 'updated_at',
|
|
59
|
-
type: 'timestamp'
|
|
60
|
+
type: 'timestamp',
|
|
61
|
+
select: false
|
|
60
62
|
}),
|
|
61
63
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
62
64
|
], Identity.prototype, "updatedAt", void 0);
|
|
@@ -64,6 +66,7 @@ _ts_decorate([
|
|
|
64
66
|
(0, _typeorm.DeleteDateColumn)({
|
|
65
67
|
name: 'deleted_at',
|
|
66
68
|
type: 'timestamp',
|
|
69
|
+
select: false,
|
|
67
70
|
nullable: true
|
|
68
71
|
}),
|
|
69
72
|
_ts_metadata("design:type", Object)
|
|
@@ -72,6 +75,7 @@ _ts_decorate([
|
|
|
72
75
|
(0, _typeorm.Column)({
|
|
73
76
|
name: 'created_by_id',
|
|
74
77
|
type: 'uuid',
|
|
78
|
+
select: false,
|
|
75
79
|
nullable: true
|
|
76
80
|
}),
|
|
77
81
|
_ts_metadata("design:type", Object)
|
|
@@ -80,6 +84,7 @@ _ts_decorate([
|
|
|
80
84
|
(0, _typeorm.Column)({
|
|
81
85
|
name: 'updated_by_id',
|
|
82
86
|
type: 'uuid',
|
|
87
|
+
select: false,
|
|
83
88
|
nullable: true
|
|
84
89
|
}),
|
|
85
90
|
_ts_metadata("design:type", Object)
|
|
@@ -88,6 +93,7 @@ _ts_decorate([
|
|
|
88
93
|
(0, _typeorm.Column)({
|
|
89
94
|
name: 'deleted_by_id',
|
|
90
95
|
type: 'uuid',
|
|
96
|
+
select: false,
|
|
91
97
|
nullable: true
|
|
92
98
|
}),
|
|
93
99
|
_ts_metadata("design:type", Object)
|
|
@@ -17,6 +17,7 @@ export interface ApiControllerOptions {
|
|
|
17
17
|
security?: ApiSecurityConfig | EndpointSecurity | SecurityLevel;
|
|
18
18
|
entityName?: string;
|
|
19
19
|
enabledEndpoints?: ApiEndpoint[] | 'all';
|
|
20
|
+
excludeExtraneousValues?: boolean;
|
|
20
21
|
}
|
|
21
22
|
export declare function createApiController<CreateDtoT extends object, UpdateDtoT extends {
|
|
22
23
|
id: string;
|
|
@@ -28,11 +28,11 @@ function _ts_param(paramIndex, decorator) {
|
|
|
28
28
|
import { applyDecorators, Body, HttpCode, HttpStatus, Param, Post, Query, UseGuards, UseInterceptors, Version, VERSION_NEUTRAL } from '@nestjs/common';
|
|
29
29
|
import { ApiBearerAuth, ApiBody, ApiExcludeEndpoint, ApiHeader, ApiOperation, ApiParam, ApiQuery, ApiResponse } from '@nestjs/swagger';
|
|
30
30
|
import { plainToInstance } from 'class-transformer';
|
|
31
|
+
import { ERROR_MESSAGES } from '../constants/message-keys';
|
|
31
32
|
import { CurrentUser, Public, RequireAnyPermission, RequirePermission, RequirePermissionLogic } from '../decorators';
|
|
32
33
|
import { ApiResponseDto } from '../decorators/api-response.decorator';
|
|
33
34
|
import { DeleteDto, FilterAndPaginationDto, GetByIdBodyDto, GetByIdsDto } from '../dtos';
|
|
34
35
|
import { BaseAppException, NotFoundException } from '../exceptions';
|
|
35
|
-
import { ERROR_MESSAGES } from '../constants/message-keys';
|
|
36
36
|
import { JwtAuthGuard, PermissionGuard } from '../guards';
|
|
37
37
|
import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpdateByOnBody, Slug } from '../interceptors';
|
|
38
38
|
/**
|
|
@@ -98,6 +98,12 @@ import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpda
|
|
|
98
98
|
return applyDecorators(...decorators);
|
|
99
99
|
}
|
|
100
100
|
/** Creates an API Controller with standardized CRUD endpoints (POST-only RPC pattern) */ export function createApiController(createDtoClass, updateDtoClass, responseDtoClass, options = {}) {
|
|
101
|
+
const excludeExtraneousValues = options.excludeExtraneousValues ?? true;
|
|
102
|
+
function toDto(cls, input) {
|
|
103
|
+
return plainToInstance(cls, input, {
|
|
104
|
+
excludeExtraneousValues
|
|
105
|
+
});
|
|
106
|
+
}
|
|
101
107
|
// Entity name for message keys (defaults to 'item')
|
|
102
108
|
const entityName = options.entityName ?? 'item';
|
|
103
109
|
// Determine if security is global (applies to all) or per-endpoint
|
|
@@ -153,7 +159,7 @@ import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpda
|
|
|
153
159
|
});
|
|
154
160
|
}
|
|
155
161
|
const entity = await this.service.insert(addDto, user);
|
|
156
|
-
const data =
|
|
162
|
+
const data = toDto(responseDtoClass, entity);
|
|
157
163
|
return {
|
|
158
164
|
success: true,
|
|
159
165
|
message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} created successfully`,
|
|
@@ -173,7 +179,7 @@ import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpda
|
|
|
173
179
|
});
|
|
174
180
|
}
|
|
175
181
|
const entities = await this.service.insertMany(addDto, user);
|
|
176
|
-
const data = entities.map((item)=>
|
|
182
|
+
const data = entities.map((item)=>toDto(responseDtoClass, item));
|
|
177
183
|
return {
|
|
178
184
|
success: true,
|
|
179
185
|
message: `${data.length} ${entityName}s created successfully`,
|
|
@@ -201,7 +207,7 @@ import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpda
|
|
|
201
207
|
});
|
|
202
208
|
}
|
|
203
209
|
const entity = await this.service.findById(id, user, body?.select);
|
|
204
|
-
const data =
|
|
210
|
+
const data = toDto(responseDtoClass, entity);
|
|
205
211
|
return {
|
|
206
212
|
success: true,
|
|
207
213
|
message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} retrieved successfully`,
|
|
@@ -221,7 +227,7 @@ import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpda
|
|
|
221
227
|
});
|
|
222
228
|
}
|
|
223
229
|
const entities = await this.service.findByIds(body.ids, user, body?.select);
|
|
224
|
-
const data =
|
|
230
|
+
const data = entities.map((item)=>toDto(responseDtoClass, item));
|
|
225
231
|
return {
|
|
226
232
|
success: true,
|
|
227
233
|
message: `${data.length} ${entityName}${data.length !== 1 ? 's' : ''} retrieved successfully`,
|
|
@@ -248,7 +254,7 @@ import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpda
|
|
|
248
254
|
});
|
|
249
255
|
}
|
|
250
256
|
const entity = await this.service.update(updateDto, user);
|
|
251
|
-
const data =
|
|
257
|
+
const data = toDto(responseDtoClass, entity);
|
|
252
258
|
return {
|
|
253
259
|
success: true,
|
|
254
260
|
message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} updated successfully`,
|
|
@@ -268,7 +274,7 @@ import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpda
|
|
|
268
274
|
});
|
|
269
275
|
}
|
|
270
276
|
const entities = await this.service.updateMany(updateDtos, user);
|
|
271
|
-
const data =
|
|
277
|
+
const data = entities.map((item)=>toDto(responseDtoClass, item));
|
|
272
278
|
return {
|
|
273
279
|
success: true,
|
|
274
280
|
message: `${data.length} ${entityName}s updated successfully`,
|
|
@@ -305,7 +311,7 @@ import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpda
|
|
|
305
311
|
}
|
|
306
312
|
}
|
|
307
313
|
const allEntities = await this.service.bulkUpsert(toInsert, toUpdate, user);
|
|
308
|
-
const data =
|
|
314
|
+
const data = allEntities.map((item)=>toDto(responseDtoClass, item));
|
|
309
315
|
return {
|
|
310
316
|
success: true,
|
|
311
317
|
message: `${data.length} ${entityName}s upserted successfully`,
|
|
@@ -343,7 +349,7 @@ import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpda
|
|
|
343
349
|
throw new NotFoundException(entityName);
|
|
344
350
|
}
|
|
345
351
|
const entity = result.data[0];
|
|
346
|
-
const data =
|
|
352
|
+
const data = toDto(responseDtoClass, entity);
|
|
347
353
|
return {
|
|
348
354
|
success: true,
|
|
349
355
|
message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} retrieved successfully`,
|
|
@@ -363,7 +369,7 @@ import { IdempotencyInterceptor, SetCreatedByOnBody, SetDeletedByOnBody, SetUpda
|
|
|
363
369
|
});
|
|
364
370
|
}
|
|
365
371
|
const result = await this.service.getAll(search ?? '', filterAndPaginationDto, user);
|
|
366
|
-
const data =
|
|
372
|
+
const data = result.data.map((item)=>toDto(responseDtoClass, item));
|
|
367
373
|
const page = filterAndPaginationDto.pagination?.currentPage ?? 0;
|
|
368
374
|
const pageSize = filterAndPaginationDto.pagination?.pageSize ?? data.length;
|
|
369
375
|
const totalPages = pageSize > 0 ? Math.ceil(result.total / pageSize) : 1;
|
|
@@ -185,12 +185,10 @@ import { DeleteDto } from '../dtos';
|
|
|
185
185
|
query = searchQuery;
|
|
186
186
|
isRaw = isRaw || searchIsRaw;
|
|
187
187
|
}
|
|
188
|
-
// Apply select
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
isRaw = isRaw || selectIsRaw;
|
|
193
|
-
}
|
|
188
|
+
// Apply select — always call so subclasses can define a default column set
|
|
189
|
+
const { query: selectQuery, isRaw: selectIsRaw } = await this.getSelectQuery(query, user, filterAndPaginationDto.select);
|
|
190
|
+
query = selectQuery;
|
|
191
|
+
isRaw = isRaw || selectIsRaw;
|
|
194
192
|
// Apply sort
|
|
195
193
|
if (filterAndPaginationDto.sort) {
|
|
196
194
|
const { query: sortQuery, isRaw: sortIsRaw } = await this.getSortQuery(query, filterAndPaginationDto.sort, user);
|
|
@@ -20,8 +20,8 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
20
20
|
function _ts_metadata(k, v) {
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
22
|
}
|
|
23
|
-
import { Expose, Type } from 'class-transformer';
|
|
24
23
|
import { ApiProperty } from '@nestjs/swagger';
|
|
24
|
+
import { Expose, Type } from 'class-transformer';
|
|
25
25
|
export class IdentityResponseDto {
|
|
26
26
|
constructor(){
|
|
27
27
|
_define_property(this, "id", void 0);
|
|
@@ -34,28 +34,28 @@ export class IdentityResponseDto {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
_ts_decorate([
|
|
37
|
+
Expose(),
|
|
37
38
|
ApiProperty({
|
|
38
39
|
type: String,
|
|
39
40
|
format: 'uuid'
|
|
40
41
|
}),
|
|
41
|
-
Expose(),
|
|
42
42
|
_ts_metadata("design:type", String)
|
|
43
43
|
], IdentityResponseDto.prototype, "id", void 0);
|
|
44
44
|
_ts_decorate([
|
|
45
|
+
Expose(),
|
|
45
46
|
ApiProperty({
|
|
46
47
|
type: String,
|
|
47
48
|
format: 'date-time'
|
|
48
49
|
}),
|
|
49
|
-
Expose(),
|
|
50
50
|
Type(()=>Date),
|
|
51
51
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
52
52
|
], IdentityResponseDto.prototype, "createdAt", void 0);
|
|
53
53
|
_ts_decorate([
|
|
54
|
+
Expose(),
|
|
54
55
|
ApiProperty({
|
|
55
56
|
type: String,
|
|
56
57
|
format: 'date-time'
|
|
57
58
|
}),
|
|
58
|
-
Expose(),
|
|
59
59
|
Type(()=>Date),
|
|
60
60
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
61
61
|
], IdentityResponseDto.prototype, "updatedAt", void 0);
|
|
@@ -66,7 +66,6 @@ _ts_decorate([
|
|
|
66
66
|
nullable: true,
|
|
67
67
|
required: false
|
|
68
68
|
}),
|
|
69
|
-
Expose(),
|
|
70
69
|
Type(()=>Date),
|
|
71
70
|
_ts_metadata("design:type", Object)
|
|
72
71
|
], IdentityResponseDto.prototype, "deletedAt", void 0);
|
|
@@ -77,7 +76,6 @@ _ts_decorate([
|
|
|
77
76
|
nullable: true,
|
|
78
77
|
required: false
|
|
79
78
|
}),
|
|
80
|
-
Expose(),
|
|
81
79
|
_ts_metadata("design:type", Object)
|
|
82
80
|
], IdentityResponseDto.prototype, "createdById", void 0);
|
|
83
81
|
_ts_decorate([
|
|
@@ -87,7 +85,6 @@ _ts_decorate([
|
|
|
87
85
|
nullable: true,
|
|
88
86
|
required: false
|
|
89
87
|
}),
|
|
90
|
-
Expose(),
|
|
91
88
|
_ts_metadata("design:type", Object)
|
|
92
89
|
], IdentityResponseDto.prototype, "updatedById", void 0);
|
|
93
90
|
_ts_decorate([
|
|
@@ -97,6 +94,5 @@ _ts_decorate([
|
|
|
97
94
|
nullable: true,
|
|
98
95
|
required: false
|
|
99
96
|
}),
|
|
100
|
-
Expose(),
|
|
101
97
|
_ts_metadata("design:type", Object)
|
|
102
98
|
], IdentityResponseDto.prototype, "deletedById", void 0);
|
|
@@ -39,14 +39,16 @@ _ts_decorate([
|
|
|
39
39
|
_ts_decorate([
|
|
40
40
|
CreateDateColumn({
|
|
41
41
|
name: 'created_at',
|
|
42
|
-
type: 'timestamp'
|
|
42
|
+
type: 'timestamp',
|
|
43
|
+
select: false
|
|
43
44
|
}),
|
|
44
45
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
45
46
|
], Identity.prototype, "createdAt", void 0);
|
|
46
47
|
_ts_decorate([
|
|
47
48
|
UpdateDateColumn({
|
|
48
49
|
name: 'updated_at',
|
|
49
|
-
type: 'timestamp'
|
|
50
|
+
type: 'timestamp',
|
|
51
|
+
select: false
|
|
50
52
|
}),
|
|
51
53
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
52
54
|
], Identity.prototype, "updatedAt", void 0);
|
|
@@ -54,6 +56,7 @@ _ts_decorate([
|
|
|
54
56
|
DeleteDateColumn({
|
|
55
57
|
name: 'deleted_at',
|
|
56
58
|
type: 'timestamp',
|
|
59
|
+
select: false,
|
|
57
60
|
nullable: true
|
|
58
61
|
}),
|
|
59
62
|
_ts_metadata("design:type", Object)
|
|
@@ -62,6 +65,7 @@ _ts_decorate([
|
|
|
62
65
|
Column({
|
|
63
66
|
name: 'created_by_id',
|
|
64
67
|
type: 'uuid',
|
|
68
|
+
select: false,
|
|
65
69
|
nullable: true
|
|
66
70
|
}),
|
|
67
71
|
_ts_metadata("design:type", Object)
|
|
@@ -70,6 +74,7 @@ _ts_decorate([
|
|
|
70
74
|
Column({
|
|
71
75
|
name: 'updated_by_id',
|
|
72
76
|
type: 'uuid',
|
|
77
|
+
select: false,
|
|
73
78
|
nullable: true
|
|
74
79
|
}),
|
|
75
80
|
_ts_metadata("design:type", Object)
|
|
@@ -78,6 +83,7 @@ _ts_decorate([
|
|
|
78
83
|
Column({
|
|
79
84
|
name: 'deleted_by_id',
|
|
80
85
|
type: 'uuid',
|
|
86
|
+
select: false,
|
|
81
87
|
nullable: true
|
|
82
88
|
}),
|
|
83
89
|
_ts_metadata("design:type", Object)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flusys/nestjs-shared",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"description": "Common shared utilities for Flusys NestJS applications",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "fesm/index.js",
|
|
@@ -112,6 +112,6 @@
|
|
|
112
112
|
"rxjs": "^7.8.0"
|
|
113
113
|
},
|
|
114
114
|
"dependencies": {
|
|
115
|
-
"@flusys/nestjs-core": "5.1.
|
|
115
|
+
"@flusys/nestjs-core": "5.1.2"
|
|
116
116
|
}
|
|
117
117
|
}
|