@flusys/nestjs-shared 1.1.0-beta → 1.1.0
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/README.md +504 -724
- package/cjs/classes/api-controller.class.js +9 -24
- package/cjs/classes/api-service.class.js +59 -92
- package/cjs/classes/index.js +1 -0
- package/cjs/classes/winston-logger-adapter.class.js +23 -40
- package/cjs/constants/index.js +14 -0
- package/cjs/constants/permissions.js +184 -0
- package/cjs/decorators/api-response.decorator.js +1 -1
- package/cjs/decorators/index.js +1 -0
- package/cjs/decorators/sanitize-html.decorator.js +36 -0
- package/cjs/dtos/delete.dto.js +10 -0
- package/cjs/dtos/filter-and-pagination.dto.js +24 -34
- package/cjs/dtos/pagination.dto.js +4 -8
- package/cjs/dtos/response-payload.dto.js +0 -116
- package/cjs/entities/identity.js +4 -4
- package/cjs/entities/user-root.js +13 -14
- package/cjs/guards/permission.guard.js +51 -105
- package/cjs/interceptors/index.js +1 -3
- package/cjs/interceptors/set-user-field-on-body.interceptor.js +60 -0
- package/cjs/interceptors/slug.interceptor.js +30 -9
- package/cjs/interfaces/datasource.interface.js +4 -0
- package/cjs/interfaces/index.js +2 -1
- package/cjs/interfaces/module-config.interface.js +4 -0
- package/cjs/middlewares/logger.middleware.js +50 -89
- package/cjs/modules/cache/cache.module.js +3 -3
- package/cjs/modules/datasource/datasource.module.js +11 -14
- package/cjs/modules/datasource/multi-tenant-datasource.service.js +29 -113
- package/cjs/modules/utils/utils.service.js +40 -203
- package/cjs/utils/error-handler.util.js +35 -12
- package/cjs/utils/html-sanitizer.util.js +64 -0
- package/cjs/utils/index.js +4 -0
- package/cjs/utils/query-helpers.util.js +53 -0
- package/cjs/utils/request.util.js +71 -0
- package/cjs/utils/string.util.js +63 -0
- package/classes/api-controller.class.d.ts +5 -5
- package/classes/api-service.class.d.ts +7 -5
- package/classes/index.d.ts +1 -0
- package/classes/request-scoped-api.service.d.ts +3 -2
- package/classes/winston-logger-adapter.class.d.ts +2 -0
- package/constants/index.d.ts +1 -0
- package/constants/permissions.d.ts +179 -0
- package/decorators/index.d.ts +1 -0
- package/decorators/sanitize-html.decorator.d.ts +2 -0
- package/dtos/delete.dto.d.ts +1 -0
- package/dtos/filter-and-pagination.dto.d.ts +0 -2
- package/dtos/response-payload.dto.d.ts +0 -20
- package/fesm/classes/api-controller.class.js +9 -24
- package/fesm/classes/api-service.class.js +59 -92
- package/fesm/classes/index.js +2 -0
- package/fesm/classes/winston-logger-adapter.class.js +23 -40
- package/fesm/constants/index.js +2 -0
- package/fesm/constants/permissions.js +128 -0
- package/fesm/decorators/api-response.decorator.js +1 -1
- package/fesm/decorators/index.js +1 -0
- package/fesm/decorators/sanitize-html.decorator.js +45 -0
- package/fesm/dtos/delete.dto.js +12 -2
- package/fesm/dtos/filter-and-pagination.dto.js +26 -47
- package/fesm/dtos/pagination.dto.js +4 -8
- package/fesm/dtos/response-payload.dto.js +0 -107
- package/fesm/entities/identity.js +4 -4
- package/fesm/entities/user-root.js +13 -14
- package/fesm/guards/permission.guard.js +51 -105
- package/fesm/interceptors/index.js +1 -3
- package/fesm/interceptors/set-user-field-on-body.interceptor.js +39 -0
- package/fesm/interceptors/slug.interceptor.js +31 -10
- package/fesm/interfaces/datasource.interface.js +20 -0
- package/fesm/interfaces/index.js +2 -1
- package/fesm/interfaces/module-config.interface.js +5 -0
- package/fesm/middlewares/logger.middleware.js +50 -83
- package/fesm/modules/cache/cache.module.js +2 -2
- package/fesm/modules/datasource/datasource.module.js +11 -14
- package/fesm/modules/datasource/multi-tenant-datasource.service.js +29 -113
- package/fesm/modules/utils/utils.service.js +41 -204
- package/fesm/utils/error-handler.util.js +36 -13
- package/fesm/utils/html-sanitizer.util.js +69 -0
- package/fesm/utils/index.js +4 -0
- package/fesm/utils/query-helpers.util.js +78 -0
- package/fesm/utils/request.util.js +59 -0
- package/fesm/utils/string.util.js +71 -0
- package/guards/permission.guard.d.ts +2 -0
- package/interceptors/index.d.ts +1 -3
- package/interceptors/set-user-field-on-body.interceptor.d.ts +5 -0
- package/interceptors/slug.interceptor.d.ts +2 -1
- package/interfaces/api.interface.d.ts +2 -2
- package/interfaces/datasource.interface.d.ts +5 -0
- package/interfaces/identity.interface.d.ts +4 -4
- package/interfaces/index.d.ts +2 -1
- package/interfaces/logged-user-info.interface.d.ts +0 -2
- package/interfaces/module-config.interface.d.ts +6 -0
- package/interfaces/permission.interface.d.ts +0 -1
- package/middlewares/logger.middleware.d.ts +2 -2
- package/modules/datasource/datasource.module.d.ts +1 -0
- package/modules/datasource/multi-tenant-datasource.service.d.ts +0 -1
- package/modules/utils/utils.service.d.ts +4 -14
- package/package.json +4 -4
- package/utils/error-handler.util.d.ts +14 -19
- package/utils/html-sanitizer.util.d.ts +2 -0
- package/utils/index.d.ts +4 -0
- package/utils/query-helpers.util.d.ts +16 -0
- package/utils/request.util.d.ts +4 -0
- package/utils/string.util.d.ts +2 -0
- package/cjs/interceptors/set-create-by-on-body.interceptor.js +0 -40
- package/cjs/interceptors/set-delete-by-on-body.interceptor.js +0 -40
- package/cjs/interceptors/set-update-by-on-body.interceptor.js +0 -40
- package/cjs/interfaces/base-query.interface.js +0 -6
- package/fesm/interceptors/set-create-by-on-body.interceptor.js +0 -30
- package/fesm/interceptors/set-delete-by-on-body.interceptor.js +0 -30
- package/fesm/interceptors/set-update-by-on-body.interceptor.js +0 -30
- package/fesm/interfaces/base-query.interface.js +0 -3
- package/interceptors/set-create-by-on-body.interceptor.d.ts +0 -5
- package/interceptors/set-delete-by-on-body.interceptor.d.ts +0 -5
- package/interceptors/set-update-by-on-body.interceptor.d.ts +0 -5
- package/interfaces/base-query.interface.d.ts +0 -7
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized Permission Codes
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for all permission codes used across the application.
|
|
5
|
+
* Use these constants instead of hardcoded strings to prevent typos and enable easy refactoring.
|
|
6
|
+
*
|
|
7
|
+
* Naming Convention: <entity>.<action>
|
|
8
|
+
* - entity: The resource being accessed (e.g., user, role, company)
|
|
9
|
+
* - action: The operation being performed (create, read, update, delete, assign)
|
|
10
|
+
*/ // ==================== AUTH MODULE ====================
|
|
11
|
+
export const USER_PERMISSIONS = {
|
|
12
|
+
CREATE: 'user.create',
|
|
13
|
+
READ: 'user.read',
|
|
14
|
+
UPDATE: 'user.update',
|
|
15
|
+
DELETE: 'user.delete'
|
|
16
|
+
};
|
|
17
|
+
export const COMPANY_PERMISSIONS = {
|
|
18
|
+
CREATE: 'company.create',
|
|
19
|
+
READ: 'company.read',
|
|
20
|
+
UPDATE: 'company.update',
|
|
21
|
+
DELETE: 'company.delete'
|
|
22
|
+
};
|
|
23
|
+
export const BRANCH_PERMISSIONS = {
|
|
24
|
+
CREATE: 'branch.create',
|
|
25
|
+
READ: 'branch.read',
|
|
26
|
+
UPDATE: 'branch.update',
|
|
27
|
+
DELETE: 'branch.delete'
|
|
28
|
+
};
|
|
29
|
+
// ==================== IAM MODULE ====================
|
|
30
|
+
export const ACTION_PERMISSIONS = {
|
|
31
|
+
CREATE: 'action.create',
|
|
32
|
+
READ: 'action.read',
|
|
33
|
+
UPDATE: 'action.update',
|
|
34
|
+
DELETE: 'action.delete'
|
|
35
|
+
};
|
|
36
|
+
export const ROLE_PERMISSIONS = {
|
|
37
|
+
CREATE: 'role.create',
|
|
38
|
+
READ: 'role.read',
|
|
39
|
+
UPDATE: 'role.update',
|
|
40
|
+
DELETE: 'role.delete'
|
|
41
|
+
};
|
|
42
|
+
export const ROLE_ACTION_PERMISSIONS = {
|
|
43
|
+
READ: 'role-action.read',
|
|
44
|
+
ASSIGN: 'role-action.assign'
|
|
45
|
+
};
|
|
46
|
+
export const USER_ROLE_PERMISSIONS = {
|
|
47
|
+
READ: 'user-role.read',
|
|
48
|
+
ASSIGN: 'user-role.assign'
|
|
49
|
+
};
|
|
50
|
+
export const USER_ACTION_PERMISSIONS = {
|
|
51
|
+
READ: 'user-action.read',
|
|
52
|
+
ASSIGN: 'user-action.assign'
|
|
53
|
+
};
|
|
54
|
+
export const COMPANY_ACTION_PERMISSIONS = {
|
|
55
|
+
READ: 'company-action.read',
|
|
56
|
+
ASSIGN: 'company-action.assign'
|
|
57
|
+
};
|
|
58
|
+
// ==================== STORAGE MODULE ====================
|
|
59
|
+
export const FILE_PERMISSIONS = {
|
|
60
|
+
CREATE: 'file.create',
|
|
61
|
+
READ: 'file.read',
|
|
62
|
+
UPDATE: 'file.update',
|
|
63
|
+
DELETE: 'file.delete'
|
|
64
|
+
};
|
|
65
|
+
export const FOLDER_PERMISSIONS = {
|
|
66
|
+
CREATE: 'folder.create',
|
|
67
|
+
READ: 'folder.read',
|
|
68
|
+
UPDATE: 'folder.update',
|
|
69
|
+
DELETE: 'folder.delete'
|
|
70
|
+
};
|
|
71
|
+
export const STORAGE_CONFIG_PERMISSIONS = {
|
|
72
|
+
CREATE: 'storage-config.create',
|
|
73
|
+
READ: 'storage-config.read',
|
|
74
|
+
UPDATE: 'storage-config.update',
|
|
75
|
+
DELETE: 'storage-config.delete'
|
|
76
|
+
};
|
|
77
|
+
// ==================== EMAIL MODULE ====================
|
|
78
|
+
export const EMAIL_CONFIG_PERMISSIONS = {
|
|
79
|
+
CREATE: 'email-config.create',
|
|
80
|
+
READ: 'email-config.read',
|
|
81
|
+
UPDATE: 'email-config.update',
|
|
82
|
+
DELETE: 'email-config.delete'
|
|
83
|
+
};
|
|
84
|
+
export const EMAIL_TEMPLATE_PERMISSIONS = {
|
|
85
|
+
CREATE: 'email-template.create',
|
|
86
|
+
READ: 'email-template.read',
|
|
87
|
+
UPDATE: 'email-template.update',
|
|
88
|
+
DELETE: 'email-template.delete'
|
|
89
|
+
};
|
|
90
|
+
// ==================== FORM BUILDER MODULE ====================
|
|
91
|
+
export const FORM_PERMISSIONS = {
|
|
92
|
+
CREATE: 'form.create',
|
|
93
|
+
READ: 'form.read',
|
|
94
|
+
UPDATE: 'form.update',
|
|
95
|
+
DELETE: 'form.delete'
|
|
96
|
+
};
|
|
97
|
+
export const FORM_RESULT_PERMISSIONS = {
|
|
98
|
+
CREATE: 'form-result.create',
|
|
99
|
+
READ: 'form-result.read',
|
|
100
|
+
UPDATE: 'form-result.update',
|
|
101
|
+
DELETE: 'form-result.delete'
|
|
102
|
+
};
|
|
103
|
+
// ==================== AGGREGATED EXPORTS ====================
|
|
104
|
+
/**
|
|
105
|
+
* All permission codes grouped by module
|
|
106
|
+
*/ export const PERMISSIONS = {
|
|
107
|
+
// Auth
|
|
108
|
+
USER: USER_PERMISSIONS,
|
|
109
|
+
COMPANY: COMPANY_PERMISSIONS,
|
|
110
|
+
BRANCH: BRANCH_PERMISSIONS,
|
|
111
|
+
// IAM
|
|
112
|
+
ACTION: ACTION_PERMISSIONS,
|
|
113
|
+
ROLE: ROLE_PERMISSIONS,
|
|
114
|
+
ROLE_ACTION: ROLE_ACTION_PERMISSIONS,
|
|
115
|
+
USER_ROLE: USER_ROLE_PERMISSIONS,
|
|
116
|
+
USER_ACTION: USER_ACTION_PERMISSIONS,
|
|
117
|
+
COMPANY_ACTION: COMPANY_ACTION_PERMISSIONS,
|
|
118
|
+
// Storage
|
|
119
|
+
FILE: FILE_PERMISSIONS,
|
|
120
|
+
FOLDER: FOLDER_PERMISSIONS,
|
|
121
|
+
STORAGE_CONFIG: STORAGE_CONFIG_PERMISSIONS,
|
|
122
|
+
// Email
|
|
123
|
+
EMAIL_CONFIG: EMAIL_CONFIG_PERMISSIONS,
|
|
124
|
+
EMAIL_TEMPLATE: EMAIL_TEMPLATE_PERMISSIONS,
|
|
125
|
+
// Form Builder
|
|
126
|
+
FORM: FORM_PERMISSIONS,
|
|
127
|
+
FORM_RESULT: FORM_RESULT_PERMISSIONS
|
|
128
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BulkMetaDto, BulkResponseDto, ListResponseDto, PaginationMetaDto, SingleResponseDto } from '
|
|
1
|
+
import { BulkMetaDto, BulkResponseDto, ListResponseDto, PaginationMetaDto, SingleResponseDto } from '../dtos';
|
|
2
2
|
import { applyDecorators } from '@nestjs/common';
|
|
3
3
|
import { ApiExtraModels, ApiOkResponse, getSchemaPath } from '@nestjs/swagger';
|
|
4
4
|
/**
|
package/fesm/decorators/index.js
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Transform } from 'class-transformer';
|
|
2
|
+
import { escapeHtml } from '../utils/html-sanitizer.util';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator that sanitizes HTML content in string fields to prevent XSS attacks.
|
|
5
|
+
* Applies HTML escaping during transformation (when class-transformer processes the DTO).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* class CreateCommentDto {
|
|
10
|
+
* @SanitizeHtml()
|
|
11
|
+
* @IsString()
|
|
12
|
+
* content: string;
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Input: '<script>alert("xss")</script>'
|
|
17
|
+
* Output: '<script>alert("xss")</script>'
|
|
18
|
+
*/ export function SanitizeHtml() {
|
|
19
|
+
return Transform(({ value })=>{
|
|
20
|
+
if (typeof value === 'string') {
|
|
21
|
+
return escapeHtml(value);
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Decorator that sanitizes HTML and trims whitespace from string fields.
|
|
28
|
+
* Combines sanitization with trimming for cleaner input handling.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* class CreatePostDto {
|
|
33
|
+
* @SanitizeAndTrim()
|
|
34
|
+
* @IsString()
|
|
35
|
+
* title: string;
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/ export function SanitizeAndTrim() {
|
|
39
|
+
return Transform(({ value })=>{
|
|
40
|
+
if (typeof value === 'string') {
|
|
41
|
+
return escapeHtml(value.trim());
|
|
42
|
+
}
|
|
43
|
+
return value;
|
|
44
|
+
});
|
|
45
|
+
}
|
package/fesm/dtos/delete.dto.js
CHANGED
|
@@ -20,12 +20,13 @@ 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 { ApiProperty } from '@nestjs/swagger';
|
|
24
|
-
import { IsIn, IsNotEmpty } from 'class-validator';
|
|
23
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
24
|
+
import { IsIn, IsNotEmpty, IsOptional, IsUUID } from 'class-validator';
|
|
25
25
|
export class DeleteDto {
|
|
26
26
|
constructor(){
|
|
27
27
|
_define_property(this, "id", void 0);
|
|
28
28
|
_define_property(this, "type", void 0);
|
|
29
|
+
_define_property(this, "deletedById", void 0);
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
_ts_decorate([
|
|
@@ -70,3 +71,12 @@ _ts_decorate([
|
|
|
70
71
|
]),
|
|
71
72
|
_ts_metadata("design:type", String)
|
|
72
73
|
], DeleteDto.prototype, "type", void 0);
|
|
74
|
+
_ts_decorate([
|
|
75
|
+
ApiPropertyOptional({
|
|
76
|
+
description: 'User ID who initiated the deletion (auto-set by interceptor)',
|
|
77
|
+
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
78
|
+
}),
|
|
79
|
+
IsOptional(),
|
|
80
|
+
IsUUID(),
|
|
81
|
+
_ts_metadata("design:type", String)
|
|
82
|
+
], DeleteDto.prototype, "deletedById", void 0);
|
|
@@ -22,27 +22,15 @@ function _ts_metadata(k, v) {
|
|
|
22
22
|
}
|
|
23
23
|
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
24
24
|
import { Type } from 'class-transformer';
|
|
25
|
-
import { IsArray, IsBoolean, IsObject, IsOptional, ValidateNested } from 'class-validator';
|
|
25
|
+
import { IsArray, IsBoolean, IsObject, IsOptional, IsString, Matches, MaxLength, ValidateNested } from 'class-validator';
|
|
26
26
|
import { PaginationDto } from './pagination.dto';
|
|
27
|
-
|
|
28
|
-
* DTO for filtering and pagination in get-all requests
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* {
|
|
32
|
-
* "filter": { "isActive": true, "category": "electronics" },
|
|
33
|
-
* "pagination": { "currentPage": 0, "pageSize": 10 },
|
|
34
|
-
* "sort": { "createdAt": "DESC" },
|
|
35
|
-
* "select": ["id", "name", "price"],
|
|
36
|
-
* "withDeleted": false
|
|
37
|
-
* }
|
|
38
|
-
*/ export class FilterAndPaginationDto {
|
|
27
|
+
export class FilterAndPaginationDto {
|
|
39
28
|
constructor(){
|
|
40
29
|
_define_property(this, "filter", void 0);
|
|
41
30
|
_define_property(this, "pagination", void 0);
|
|
42
31
|
_define_property(this, "sort", void 0);
|
|
43
32
|
_define_property(this, "select", void 0);
|
|
44
33
|
_define_property(this, "withDeleted", void 0);
|
|
45
|
-
_define_property(this, "extraKey", void 0);
|
|
46
34
|
}
|
|
47
35
|
}
|
|
48
36
|
_ts_decorate([
|
|
@@ -90,7 +78,7 @@ _ts_decorate([
|
|
|
90
78
|
type: [
|
|
91
79
|
String
|
|
92
80
|
],
|
|
93
|
-
description: 'Fields to return. If empty, returns all fields.',
|
|
81
|
+
description: 'Fields to return. Must be valid field names (alphanumeric, underscores only). If empty, returns all fields.',
|
|
94
82
|
example: [
|
|
95
83
|
'id',
|
|
96
84
|
'name',
|
|
@@ -100,6 +88,17 @@ _ts_decorate([
|
|
|
100
88
|
}),
|
|
101
89
|
IsOptional(),
|
|
102
90
|
IsArray(),
|
|
91
|
+
IsString({
|
|
92
|
+
each: true
|
|
93
|
+
}),
|
|
94
|
+
Matches(/^[a-zA-Z_][a-zA-Z0-9_]*$/, {
|
|
95
|
+
each: true,
|
|
96
|
+
message: 'Select fields must be valid identifiers (alphanumeric and underscores only)'
|
|
97
|
+
}),
|
|
98
|
+
MaxLength(64, {
|
|
99
|
+
each: true,
|
|
100
|
+
message: 'Field names must be 64 characters or less'
|
|
101
|
+
}),
|
|
103
102
|
_ts_metadata("design:type", Array)
|
|
104
103
|
], FilterAndPaginationDto.prototype, "select", void 0);
|
|
105
104
|
_ts_decorate([
|
|
@@ -112,27 +111,11 @@ _ts_decorate([
|
|
|
112
111
|
IsBoolean(),
|
|
113
112
|
_ts_metadata("design:type", Boolean)
|
|
114
113
|
], FilterAndPaginationDto.prototype, "withDeleted", void 0);
|
|
115
|
-
_ts_decorate([
|
|
116
|
-
ApiPropertyOptional({
|
|
117
|
-
type: [
|
|
118
|
-
String
|
|
119
|
-
],
|
|
120
|
-
description: 'Additional relation keys to include',
|
|
121
|
-
example: [
|
|
122
|
-
'category',
|
|
123
|
-
'createdBy'
|
|
124
|
-
]
|
|
125
|
-
}),
|
|
126
|
-
IsOptional(),
|
|
127
|
-
IsArray(),
|
|
128
|
-
_ts_metadata("design:type", Array)
|
|
129
|
-
], FilterAndPaginationDto.prototype, "extraKey", void 0);
|
|
130
114
|
/**
|
|
131
115
|
* DTO for get-by-id request body
|
|
132
116
|
*/ export class GetByIdBodyDto {
|
|
133
117
|
constructor(){
|
|
134
118
|
_define_property(this, "select", void 0);
|
|
135
|
-
_define_property(this, "extraKey", void 0);
|
|
136
119
|
}
|
|
137
120
|
}
|
|
138
121
|
_ts_decorate([
|
|
@@ -140,7 +123,7 @@ _ts_decorate([
|
|
|
140
123
|
type: [
|
|
141
124
|
String
|
|
142
125
|
],
|
|
143
|
-
description: 'Fields to return. If empty, returns all fields.',
|
|
126
|
+
description: 'Fields to return. Must be valid field names (alphanumeric, underscores only). If empty, returns all fields.',
|
|
144
127
|
example: [
|
|
145
128
|
'id',
|
|
146
129
|
'name',
|
|
@@ -150,20 +133,16 @@ _ts_decorate([
|
|
|
150
133
|
}),
|
|
151
134
|
IsOptional(),
|
|
152
135
|
IsArray(),
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
'createdBy'
|
|
164
|
-
]
|
|
136
|
+
IsString({
|
|
137
|
+
each: true
|
|
138
|
+
}),
|
|
139
|
+
Matches(/^[a-zA-Z_][a-zA-Z0-9_]*$/, {
|
|
140
|
+
each: true,
|
|
141
|
+
message: 'Select fields must be valid identifiers (alphanumeric and underscores only)'
|
|
142
|
+
}),
|
|
143
|
+
MaxLength(64, {
|
|
144
|
+
each: true,
|
|
145
|
+
message: 'Field names must be 64 characters or less'
|
|
165
146
|
}),
|
|
166
|
-
IsOptional(),
|
|
167
|
-
IsArray(),
|
|
168
147
|
_ts_metadata("design:type", Array)
|
|
169
|
-
], GetByIdBodyDto.prototype, "
|
|
148
|
+
], GetByIdBodyDto.prototype, "select", void 0);
|
|
@@ -25,17 +25,13 @@ import { Transform } from 'class-transformer';
|
|
|
25
25
|
import { IsNumber, IsOptional } from 'class-validator';
|
|
26
26
|
export class PaginationDto {
|
|
27
27
|
constructor(){
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/ _define_property(this, "pageSize", 10);
|
|
31
|
-
/**
|
|
32
|
-
* Zero-based page index. Defaults to 0 when not provided or invalid.
|
|
33
|
-
*/ _define_property(this, "currentPage", 0);
|
|
28
|
+
_define_property(this, "pageSize", 10);
|
|
29
|
+
_define_property(this, "currentPage", 0);
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
32
|
_ts_decorate([
|
|
37
33
|
ApiPropertyOptional({
|
|
38
|
-
description: 'Number of items per page
|
|
34
|
+
description: 'Number of items per page (default: 10)',
|
|
39
35
|
example: 10
|
|
40
36
|
}),
|
|
41
37
|
IsOptional(),
|
|
@@ -48,7 +44,7 @@ _ts_decorate([
|
|
|
48
44
|
], PaginationDto.prototype, "pageSize", void 0);
|
|
49
45
|
_ts_decorate([
|
|
50
46
|
ApiPropertyOptional({
|
|
51
|
-
description: 'Zero-based page index
|
|
47
|
+
description: 'Zero-based page index (default: 0)',
|
|
52
48
|
example: 0
|
|
53
49
|
}),
|
|
54
50
|
IsOptional(),
|
|
@@ -262,110 +262,3 @@ _ts_decorate([
|
|
|
262
262
|
MessageResponseDto = _ts_decorate([
|
|
263
263
|
ApiExtraModels()
|
|
264
264
|
], MessageResponseDto);
|
|
265
|
-
export class ValidationErrorDto {
|
|
266
|
-
constructor(){
|
|
267
|
-
_define_property(this, "field", void 0);
|
|
268
|
-
_define_property(this, "message", void 0);
|
|
269
|
-
_define_property(this, "constraint", void 0);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
_ts_decorate([
|
|
273
|
-
ApiProperty({
|
|
274
|
-
example: 'email'
|
|
275
|
-
}),
|
|
276
|
-
_ts_metadata("design:type", String)
|
|
277
|
-
], ValidationErrorDto.prototype, "field", void 0);
|
|
278
|
-
_ts_decorate([
|
|
279
|
-
ApiProperty({
|
|
280
|
-
example: 'Invalid email format'
|
|
281
|
-
}),
|
|
282
|
-
_ts_metadata("design:type", String)
|
|
283
|
-
], ValidationErrorDto.prototype, "message", void 0);
|
|
284
|
-
_ts_decorate([
|
|
285
|
-
ApiPropertyOptional({
|
|
286
|
-
example: 'isEmail'
|
|
287
|
-
}),
|
|
288
|
-
_ts_metadata("design:type", String)
|
|
289
|
-
], ValidationErrorDto.prototype, "constraint", void 0);
|
|
290
|
-
export class ErrorResponseDto {
|
|
291
|
-
constructor(){
|
|
292
|
-
_define_property(this, "success", void 0);
|
|
293
|
-
_define_property(this, "message", void 0);
|
|
294
|
-
_define_property(this, "code", void 0);
|
|
295
|
-
_define_property(this, "errors", void 0);
|
|
296
|
-
_define_property(this, "_meta", void 0);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
_ts_decorate([
|
|
300
|
-
ApiProperty({
|
|
301
|
-
example: false
|
|
302
|
-
}),
|
|
303
|
-
_ts_metadata("design:type", Boolean)
|
|
304
|
-
], ErrorResponseDto.prototype, "success", void 0);
|
|
305
|
-
_ts_decorate([
|
|
306
|
-
ApiProperty({
|
|
307
|
-
example: 'Validation failed'
|
|
308
|
-
}),
|
|
309
|
-
_ts_metadata("design:type", String)
|
|
310
|
-
], ErrorResponseDto.prototype, "message", void 0);
|
|
311
|
-
_ts_decorate([
|
|
312
|
-
ApiPropertyOptional({
|
|
313
|
-
example: 'VALIDATION_ERROR'
|
|
314
|
-
}),
|
|
315
|
-
_ts_metadata("design:type", String)
|
|
316
|
-
], ErrorResponseDto.prototype, "code", void 0);
|
|
317
|
-
_ts_decorate([
|
|
318
|
-
ApiPropertyOptional({
|
|
319
|
-
type: [
|
|
320
|
-
ValidationErrorDto
|
|
321
|
-
]
|
|
322
|
-
}),
|
|
323
|
-
_ts_metadata("design:type", Array)
|
|
324
|
-
], ErrorResponseDto.prototype, "errors", void 0);
|
|
325
|
-
_ts_decorate([
|
|
326
|
-
ApiPropertyOptional({
|
|
327
|
-
type: RequestMetaDto
|
|
328
|
-
}),
|
|
329
|
-
_ts_metadata("design:type", typeof RequestMetaDto === "undefined" ? Object : RequestMetaDto)
|
|
330
|
-
], ErrorResponseDto.prototype, "_meta", void 0);
|
|
331
|
-
ErrorResponseDto = _ts_decorate([
|
|
332
|
-
ApiExtraModels()
|
|
333
|
-
], ErrorResponseDto);
|
|
334
|
-
export class ResponsePayloadDto {
|
|
335
|
-
constructor(){
|
|
336
|
-
_define_property(this, "success", void 0);
|
|
337
|
-
_define_property(this, "message", void 0);
|
|
338
|
-
_define_property(this, "data", void 0);
|
|
339
|
-
_define_property(this, "meta", void 0);
|
|
340
|
-
_define_property(this, "_meta", void 0);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
_ts_decorate([
|
|
344
|
-
ApiProperty({
|
|
345
|
-
example: true
|
|
346
|
-
}),
|
|
347
|
-
_ts_metadata("design:type", Boolean)
|
|
348
|
-
], ResponsePayloadDto.prototype, "success", void 0);
|
|
349
|
-
_ts_decorate([
|
|
350
|
-
ApiProperty({
|
|
351
|
-
example: 'Operation successful'
|
|
352
|
-
}),
|
|
353
|
-
_ts_metadata("design:type", String)
|
|
354
|
-
], ResponsePayloadDto.prototype, "message", void 0);
|
|
355
|
-
_ts_decorate([
|
|
356
|
-
ApiPropertyOptional(),
|
|
357
|
-
_ts_metadata("design:type", typeof T === "undefined" ? Object : T)
|
|
358
|
-
], ResponsePayloadDto.prototype, "data", void 0);
|
|
359
|
-
_ts_decorate([
|
|
360
|
-
ApiPropertyOptional(),
|
|
361
|
-
_ts_metadata("design:type", Object)
|
|
362
|
-
], ResponsePayloadDto.prototype, "meta", void 0);
|
|
363
|
-
_ts_decorate([
|
|
364
|
-
ApiPropertyOptional({
|
|
365
|
-
type: RequestMetaDto
|
|
366
|
-
}),
|
|
367
|
-
_ts_metadata("design:type", typeof RequestMetaDto === "undefined" ? Object : RequestMetaDto)
|
|
368
|
-
], ResponsePayloadDto.prototype, "_meta", void 0);
|
|
369
|
-
ResponsePayloadDto = _ts_decorate([
|
|
370
|
-
ApiExtraModels()
|
|
371
|
-
], ResponsePayloadDto);
|
|
@@ -26,10 +26,10 @@ export class Identity {
|
|
|
26
26
|
_define_property(this, "id", void 0);
|
|
27
27
|
_define_property(this, "createdAt", void 0);
|
|
28
28
|
_define_property(this, "updatedAt", void 0);
|
|
29
|
-
_define_property(this, "deletedAt",
|
|
30
|
-
_define_property(this, "createdById",
|
|
31
|
-
_define_property(this, "updatedById",
|
|
32
|
-
_define_property(this, "deletedById",
|
|
29
|
+
_define_property(this, "deletedAt", null);
|
|
30
|
+
_define_property(this, "createdById", null);
|
|
31
|
+
_define_property(this, "updatedById", null);
|
|
32
|
+
_define_property(this, "deletedById", null);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
_ts_decorate([
|
|
@@ -24,23 +24,22 @@ import { Column, CreateDateColumn, DeleteDateColumn, PrimaryGeneratedColumn, Upd
|
|
|
24
24
|
export class UserRoot {
|
|
25
25
|
constructor(){
|
|
26
26
|
_define_property(this, "id", void 0);
|
|
27
|
-
_define_property(this, "name",
|
|
28
|
-
_define_property(this, "password",
|
|
27
|
+
_define_property(this, "name", null);
|
|
28
|
+
_define_property(this, "password", null);
|
|
29
29
|
_define_property(this, "email", void 0);
|
|
30
|
-
_define_property(this, "phone",
|
|
31
|
-
_define_property(this, "isActive",
|
|
32
|
-
_define_property(this, "emailVerified",
|
|
33
|
-
_define_property(this, "phoneVerified",
|
|
34
|
-
_define_property(this, "profilePictureId",
|
|
35
|
-
_define_property(this, "lastLoginAt",
|
|
36
|
-
_define_property(this, "additionalFields",
|
|
30
|
+
_define_property(this, "phone", null);
|
|
31
|
+
_define_property(this, "isActive", true);
|
|
32
|
+
_define_property(this, "emailVerified", false);
|
|
33
|
+
_define_property(this, "phoneVerified", false);
|
|
34
|
+
_define_property(this, "profilePictureId", null);
|
|
35
|
+
_define_property(this, "lastLoginAt", null);
|
|
36
|
+
_define_property(this, "additionalFields", null);
|
|
37
37
|
_define_property(this, "createdAt", void 0);
|
|
38
38
|
_define_property(this, "updatedAt", void 0);
|
|
39
|
-
_define_property(this, "deletedAt",
|
|
40
|
-
|
|
41
|
-
_define_property(this, "
|
|
42
|
-
_define_property(this, "
|
|
43
|
-
_define_property(this, "deletedById", void 0);
|
|
39
|
+
_define_property(this, "deletedAt", null);
|
|
40
|
+
_define_property(this, "createdById", null);
|
|
41
|
+
_define_property(this, "updatedById", null);
|
|
42
|
+
_define_property(this, "deletedById", null);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
_ts_decorate([
|