@flusys/nestjs-form-builder 1.0.0-rc → 2.0.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 +35 -8
- package/cjs/controllers/form-result.controller.js +8 -8
- package/cjs/docs/form-builder-swagger.config.js +6 -100
- package/cjs/dtos/form-result.dto.js +5 -53
- package/cjs/dtos/form.dto.js +20 -123
- package/cjs/entities/form-with-company.entity.js +12 -2
- package/cjs/entities/form.entity.js +103 -3
- package/cjs/entities/index.js +28 -16
- package/cjs/interfaces/form-result.interface.js +1 -6
- package/cjs/modules/form-builder.module.js +57 -83
- package/cjs/services/form-builder-config.service.js +2 -2
- package/cjs/services/form-builder-datasource.provider.js +11 -26
- package/cjs/services/form-result.service.js +81 -122
- package/cjs/services/form.service.js +33 -50
- package/cjs/utils/computed-field.utils.js +17 -29
- package/dtos/form-result.dto.d.ts +2 -8
- package/dtos/form.dto.d.ts +6 -21
- package/entities/form-with-company.entity.d.ts +2 -2
- package/entities/form.entity.d.ts +12 -2
- package/entities/index.d.ts +7 -2
- package/fesm/controllers/form-result.controller.js +9 -9
- package/fesm/docs/form-builder-swagger.config.js +6 -100
- package/fesm/dtos/form-result.dto.js +5 -53
- package/fesm/dtos/form.dto.js +21 -124
- package/fesm/entities/form-with-company.entity.js +12 -2
- package/fesm/entities/form.entity.js +104 -4
- package/fesm/entities/index.js +18 -24
- package/fesm/modules/form-builder.module.js +57 -83
- package/fesm/services/form-builder-config.service.js +2 -2
- package/fesm/services/form-builder-datasource.provider.js +11 -26
- package/fesm/services/form-result.service.js +81 -122
- package/fesm/services/form.service.js +33 -50
- package/fesm/utils/computed-field.utils.js +17 -29
- package/interfaces/form-result.interface.d.ts +2 -8
- package/interfaces/form.interface.d.ts +2 -8
- package/modules/form-builder.module.d.ts +4 -3
- package/package.json +3 -3
- package/services/form-builder-config.service.d.ts +2 -2
- package/services/form-builder-datasource.provider.d.ts +3 -6
- package/services/form-result.service.d.ts +4 -0
- package/services/form.service.d.ts +12 -10
- package/cjs/entities/form-base.entity.js +0 -113
- package/entities/form-base.entity.d.ts +0 -13
- package/fesm/entities/form-base.entity.js +0 -106
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ This guide covers the NestJS form builder package - dynamic form creation, submi
|
|
|
9
9
|
|
|
10
10
|
- [Overview](#overview)
|
|
11
11
|
- [Installation](#installation)
|
|
12
|
+
- [Constants](#constants)
|
|
12
13
|
- [Package Architecture](#package-architecture)
|
|
13
14
|
- [Module Setup](#module-setup)
|
|
14
15
|
- [Entities](#entities)
|
|
@@ -55,6 +56,15 @@ npm install @flusys/nestjs-form-builder @flusys/nestjs-shared @flusys/nestjs-cor
|
|
|
55
56
|
|
|
56
57
|
---
|
|
57
58
|
|
|
59
|
+
## Constants
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// Injection Token
|
|
63
|
+
export const FORM_BUILDER_MODULE_OPTIONS = 'FORM_BUILDER_MODULE_OPTIONS';
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
58
68
|
## Package Architecture
|
|
59
69
|
|
|
60
70
|
```
|
|
@@ -68,9 +78,8 @@ nestjs-form-builder/
|
|
|
68
78
|
│ │ └── index.ts
|
|
69
79
|
│ │
|
|
70
80
|
│ ├── entities/
|
|
71
|
-
│ │ ├── form
|
|
72
|
-
│ │ ├── form.entity.ts
|
|
73
|
-
│ │ ├── form-with-company.entity.ts # With company
|
|
81
|
+
│ │ ├── form.entity.ts # Main form entity
|
|
82
|
+
│ │ ├── form-with-company.entity.ts # Extends Form with company
|
|
74
83
|
│ │ ├── form-result.entity.ts # Submissions
|
|
75
84
|
│ │ └── index.ts
|
|
76
85
|
│ │
|
|
@@ -196,9 +205,27 @@ function getEntitiesForTenant(tenantConfig?: ITenantDatabaseConfig): any[] {
|
|
|
196
205
|
|
|
197
206
|
## Entities
|
|
198
207
|
|
|
199
|
-
###
|
|
208
|
+
### Entity Groups
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
// Core entities (no company feature)
|
|
212
|
+
export const FormCoreEntities = [Form, FormResult];
|
|
213
|
+
|
|
214
|
+
// Company-specific entities
|
|
215
|
+
export const FormCompanyEntities = [FormWithCompany, FormResult];
|
|
216
|
+
|
|
217
|
+
// Helper function
|
|
218
|
+
export function getFormBuilderEntitiesByConfig(enableCompanyFeature: boolean): any[] {
|
|
219
|
+
return enableCompanyFeature ? FormCompanyEntities : FormCoreEntities;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Base type alias for backwards compatibility
|
|
223
|
+
export { Form as FormBase } from './form.entity';
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Form
|
|
200
227
|
|
|
201
|
-
|
|
228
|
+
Main form entity with all form fields:
|
|
202
229
|
|
|
203
230
|
| Column | Type | Description |
|
|
204
231
|
|--------|------|-------------|
|
|
@@ -215,7 +242,7 @@ Base entity with common form fields:
|
|
|
215
242
|
### Form vs FormWithCompany
|
|
216
243
|
|
|
217
244
|
- **Form** - Used when `enableCompanyFeature: false`
|
|
218
|
-
- **FormWithCompany** -
|
|
245
|
+
- **FormWithCompany** - Extends Form, adds `companyId` column for tenant isolation
|
|
219
246
|
|
|
220
247
|
### FormResult
|
|
221
248
|
|
|
@@ -596,7 +623,7 @@ The `FormResultService` automatically calculates computed fields on submission v
|
|
|
596
623
|
// Private method in FormResultService
|
|
597
624
|
private applyComputedFields(
|
|
598
625
|
data: Record<string, unknown>,
|
|
599
|
-
form:
|
|
626
|
+
form: Form,
|
|
600
627
|
isDraft: boolean,
|
|
601
628
|
): Record<string, unknown> {
|
|
602
629
|
if (isDraft) return data;
|
|
@@ -692,4 +719,4 @@ async hasUserSubmitted(
|
|
|
692
719
|
|
|
693
720
|
---
|
|
694
721
|
|
|
695
|
-
**Last Updated:** 2026-02-
|
|
722
|
+
**Last Updated:** 2026-02-21
|
|
@@ -48,43 +48,43 @@ let FormResultController = class FormResultController extends (0, _classes.creat
|
|
|
48
48
|
insert: {
|
|
49
49
|
level: 'permission',
|
|
50
50
|
permissions: [
|
|
51
|
-
|
|
51
|
+
_classes.FORM_RESULT_PERMISSIONS.CREATE
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
54
|
insertMany: {
|
|
55
55
|
level: 'permission',
|
|
56
56
|
permissions: [
|
|
57
|
-
|
|
57
|
+
_classes.FORM_RESULT_PERMISSIONS.CREATE
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
getById: {
|
|
61
61
|
level: 'permission',
|
|
62
62
|
permissions: [
|
|
63
|
-
|
|
63
|
+
_classes.FORM_RESULT_PERMISSIONS.READ
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
getAll: {
|
|
67
67
|
level: 'permission',
|
|
68
68
|
permissions: [
|
|
69
|
-
|
|
69
|
+
_classes.FORM_RESULT_PERMISSIONS.READ
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
update: {
|
|
73
73
|
level: 'permission',
|
|
74
74
|
permissions: [
|
|
75
|
-
|
|
75
|
+
_classes.FORM_RESULT_PERMISSIONS.UPDATE
|
|
76
76
|
]
|
|
77
77
|
},
|
|
78
78
|
updateMany: {
|
|
79
79
|
level: 'permission',
|
|
80
80
|
permissions: [
|
|
81
|
-
|
|
81
|
+
_classes.FORM_RESULT_PERMISSIONS.UPDATE
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
84
|
delete: {
|
|
85
85
|
level: 'permission',
|
|
86
86
|
permissions: [
|
|
87
|
-
|
|
87
|
+
_classes.FORM_RESULT_PERMISSIONS.DELETE
|
|
88
88
|
]
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -218,7 +218,7 @@ _ts_decorate([
|
|
|
218
218
|
(0, _common.Post)('by-form'),
|
|
219
219
|
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
220
220
|
(0, _swagger.ApiBearerAuth)(),
|
|
221
|
-
(0, _decorators.RequirePermission)(
|
|
221
|
+
(0, _decorators.RequirePermission)(_classes.FORM_RESULT_PERMISSIONS.READ),
|
|
222
222
|
(0, _common.HttpCode)(_common.HttpStatus.OK),
|
|
223
223
|
(0, _swagger.ApiOperation)({
|
|
224
224
|
summary: 'Get results by form ID'
|
|
@@ -38,7 +38,7 @@ function formBuilderSwaggerConfig(bootstrapConfig) {
|
|
|
38
38
|
const enableCompanyFeature = bootstrapConfig?.enableCompanyFeature ?? true;
|
|
39
39
|
return {
|
|
40
40
|
title: 'Form Builder API',
|
|
41
|
-
description:
|
|
41
|
+
description: `
|
|
42
42
|
# Form Builder API
|
|
43
43
|
|
|
44
44
|
Dynamic form builder with schema versioning, conditional logic, and access control.
|
|
@@ -48,8 +48,7 @@ Dynamic form builder with schema versioning, conditional logic, and access contr
|
|
|
48
48
|
### 📋 Form Management
|
|
49
49
|
- Create and manage dynamic forms
|
|
50
50
|
- Schema versioning for form updates
|
|
51
|
-
- Slug-based URLs for sharing
|
|
52
|
-
- **Company isolation**
|
|
51
|
+
- Slug-based URLs for sharing${enableCompanyFeature ? '\n- **Company isolation**' : ''}
|
|
53
52
|
|
|
54
53
|
### 🔒 Access Control
|
|
55
54
|
- **Public**: No authentication required
|
|
@@ -59,114 +58,21 @@ Dynamic form builder with schema versioning, conditional logic, and access contr
|
|
|
59
58
|
### 📊 Form Results
|
|
60
59
|
- Submit and track form responses
|
|
61
60
|
- Draft support for partial submissions
|
|
62
|
-
- Schema snapshot preservation
|
|
63
|
-
- **Company-level permissions**
|
|
61
|
+
- Schema snapshot preservation${enableCompanyFeature ? '\n- **Company-level permissions**' : ''}
|
|
64
62
|
|
|
65
63
|
### 🔀 Conditional Logic
|
|
66
64
|
- Show/hide fields based on values
|
|
67
65
|
- Show/hide sections dynamically
|
|
68
66
|
- Jump to sections based on conditions
|
|
69
67
|
- Conditional required validation
|
|
70
|
-
|
|
68
|
+
${enableCompanyFeature ? `
|
|
71
69
|
## Multi-Tenant Support
|
|
72
70
|
|
|
73
71
|
Forms and results are automatically isolated by:
|
|
74
72
|
- **Company ID**: Company-level data isolation
|
|
75
73
|
|
|
76
74
|
All queries automatically filter by current user's company context.
|
|
77
|
-
|
|
78
|
-
## Form Access Types
|
|
79
|
-
|
|
80
|
-
### Public Forms
|
|
81
|
-
- No authentication required
|
|
82
|
-
- Anyone can view and submit
|
|
83
|
-
- Use \`/form-builder/form/public/:id\` to get form
|
|
84
|
-
- Use \`/form-builder/result/submit-public\` to submit
|
|
85
|
-
|
|
86
|
-
### Authenticated Forms
|
|
87
|
-
- JWT authentication required
|
|
88
|
-
- User must be logged in
|
|
89
|
-
- Use \`/form-builder/form/authenticated/:id\` to get form
|
|
90
|
-
- Use \`/form-builder/result/submit\` to submit
|
|
91
|
-
|
|
92
|
-
### Action Group Forms
|
|
93
|
-
- Permission-based access via IAM
|
|
94
|
-
- User must have specific permissions
|
|
95
|
-
- Use \`/form-builder/form/authenticated/:id\` to get form
|
|
96
|
-
- Use \`/form-builder/result/submit\` to submit
|
|
97
|
-
|
|
98
|
-
## Draft Support
|
|
99
|
-
|
|
100
|
-
Save form progress and complete later:
|
|
101
|
-
1. Submit with \`isDraft: true\` to save draft
|
|
102
|
-
2. Get draft with \`/form-builder/result/my-draft\`
|
|
103
|
-
3. Update draft with \`/form-builder/result/update-draft\`
|
|
104
|
-
4. Finalize by setting \`isDraft: false\`
|
|
105
|
-
|
|
106
|
-
## Response Format
|
|
107
|
-
|
|
108
|
-
All endpoints return standardized responses with success status, data, message, and timestamp.
|
|
109
|
-
|
|
110
|
-
## Error Handling
|
|
111
|
-
|
|
112
|
-
Errors return structured responses with success false, error message, error code, and timestamp.
|
|
113
|
-
|
|
114
|
-
## Common Error Codes
|
|
115
|
-
|
|
116
|
-
- **400 Bad Request**: Invalid input data
|
|
117
|
-
- **401 Unauthorized**: Missing or invalid authentication
|
|
118
|
-
- **403 Forbidden**: Insufficient permissions or wrong access type
|
|
119
|
-
- **404 Not Found**: Form or result not found
|
|
120
|
-
- **500 Internal Server Error**: Server error
|
|
121
|
-
|
|
122
|
-
## API Endpoints
|
|
123
|
-
|
|
124
|
-
All form builder endpoints are prefixed with \`/form-builder\`:
|
|
125
|
-
- \`/form-builder/form/*\` - Form management
|
|
126
|
-
- \`/form-builder/result/*\` - Form result/submission management
|
|
127
|
-
|
|
128
|
-
## Examples
|
|
129
|
-
|
|
130
|
-
### Get Form Access Info
|
|
131
|
-
|
|
132
|
-
POST /form-builder/form/access-info/:id
|
|
133
|
-
Returns access type and requirements (no auth required)
|
|
134
|
-
|
|
135
|
-
### Submit Public Form
|
|
136
|
-
|
|
137
|
-
POST /form-builder/result/submit-public with JSON body containing formId and formData
|
|
138
|
-
|
|
139
|
-
### Submit Authenticated Form
|
|
140
|
-
|
|
141
|
-
POST /form-builder/result/submit with JWT token and JSON body containing formId and formData
|
|
142
|
-
` : `
|
|
143
|
-
# Form Builder API
|
|
144
|
-
|
|
145
|
-
Dynamic form builder with schema versioning, conditional logic, and access control.
|
|
146
|
-
|
|
147
|
-
## Features
|
|
148
|
-
|
|
149
|
-
### 📋 Form Management
|
|
150
|
-
- Create and manage dynamic forms
|
|
151
|
-
- Schema versioning for form updates
|
|
152
|
-
- Slug-based URLs for sharing
|
|
153
|
-
|
|
154
|
-
### 🔒 Access Control
|
|
155
|
-
- **Public**: No authentication required
|
|
156
|
-
- **Authenticated**: JWT authentication required
|
|
157
|
-
- **Action Group**: Permission-based access via IAM
|
|
158
|
-
|
|
159
|
-
### 📊 Form Results
|
|
160
|
-
- Submit and track form responses
|
|
161
|
-
- Draft support for partial submissions
|
|
162
|
-
- Schema snapshot preservation
|
|
163
|
-
|
|
164
|
-
### 🔀 Conditional Logic
|
|
165
|
-
- Show/hide fields based on values
|
|
166
|
-
- Show/hide sections dynamically
|
|
167
|
-
- Jump to sections based on conditions
|
|
168
|
-
- Conditional required validation
|
|
169
|
-
|
|
75
|
+
` : ''}
|
|
170
76
|
## Form Access Types
|
|
171
77
|
|
|
172
78
|
### Public Forms
|
|
@@ -231,7 +137,7 @@ POST /form-builder/result/submit-public with JSON body containing formId and for
|
|
|
231
137
|
### Submit Authenticated Form
|
|
232
138
|
|
|
233
139
|
POST /form-builder/result/submit with JWT token and JSON body containing formId and formData
|
|
234
|
-
|
|
140
|
+
`,
|
|
235
141
|
version: '1.0',
|
|
236
142
|
path: 'api/docs/form-builder',
|
|
237
143
|
bearerAuth: true,
|
|
@@ -33,6 +33,7 @@ _export(exports, {
|
|
|
33
33
|
});
|
|
34
34
|
const _swagger = require("@nestjs/swagger");
|
|
35
35
|
const _classvalidator = require("class-validator");
|
|
36
|
+
const _dtos = require("@flusys/nestjs-shared/dtos");
|
|
36
37
|
function _define_property(obj, key, value) {
|
|
37
38
|
if (key in obj) {
|
|
38
39
|
Object.defineProperty(obj, key, {
|
|
@@ -99,6 +100,7 @@ _ts_decorate([
|
|
|
99
100
|
description: 'Additional metadata',
|
|
100
101
|
required: false
|
|
101
102
|
}),
|
|
103
|
+
(0, _classvalidator.IsObject)(),
|
|
102
104
|
(0, _classvalidator.IsOptional)(),
|
|
103
105
|
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
104
106
|
], SubmitFormDto.prototype, "metadata", void 0);
|
|
@@ -213,29 +215,11 @@ _ts_decorate([
|
|
|
213
215
|
(0, _classvalidator.IsOptional)(),
|
|
214
216
|
_ts_metadata("design:type", Number)
|
|
215
217
|
], GetResultsByFormDto.prototype, "pageSize", void 0);
|
|
216
|
-
let FormResultResponseDto = class FormResultResponseDto {
|
|
217
|
-
constructor(){
|
|
218
|
-
_define_property(this, "
|
|
219
|
-
_define_property(this, "formId", void 0);
|
|
220
|
-
_define_property(this, "schemaVersionSnapshot", void 0);
|
|
221
|
-
_define_property(this, "schemaVersion", void 0);
|
|
222
|
-
_define_property(this, "data", void 0);
|
|
223
|
-
_define_property(this, "submittedById", void 0);
|
|
224
|
-
_define_property(this, "submittedAt", void 0);
|
|
225
|
-
_define_property(this, "isDraft", void 0);
|
|
226
|
-
_define_property(this, "metadata", void 0);
|
|
227
|
-
_define_property(this, "createdAt", void 0);
|
|
228
|
-
_define_property(this, "updatedAt", void 0);
|
|
229
|
-
_define_property(this, "deletedAt", void 0);
|
|
230
|
-
_define_property(this, "createdById", void 0);
|
|
231
|
-
_define_property(this, "updatedById", void 0);
|
|
232
|
-
_define_property(this, "deletedById", void 0);
|
|
218
|
+
let FormResultResponseDto = class FormResultResponseDto extends _dtos.IdentityResponseDto {
|
|
219
|
+
constructor(...args){
|
|
220
|
+
super(...args), _define_property(this, "formId", void 0), _define_property(this, "schemaVersionSnapshot", void 0), _define_property(this, "schemaVersion", void 0), _define_property(this, "data", void 0), _define_property(this, "submittedById", void 0), _define_property(this, "submittedAt", void 0), _define_property(this, "isDraft", void 0), _define_property(this, "metadata", void 0);
|
|
233
221
|
}
|
|
234
222
|
};
|
|
235
|
-
_ts_decorate([
|
|
236
|
-
(0, _swagger.ApiProperty)(),
|
|
237
|
-
_ts_metadata("design:type", String)
|
|
238
|
-
], FormResultResponseDto.prototype, "id", void 0);
|
|
239
223
|
_ts_decorate([
|
|
240
224
|
(0, _swagger.ApiProperty)(),
|
|
241
225
|
_ts_metadata("design:type", String)
|
|
@@ -270,35 +254,3 @@ _ts_decorate([
|
|
|
270
254
|
}),
|
|
271
255
|
_ts_metadata("design:type", Object)
|
|
272
256
|
], FormResultResponseDto.prototype, "metadata", void 0);
|
|
273
|
-
_ts_decorate([
|
|
274
|
-
(0, _swagger.ApiProperty)(),
|
|
275
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
276
|
-
], FormResultResponseDto.prototype, "createdAt", void 0);
|
|
277
|
-
_ts_decorate([
|
|
278
|
-
(0, _swagger.ApiProperty)(),
|
|
279
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
280
|
-
], FormResultResponseDto.prototype, "updatedAt", void 0);
|
|
281
|
-
_ts_decorate([
|
|
282
|
-
(0, _swagger.ApiProperty)({
|
|
283
|
-
required: false
|
|
284
|
-
}),
|
|
285
|
-
_ts_metadata("design:type", Object)
|
|
286
|
-
], FormResultResponseDto.prototype, "deletedAt", void 0);
|
|
287
|
-
_ts_decorate([
|
|
288
|
-
(0, _swagger.ApiProperty)({
|
|
289
|
-
required: false
|
|
290
|
-
}),
|
|
291
|
-
_ts_metadata("design:type", Object)
|
|
292
|
-
], FormResultResponseDto.prototype, "createdById", void 0);
|
|
293
|
-
_ts_decorate([
|
|
294
|
-
(0, _swagger.ApiProperty)({
|
|
295
|
-
required: false
|
|
296
|
-
}),
|
|
297
|
-
_ts_metadata("design:type", Object)
|
|
298
|
-
], FormResultResponseDto.prototype, "updatedById", void 0);
|
|
299
|
-
_ts_decorate([
|
|
300
|
-
(0, _swagger.ApiProperty)({
|
|
301
|
-
required: false
|
|
302
|
-
}),
|
|
303
|
-
_ts_metadata("design:type", Object)
|
|
304
|
-
], FormResultResponseDto.prototype, "deletedById", void 0);
|
package/cjs/dtos/form.dto.js
CHANGED
|
@@ -28,6 +28,7 @@ _export(exports, {
|
|
|
28
28
|
const _swagger = require("@nestjs/swagger");
|
|
29
29
|
const _classvalidator = require("class-validator");
|
|
30
30
|
const _formaccesstypeenum = require("../enums/form-access-type.enum");
|
|
31
|
+
const _dtos = require("@flusys/nestjs-shared/dtos");
|
|
31
32
|
function _define_property(obj, key, value) {
|
|
32
33
|
if (key in obj) {
|
|
33
34
|
Object.defineProperty(obj, key, {
|
|
@@ -159,6 +160,7 @@ _ts_decorate([
|
|
|
159
160
|
description: 'Additional metadata',
|
|
160
161
|
required: false
|
|
161
162
|
}),
|
|
163
|
+
(0, _classvalidator.IsObject)(),
|
|
162
164
|
(0, _classvalidator.IsOptional)(),
|
|
163
165
|
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
164
166
|
], CreateFormDto.prototype, "metadata", void 0);
|
|
@@ -184,31 +186,11 @@ _ts_decorate([
|
|
|
184
186
|
(0, _classvalidator.IsOptional)(),
|
|
185
187
|
_ts_metadata("design:type", Number)
|
|
186
188
|
], UpdateFormDto.prototype, "schemaVersion", void 0);
|
|
187
|
-
let FormResponseDto = class FormResponseDto {
|
|
188
|
-
constructor(){
|
|
189
|
-
_define_property(this, "
|
|
190
|
-
_define_property(this, "name", void 0);
|
|
191
|
-
_define_property(this, "description", void 0);
|
|
192
|
-
_define_property(this, "slug", void 0);
|
|
193
|
-
_define_property(this, "schema", void 0);
|
|
194
|
-
_define_property(this, "schemaVersion", void 0);
|
|
195
|
-
_define_property(this, "accessType", void 0);
|
|
196
|
-
_define_property(this, "actionGroups", void 0);
|
|
197
|
-
_define_property(this, "companyId", void 0);
|
|
198
|
-
_define_property(this, "isActive", void 0);
|
|
199
|
-
_define_property(this, "metadata", void 0);
|
|
200
|
-
_define_property(this, "createdAt", void 0);
|
|
201
|
-
_define_property(this, "updatedAt", void 0);
|
|
202
|
-
_define_property(this, "deletedAt", void 0);
|
|
203
|
-
_define_property(this, "createdById", void 0);
|
|
204
|
-
_define_property(this, "updatedById", void 0);
|
|
205
|
-
_define_property(this, "deletedById", void 0);
|
|
189
|
+
let FormResponseDto = class FormResponseDto extends _dtos.IdentityResponseDto {
|
|
190
|
+
constructor(...args){
|
|
191
|
+
super(...args), _define_property(this, "name", void 0), _define_property(this, "description", void 0), _define_property(this, "slug", void 0), _define_property(this, "schema", void 0), _define_property(this, "schemaVersion", void 0), _define_property(this, "accessType", void 0), _define_property(this, "actionGroups", void 0), _define_property(this, "companyId", void 0), _define_property(this, "isActive", void 0), _define_property(this, "metadata", void 0);
|
|
206
192
|
}
|
|
207
193
|
};
|
|
208
|
-
_ts_decorate([
|
|
209
|
-
(0, _swagger.ApiProperty)(),
|
|
210
|
-
_ts_metadata("design:type", String)
|
|
211
|
-
], FormResponseDto.prototype, "id", void 0);
|
|
212
194
|
_ts_decorate([
|
|
213
195
|
(0, _swagger.ApiProperty)(),
|
|
214
196
|
_ts_metadata("design:type", String)
|
|
@@ -253,105 +235,20 @@ _ts_decorate([
|
|
|
253
235
|
}),
|
|
254
236
|
_ts_metadata("design:type", Object)
|
|
255
237
|
], FormResponseDto.prototype, "metadata", void 0);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
], FormResponseDto.prototype, "updatedAt", void 0);
|
|
264
|
-
_ts_decorate([
|
|
265
|
-
(0, _swagger.ApiProperty)({
|
|
266
|
-
required: false
|
|
267
|
-
}),
|
|
268
|
-
_ts_metadata("design:type", Object)
|
|
269
|
-
], FormResponseDto.prototype, "deletedAt", void 0);
|
|
270
|
-
_ts_decorate([
|
|
271
|
-
(0, _swagger.ApiProperty)({
|
|
272
|
-
required: false
|
|
273
|
-
}),
|
|
274
|
-
_ts_metadata("design:type", Object)
|
|
275
|
-
], FormResponseDto.prototype, "createdById", void 0);
|
|
276
|
-
_ts_decorate([
|
|
277
|
-
(0, _swagger.ApiProperty)({
|
|
278
|
-
required: false
|
|
279
|
-
}),
|
|
280
|
-
_ts_metadata("design:type", Object)
|
|
281
|
-
], FormResponseDto.prototype, "updatedById", void 0);
|
|
282
|
-
_ts_decorate([
|
|
283
|
-
(0, _swagger.ApiProperty)({
|
|
284
|
-
required: false
|
|
285
|
-
}),
|
|
286
|
-
_ts_metadata("design:type", Object)
|
|
287
|
-
], FormResponseDto.prototype, "deletedById", void 0);
|
|
288
|
-
let PublicFormResponseDto = class PublicFormResponseDto {
|
|
289
|
-
constructor(){
|
|
290
|
-
_define_property(this, "id", void 0);
|
|
291
|
-
_define_property(this, "name", void 0);
|
|
292
|
-
_define_property(this, "description", void 0);
|
|
293
|
-
_define_property(this, "schema", void 0);
|
|
294
|
-
_define_property(this, "schemaVersion", void 0);
|
|
295
|
-
}
|
|
238
|
+
let PublicFormResponseDto = class PublicFormResponseDto extends (0, _swagger.PickType)(FormResponseDto, [
|
|
239
|
+
'id',
|
|
240
|
+
'name',
|
|
241
|
+
'description',
|
|
242
|
+
'schema',
|
|
243
|
+
'schemaVersion'
|
|
244
|
+
]) {
|
|
296
245
|
};
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
]
|
|
305
|
-
_ts_decorate([
|
|
306
|
-
(0, _swagger.ApiProperty)(),
|
|
307
|
-
_ts_metadata("design:type", Object)
|
|
308
|
-
], PublicFormResponseDto.prototype, "description", void 0);
|
|
309
|
-
_ts_decorate([
|
|
310
|
-
(0, _swagger.ApiProperty)(),
|
|
311
|
-
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
312
|
-
], PublicFormResponseDto.prototype, "schema", void 0);
|
|
313
|
-
_ts_decorate([
|
|
314
|
-
(0, _swagger.ApiProperty)(),
|
|
315
|
-
_ts_metadata("design:type", Number)
|
|
316
|
-
], PublicFormResponseDto.prototype, "schemaVersion", void 0);
|
|
317
|
-
let FormAccessInfoResponseDto = class FormAccessInfoResponseDto {
|
|
318
|
-
constructor(){
|
|
319
|
-
_define_property(this, "id", void 0);
|
|
320
|
-
_define_property(this, "name", void 0);
|
|
321
|
-
_define_property(this, "description", void 0);
|
|
322
|
-
_define_property(this, "accessType", void 0);
|
|
323
|
-
_define_property(this, "actionGroups", void 0);
|
|
324
|
-
_define_property(this, "isActive", void 0);
|
|
325
|
-
}
|
|
246
|
+
let FormAccessInfoResponseDto = class FormAccessInfoResponseDto extends (0, _swagger.PickType)(FormResponseDto, [
|
|
247
|
+
'id',
|
|
248
|
+
'name',
|
|
249
|
+
'description',
|
|
250
|
+
'accessType',
|
|
251
|
+
'actionGroups',
|
|
252
|
+
'isActive'
|
|
253
|
+
]) {
|
|
326
254
|
};
|
|
327
|
-
_ts_decorate([
|
|
328
|
-
(0, _swagger.ApiProperty)(),
|
|
329
|
-
_ts_metadata("design:type", String)
|
|
330
|
-
], FormAccessInfoResponseDto.prototype, "id", void 0);
|
|
331
|
-
_ts_decorate([
|
|
332
|
-
(0, _swagger.ApiProperty)(),
|
|
333
|
-
_ts_metadata("design:type", String)
|
|
334
|
-
], FormAccessInfoResponseDto.prototype, "name", void 0);
|
|
335
|
-
_ts_decorate([
|
|
336
|
-
(0, _swagger.ApiProperty)(),
|
|
337
|
-
_ts_metadata("design:type", Object)
|
|
338
|
-
], FormAccessInfoResponseDto.prototype, "description", void 0);
|
|
339
|
-
_ts_decorate([
|
|
340
|
-
(0, _swagger.ApiProperty)({
|
|
341
|
-
enum: _formaccesstypeenum.FormAccessType
|
|
342
|
-
}),
|
|
343
|
-
_ts_metadata("design:type", typeof _formaccesstypeenum.FormAccessType === "undefined" ? Object : _formaccesstypeenum.FormAccessType)
|
|
344
|
-
], FormAccessInfoResponseDto.prototype, "accessType", void 0);
|
|
345
|
-
_ts_decorate([
|
|
346
|
-
(0, _swagger.ApiProperty)({
|
|
347
|
-
type: [
|
|
348
|
-
String
|
|
349
|
-
],
|
|
350
|
-
required: false
|
|
351
|
-
}),
|
|
352
|
-
_ts_metadata("design:type", Object)
|
|
353
|
-
], FormAccessInfoResponseDto.prototype, "actionGroups", void 0);
|
|
354
|
-
_ts_decorate([
|
|
355
|
-
(0, _swagger.ApiProperty)(),
|
|
356
|
-
_ts_metadata("design:type", Boolean)
|
|
357
|
-
], FormAccessInfoResponseDto.prototype, "isActive", void 0);
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "FormWithCompany", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _typeorm = require("typeorm");
|
|
12
|
-
const
|
|
12
|
+
const _formentity = require("./form.entity");
|
|
13
13
|
function _define_property(obj, key, value) {
|
|
14
14
|
if (key in obj) {
|
|
15
15
|
Object.defineProperty(obj, key, {
|
|
@@ -32,7 +32,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
32
32
|
function _ts_metadata(k, v) {
|
|
33
33
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34
34
|
}
|
|
35
|
-
let FormWithCompany = class FormWithCompany extends
|
|
35
|
+
let FormWithCompany = class FormWithCompany extends _formentity.Form {
|
|
36
36
|
constructor(...args){
|
|
37
37
|
super(...args), _define_property(this, "companyId", void 0);
|
|
38
38
|
}
|
|
@@ -51,5 +51,15 @@ FormWithCompany = _ts_decorate([
|
|
|
51
51
|
}),
|
|
52
52
|
(0, _typeorm.Index)([
|
|
53
53
|
'companyId'
|
|
54
|
+
]),
|
|
55
|
+
(0, _typeorm.Index)([
|
|
56
|
+
'companyId',
|
|
57
|
+
'slug'
|
|
58
|
+
], {
|
|
59
|
+
unique: true
|
|
60
|
+
}),
|
|
61
|
+
(0, _typeorm.Index)([
|
|
62
|
+
'companyId',
|
|
63
|
+
'isActive'
|
|
54
64
|
])
|
|
55
65
|
], FormWithCompany);
|