@flusys/nestjs-form-builder 4.1.1 → 5.0.1
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 +89 -386
- package/cjs/config/message-keys.js +7 -31
- package/cjs/controllers/form-result.controller.js +33 -16
- package/cjs/controllers/form.controller.js +40 -19
- package/cjs/docs/form-builder-swagger.config.js +3 -0
- package/cjs/dtos/form-result.dto.js +1 -17
- package/cjs/dtos/form.dto.js +1 -17
- package/cjs/entities/form-result.entity.js +3 -9
- package/cjs/entities/form.entity.js +4 -9
- package/cjs/services/form-result.service.js +3 -8
- package/cjs/services/form.service.js +0 -2
- package/config/message-keys.d.ts +5 -60
- package/controllers/form-result.controller.d.ts +4 -4
- package/controllers/form.controller.d.ts +16 -15
- package/dtos/form-result.dto.d.ts +0 -2
- package/dtos/form.dto.d.ts +0 -2
- package/entities/form-result.entity.d.ts +0 -1
- package/entities/form.entity.d.ts +0 -1
- package/fesm/config/message-keys.js +7 -29
- package/fesm/controllers/form-result.controller.js +33 -16
- package/fesm/controllers/form.controller.js +40 -19
- package/fesm/docs/form-builder-swagger.config.js +3 -0
- package/fesm/dtos/form-result.dto.js +1 -17
- package/fesm/dtos/form.dto.js +1 -17
- package/fesm/entities/form-result.entity.js +4 -10
- package/fesm/entities/form.entity.js +4 -9
- package/fesm/services/form-result.service.js +3 -8
- package/fesm/services/form.service.js +0 -2
- package/interfaces/form-result.interface.d.ts +0 -1
- package/interfaces/form.interface.d.ts +0 -1
- package/package.json +3 -3
|
@@ -15,6 +15,7 @@ const _interfaces = require("@flusys/nestjs-shared/interfaces");
|
|
|
15
15
|
const _common = require("@nestjs/common");
|
|
16
16
|
const _swagger = require("@nestjs/swagger");
|
|
17
17
|
const _dtos = require("../dtos");
|
|
18
|
+
const _config = require("../config");
|
|
18
19
|
const _formservice = require("../services/form.service");
|
|
19
20
|
function _define_property(obj, key, value) {
|
|
20
21
|
if (key in obj) {
|
|
@@ -94,29 +95,49 @@ let FormController = class FormController extends (0, _classes.createApiControll
|
|
|
94
95
|
/**
|
|
95
96
|
* Get form access info (no authentication required)
|
|
96
97
|
*/ async getFormAccessInfo(id) {
|
|
97
|
-
|
|
98
|
+
const data = await this.formService.getFormAccessInfo(id);
|
|
99
|
+
return {
|
|
100
|
+
success: true,
|
|
101
|
+
message: 'Form access info retrieved',
|
|
102
|
+
messageKey: _config.FORM_MESSAGES.GET_ACCESS_INFO_SUCCESS,
|
|
103
|
+
data
|
|
104
|
+
};
|
|
98
105
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
async getPublicForm(id) {
|
|
107
|
+
const data = await this.formService.getPublicForm(id);
|
|
108
|
+
return {
|
|
109
|
+
success: true,
|
|
110
|
+
message: 'Form retrieved',
|
|
111
|
+
messageKey: _config.FORM_MESSAGES.GET_SUCCESS,
|
|
112
|
+
data
|
|
113
|
+
};
|
|
104
114
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
async getAuthenticatedForm(id, user) {
|
|
116
|
+
const data = await this.formService.getAuthenticatedForm(id, user);
|
|
117
|
+
return {
|
|
118
|
+
success: true,
|
|
119
|
+
message: 'Form retrieved',
|
|
120
|
+
messageKey: _config.FORM_MESSAGES.GET_SUCCESS,
|
|
121
|
+
data
|
|
122
|
+
};
|
|
110
123
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
124
|
+
async getBySlug(slug, _user) {
|
|
125
|
+
const data = await this.formService.getBySlug(slug);
|
|
126
|
+
return {
|
|
127
|
+
success: true,
|
|
128
|
+
message: 'Form retrieved',
|
|
129
|
+
messageKey: _config.FORM_MESSAGES.GET_SUCCESS,
|
|
130
|
+
data
|
|
131
|
+
};
|
|
115
132
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
133
|
+
async getPublicFormBySlug(slug) {
|
|
134
|
+
const data = await this.formService.getPublicFormBySlug(slug);
|
|
135
|
+
return {
|
|
136
|
+
success: true,
|
|
137
|
+
message: 'Form retrieved',
|
|
138
|
+
messageKey: _config.FORM_MESSAGES.GET_SUCCESS,
|
|
139
|
+
data
|
|
140
|
+
};
|
|
120
141
|
}
|
|
121
142
|
constructor(formService){
|
|
122
143
|
super(formService), _define_property(this, "formService", void 0), this.formService = formService;
|
|
@@ -36,10 +36,13 @@ Object.defineProperty(exports, "formBuilderSwaggerConfig", {
|
|
|
36
36
|
];
|
|
37
37
|
function formBuilderSwaggerConfig(bootstrapConfig) {
|
|
38
38
|
const enableCompanyFeature = bootstrapConfig?.enableCompanyFeature ?? true;
|
|
39
|
+
const isMultiTenant = bootstrapConfig?.databaseMode === 'multi-tenant';
|
|
40
|
+
const multiTenantNote = isMultiTenant ? `\n> **Multi-Tenant Mode**: Include \`x-tenant-id\` header to target a specific tenant database.\n` : '';
|
|
39
41
|
return {
|
|
40
42
|
title: 'Form Builder API',
|
|
41
43
|
description: `
|
|
42
44
|
# Form Builder API
|
|
45
|
+
${multiTenantNote}
|
|
43
46
|
|
|
44
47
|
Dynamic form builder with schema versioning, conditional logic, and access control.
|
|
45
48
|
|
|
@@ -61,7 +61,6 @@ let SubmitFormDto = class SubmitFormDto {
|
|
|
61
61
|
_define_property(this, "formId", void 0);
|
|
62
62
|
_define_property(this, "data", void 0);
|
|
63
63
|
_define_property(this, "isDraft", void 0);
|
|
64
|
-
_define_property(this, "metadata", void 0);
|
|
65
64
|
}
|
|
66
65
|
};
|
|
67
66
|
_ts_decorate([
|
|
@@ -95,15 +94,6 @@ _ts_decorate([
|
|
|
95
94
|
(0, _classvalidator.IsOptional)(),
|
|
96
95
|
_ts_metadata("design:type", Boolean)
|
|
97
96
|
], SubmitFormDto.prototype, "isDraft", void 0);
|
|
98
|
-
_ts_decorate([
|
|
99
|
-
(0, _swagger.ApiProperty)({
|
|
100
|
-
description: 'Additional metadata',
|
|
101
|
-
required: false
|
|
102
|
-
}),
|
|
103
|
-
(0, _classvalidator.IsObject)(),
|
|
104
|
-
(0, _classvalidator.IsOptional)(),
|
|
105
|
-
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
106
|
-
], SubmitFormDto.prototype, "metadata", void 0);
|
|
107
97
|
let CreateFormResultDto = class CreateFormResultDto extends SubmitFormDto {
|
|
108
98
|
constructor(...args){
|
|
109
99
|
super(...args), _define_property(this, "schemaVersionSnapshot", void 0), _define_property(this, "schemaVersion", void 0), _define_property(this, "submittedById", void 0);
|
|
@@ -217,7 +207,7 @@ _ts_decorate([
|
|
|
217
207
|
], GetResultsByFormDto.prototype, "pageSize", void 0);
|
|
218
208
|
let FormResultResponseDto = class FormResultResponseDto extends _dtos.IdentityResponseDto {
|
|
219
209
|
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)
|
|
210
|
+
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);
|
|
221
211
|
}
|
|
222
212
|
};
|
|
223
213
|
_ts_decorate([
|
|
@@ -248,9 +238,3 @@ _ts_decorate([
|
|
|
248
238
|
(0, _swagger.ApiProperty)(),
|
|
249
239
|
_ts_metadata("design:type", Boolean)
|
|
250
240
|
], FormResultResponseDto.prototype, "isDraft", void 0);
|
|
251
|
-
_ts_decorate([
|
|
252
|
-
(0, _swagger.ApiProperty)({
|
|
253
|
-
required: false
|
|
254
|
-
}),
|
|
255
|
-
_ts_metadata("design:type", Object)
|
|
256
|
-
], FormResultResponseDto.prototype, "metadata", void 0);
|
package/cjs/dtos/form.dto.js
CHANGED
|
@@ -61,7 +61,6 @@ let CreateFormDto = class CreateFormDto {
|
|
|
61
61
|
_define_property(this, "actionGroups", void 0);
|
|
62
62
|
_define_property(this, "companyId", void 0);
|
|
63
63
|
_define_property(this, "isActive", void 0);
|
|
64
|
-
_define_property(this, "metadata", void 0);
|
|
65
64
|
}
|
|
66
65
|
};
|
|
67
66
|
_ts_decorate([
|
|
@@ -155,15 +154,6 @@ _ts_decorate([
|
|
|
155
154
|
(0, _classvalidator.IsOptional)(),
|
|
156
155
|
_ts_metadata("design:type", Boolean)
|
|
157
156
|
], CreateFormDto.prototype, "isActive", void 0);
|
|
158
|
-
_ts_decorate([
|
|
159
|
-
(0, _swagger.ApiProperty)({
|
|
160
|
-
description: 'Additional metadata',
|
|
161
|
-
required: false
|
|
162
|
-
}),
|
|
163
|
-
(0, _classvalidator.IsObject)(),
|
|
164
|
-
(0, _classvalidator.IsOptional)(),
|
|
165
|
-
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
166
|
-
], CreateFormDto.prototype, "metadata", void 0);
|
|
167
157
|
let UpdateFormDto = class UpdateFormDto extends (0, _swagger.PartialType)(CreateFormDto) {
|
|
168
158
|
constructor(...args){
|
|
169
159
|
super(...args), _define_property(this, "id", void 0), _define_property(this, "schemaVersion", void 0);
|
|
@@ -188,7 +178,7 @@ _ts_decorate([
|
|
|
188
178
|
], UpdateFormDto.prototype, "schemaVersion", void 0);
|
|
189
179
|
let FormResponseDto = class FormResponseDto extends _dtos.IdentityResponseDto {
|
|
190
180
|
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)
|
|
181
|
+
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);
|
|
192
182
|
}
|
|
193
183
|
};
|
|
194
184
|
_ts_decorate([
|
|
@@ -229,12 +219,6 @@ _ts_decorate([
|
|
|
229
219
|
(0, _swagger.ApiProperty)(),
|
|
230
220
|
_ts_metadata("design:type", Boolean)
|
|
231
221
|
], FormResponseDto.prototype, "isActive", void 0);
|
|
232
|
-
_ts_decorate([
|
|
233
|
-
(0, _swagger.ApiProperty)({
|
|
234
|
-
required: false
|
|
235
|
-
}),
|
|
236
|
-
_ts_metadata("design:type", Object)
|
|
237
|
-
], FormResponseDto.prototype, "metadata", void 0);
|
|
238
222
|
let PublicFormResponseDto = class PublicFormResponseDto extends (0, _swagger.PickType)(FormResponseDto, [
|
|
239
223
|
'id',
|
|
240
224
|
'name',
|
|
@@ -34,7 +34,7 @@ function _ts_metadata(k, v) {
|
|
|
34
34
|
}
|
|
35
35
|
let FormResult = class FormResult extends _nestjsshared.Identity {
|
|
36
36
|
constructor(...args){
|
|
37
|
-
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)
|
|
37
|
+
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);
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
_ts_decorate([
|
|
@@ -48,7 +48,7 @@ _ts_decorate([
|
|
|
48
48
|
], FormResult.prototype, "formId", void 0);
|
|
49
49
|
_ts_decorate([
|
|
50
50
|
(0, _typeorm.Column)({
|
|
51
|
-
type:
|
|
51
|
+
type: (0, _nestjsshared.getJsonColumnType)(),
|
|
52
52
|
nullable: false,
|
|
53
53
|
name: 'schema_version_snapshot'
|
|
54
54
|
}),
|
|
@@ -64,7 +64,7 @@ _ts_decorate([
|
|
|
64
64
|
], FormResult.prototype, "schemaVersion", void 0);
|
|
65
65
|
_ts_decorate([
|
|
66
66
|
(0, _typeorm.Column)({
|
|
67
|
-
type:
|
|
67
|
+
type: (0, _nestjsshared.getJsonColumnType)(),
|
|
68
68
|
nullable: false
|
|
69
69
|
}),
|
|
70
70
|
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
@@ -93,12 +93,6 @@ _ts_decorate([
|
|
|
93
93
|
}),
|
|
94
94
|
_ts_metadata("design:type", Boolean)
|
|
95
95
|
], FormResult.prototype, "isDraft", void 0);
|
|
96
|
-
_ts_decorate([
|
|
97
|
-
(0, _typeorm.Column)('simple-json', {
|
|
98
|
-
nullable: true
|
|
99
|
-
}),
|
|
100
|
-
_ts_metadata("design:type", Object)
|
|
101
|
-
], FormResult.prototype, "metadata", void 0);
|
|
102
96
|
FormResult = _ts_decorate([
|
|
103
97
|
(0, _typeorm.Entity)({
|
|
104
98
|
name: 'form_result'
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "Form", {
|
|
|
8
8
|
return Form;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _nestjsshared = require("@flusys/nestjs-shared");
|
|
11
12
|
const _entities = require("@flusys/nestjs-shared/entities");
|
|
12
13
|
const _typeorm = require("typeorm");
|
|
13
14
|
const _formaccesstypeenum = require("../enums/form-access-type.enum");
|
|
@@ -35,7 +36,7 @@ function _ts_metadata(k, v) {
|
|
|
35
36
|
}
|
|
36
37
|
let Form = class Form extends _entities.Identity {
|
|
37
38
|
constructor(...args){
|
|
38
|
-
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, "isActive", void 0)
|
|
39
|
+
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, "isActive", void 0);
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
42
|
_ts_decorate([
|
|
@@ -64,7 +65,7 @@ _ts_decorate([
|
|
|
64
65
|
], Form.prototype, "slug", void 0);
|
|
65
66
|
_ts_decorate([
|
|
66
67
|
(0, _typeorm.Column)({
|
|
67
|
-
type:
|
|
68
|
+
type: (0, _nestjsshared.getJsonColumnType)(),
|
|
68
69
|
nullable: false
|
|
69
70
|
}),
|
|
70
71
|
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
@@ -89,7 +90,7 @@ _ts_decorate([
|
|
|
89
90
|
], Form.prototype, "accessType", void 0);
|
|
90
91
|
_ts_decorate([
|
|
91
92
|
(0, _typeorm.Column)({
|
|
92
|
-
type:
|
|
93
|
+
type: (0, _nestjsshared.getJsonColumnType)(),
|
|
93
94
|
nullable: true,
|
|
94
95
|
name: 'action_groups'
|
|
95
96
|
}),
|
|
@@ -104,12 +105,6 @@ _ts_decorate([
|
|
|
104
105
|
}),
|
|
105
106
|
_ts_metadata("design:type", Boolean)
|
|
106
107
|
], Form.prototype, "isActive", void 0);
|
|
107
|
-
_ts_decorate([
|
|
108
|
-
(0, _typeorm.Column)('simple-json', {
|
|
109
|
-
nullable: true
|
|
110
|
-
}),
|
|
111
|
-
_ts_metadata("design:type", Object)
|
|
112
|
-
], Form.prototype, "metadata", void 0);
|
|
113
108
|
Form = _ts_decorate([
|
|
114
109
|
(0, _typeorm.Entity)({
|
|
115
110
|
name: 'form'
|
|
@@ -139,7 +139,6 @@ let FormResultService = class FormResultService extends _classes.RequestScopedAp
|
|
|
139
139
|
'submittedById',
|
|
140
140
|
'submittedAt',
|
|
141
141
|
'isDraft',
|
|
142
|
-
'metadata',
|
|
143
142
|
'createdAt',
|
|
144
143
|
'updatedAt'
|
|
145
144
|
];
|
|
@@ -182,7 +181,6 @@ let FormResultService = class FormResultService extends _classes.RequestScopedAp
|
|
|
182
181
|
submittedById: entity.submittedById,
|
|
183
182
|
submittedAt: entity.submittedAt,
|
|
184
183
|
isDraft: entity.isDraft,
|
|
185
|
-
metadata: entity.metadata,
|
|
186
184
|
createdAt: entity.createdAt,
|
|
187
185
|
updatedAt: entity.updatedAt,
|
|
188
186
|
deletedAt: entity.deletedAt,
|
|
@@ -208,8 +206,7 @@ let FormResultService = class FormResultService extends _classes.RequestScopedAp
|
|
|
208
206
|
data: dto.data,
|
|
209
207
|
schemaVersionSnapshot: form.schema,
|
|
210
208
|
schemaVersion: form.schemaVersion,
|
|
211
|
-
submittedAt: new Date()
|
|
212
|
-
metadata: dto.metadata ?? existingDraft.metadata
|
|
209
|
+
submittedAt: new Date()
|
|
213
210
|
});
|
|
214
211
|
const saved = await this.repository.save(existingDraft);
|
|
215
212
|
return this.convertEntityToResponseDto(saved, false);
|
|
@@ -224,8 +221,7 @@ let FormResultService = class FormResultService extends _classes.RequestScopedAp
|
|
|
224
221
|
data: this.applyComputedFields(dto.data, form, isDraft),
|
|
225
222
|
submittedById: user?.id ?? null,
|
|
226
223
|
submittedAt: new Date(),
|
|
227
|
-
isDraft
|
|
228
|
-
metadata: dto.metadata ?? null
|
|
224
|
+
isDraft
|
|
229
225
|
});
|
|
230
226
|
return this.convertEntityToResponseDto(saved, false);
|
|
231
227
|
}
|
|
@@ -261,8 +257,7 @@ let FormResultService = class FormResultService extends _classes.RequestScopedAp
|
|
|
261
257
|
schemaVersionSnapshot: form.schema,
|
|
262
258
|
schemaVersion: form.schemaVersion,
|
|
263
259
|
submittedAt: new Date(),
|
|
264
|
-
isDraft
|
|
265
|
-
metadata: dto.metadata ?? draft.metadata
|
|
260
|
+
isDraft
|
|
266
261
|
});
|
|
267
262
|
const saved = await this.repository.save(draft);
|
|
268
263
|
return this.convertEntityToResponseDto(saved, false);
|
|
@@ -114,7 +114,6 @@ let FormService = class FormService extends _classes.RequestScopedApiService {
|
|
|
114
114
|
'accessType',
|
|
115
115
|
'actionGroups',
|
|
116
116
|
'isActive',
|
|
117
|
-
'metadata',
|
|
118
117
|
'createdAt',
|
|
119
118
|
'updatedAt'
|
|
120
119
|
];
|
|
@@ -153,7 +152,6 @@ let FormService = class FormService extends _classes.RequestScopedApiService {
|
|
|
153
152
|
actionGroups: entity.actionGroups,
|
|
154
153
|
isActive: entity.isActive,
|
|
155
154
|
companyId: entityWithCompany.companyId ?? null,
|
|
156
|
-
metadata: entity.metadata,
|
|
157
155
|
createdAt: entity.createdAt,
|
|
158
156
|
updatedAt: entity.updatedAt,
|
|
159
157
|
deletedAt: entity.deletedAt,
|
package/config/message-keys.d.ts
CHANGED
|
@@ -1,74 +1,19 @@
|
|
|
1
1
|
export declare const FORM_MESSAGES: {
|
|
2
|
-
readonly CREATE_SUCCESS: "form.create.success";
|
|
3
|
-
readonly CREATE_MANY_SUCCESS: "form.create.many.success";
|
|
4
|
-
readonly GET_SUCCESS: "form.get.success";
|
|
5
|
-
readonly GET_ALL_SUCCESS: "form.get.all.success";
|
|
6
|
-
readonly UPDATE_SUCCESS: "form.update.success";
|
|
7
|
-
readonly UPDATE_MANY_SUCCESS: "form.update.many.success";
|
|
8
|
-
readonly DELETE_SUCCESS: "form.delete.success";
|
|
9
|
-
readonly RESTORE_SUCCESS: "form.restore.success";
|
|
10
2
|
readonly NOT_FOUND: "form.not.found";
|
|
11
|
-
readonly SCHEMA_SUCCESS: "form.schema.success";
|
|
12
|
-
readonly PUBLISH_SUCCESS: "form.publish.success";
|
|
13
|
-
readonly UNPUBLISH_SUCCESS: "form.unpublish.success";
|
|
14
|
-
readonly DUPLICATE_SUCCESS: "form.duplicate.success";
|
|
15
3
|
readonly NOT_PUBLIC: "form.not.public";
|
|
16
4
|
readonly AUTH_REQUIRED: "form.auth.required";
|
|
17
5
|
readonly ACCESS_DENIED: "form.access.denied";
|
|
18
6
|
readonly INVALID_ACCESS_TYPE: "form.invalid.access.type";
|
|
19
7
|
readonly PERMISSION_CHECK_FAILED: "form.permission.check.failed";
|
|
8
|
+
readonly GET_SUCCESS: "form.get.success";
|
|
9
|
+
readonly GET_ACCESS_INFO_SUCCESS: "form.get.access.info.success";
|
|
20
10
|
};
|
|
21
11
|
export declare const FORM_RESULT_MESSAGES: {
|
|
22
|
-
readonly CREATE_SUCCESS: "form.result.create.success";
|
|
23
|
-
readonly CREATE_MANY_SUCCESS: "form.result.create.many.success";
|
|
24
|
-
readonly GET_SUCCESS: "form.result.get.success";
|
|
25
12
|
readonly GET_ALL_SUCCESS: "form.result.get.all.success";
|
|
26
|
-
readonly UPDATE_SUCCESS: "form.result.update.success";
|
|
27
|
-
readonly UPDATE_MANY_SUCCESS: "form.result.update.many.success";
|
|
28
|
-
readonly DELETE_SUCCESS: "form.result.delete.success";
|
|
29
|
-
readonly RESTORE_SUCCESS: "form.result.restore.success";
|
|
30
13
|
readonly NOT_FOUND: "form.result.not.found";
|
|
31
|
-
readonly SUBMIT_SUCCESS: "form.result.submit.success";
|
|
32
|
-
readonly EXPORT_SUCCESS: "form.result.export.success";
|
|
33
|
-
readonly STATS_SUCCESS: "form.result.stats.success";
|
|
34
14
|
readonly HAS_SUBMITTED_SUCCESS: "form.result.has.submitted.success";
|
|
35
15
|
readonly HAS_NOT_SUBMITTED_SUCCESS: "form.result.has.not.submitted.success";
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
readonly
|
|
39
|
-
readonly CREATE_SUCCESS: "form.create.success";
|
|
40
|
-
readonly CREATE_MANY_SUCCESS: "form.create.many.success";
|
|
41
|
-
readonly GET_SUCCESS: "form.get.success";
|
|
42
|
-
readonly GET_ALL_SUCCESS: "form.get.all.success";
|
|
43
|
-
readonly UPDATE_SUCCESS: "form.update.success";
|
|
44
|
-
readonly UPDATE_MANY_SUCCESS: "form.update.many.success";
|
|
45
|
-
readonly DELETE_SUCCESS: "form.delete.success";
|
|
46
|
-
readonly RESTORE_SUCCESS: "form.restore.success";
|
|
47
|
-
readonly NOT_FOUND: "form.not.found";
|
|
48
|
-
readonly SCHEMA_SUCCESS: "form.schema.success";
|
|
49
|
-
readonly PUBLISH_SUCCESS: "form.publish.success";
|
|
50
|
-
readonly UNPUBLISH_SUCCESS: "form.unpublish.success";
|
|
51
|
-
readonly DUPLICATE_SUCCESS: "form.duplicate.success";
|
|
52
|
-
readonly NOT_PUBLIC: "form.not.public";
|
|
53
|
-
readonly AUTH_REQUIRED: "form.auth.required";
|
|
54
|
-
readonly ACCESS_DENIED: "form.access.denied";
|
|
55
|
-
readonly INVALID_ACCESS_TYPE: "form.invalid.access.type";
|
|
56
|
-
readonly PERMISSION_CHECK_FAILED: "form.permission.check.failed";
|
|
57
|
-
};
|
|
58
|
-
readonly FORM_RESULT: {
|
|
59
|
-
readonly CREATE_SUCCESS: "form.result.create.success";
|
|
60
|
-
readonly CREATE_MANY_SUCCESS: "form.result.create.many.success";
|
|
61
|
-
readonly GET_SUCCESS: "form.result.get.success";
|
|
62
|
-
readonly GET_ALL_SUCCESS: "form.result.get.all.success";
|
|
63
|
-
readonly UPDATE_SUCCESS: "form.result.update.success";
|
|
64
|
-
readonly UPDATE_MANY_SUCCESS: "form.result.update.many.success";
|
|
65
|
-
readonly DELETE_SUCCESS: "form.result.delete.success";
|
|
66
|
-
readonly RESTORE_SUCCESS: "form.result.restore.success";
|
|
67
|
-
readonly NOT_FOUND: "form.result.not.found";
|
|
68
|
-
readonly SUBMIT_SUCCESS: "form.result.submit.success";
|
|
69
|
-
readonly EXPORT_SUCCESS: "form.result.export.success";
|
|
70
|
-
readonly STATS_SUCCESS: "form.result.stats.success";
|
|
71
|
-
readonly HAS_SUBMITTED_SUCCESS: "form.result.has.submitted.success";
|
|
72
|
-
readonly HAS_NOT_SUBMITTED_SUCCESS: "form.result.has.not.submitted.success";
|
|
73
|
-
};
|
|
16
|
+
readonly SUBMIT_SUCCESS: "form.result.submit.success";
|
|
17
|
+
readonly DRAFT_GET_SUCCESS: "form.result.draft.get.success";
|
|
18
|
+
readonly DRAFT_UPDATE_SUCCESS: "form.result.draft.update.success";
|
|
74
19
|
};
|
|
@@ -20,10 +20,10 @@ declare const FormResultController_base: abstract new (service: FormResultServic
|
|
|
20
20
|
export declare class FormResultController extends FormResultController_base {
|
|
21
21
|
formResultService: FormResultService;
|
|
22
22
|
constructor(formResultService: FormResultService);
|
|
23
|
-
submitForm(dto: SubmitFormDto, user: ILoggedUserInfo): Promise<FormResultResponseDto
|
|
24
|
-
submitPublicForm(dto: SubmitFormDto): Promise<FormResultResponseDto
|
|
25
|
-
getMyDraft(dto: GetMyDraftDto, user: ILoggedUserInfo): Promise<FormResultResponseDto | null
|
|
26
|
-
updateDraft(dto: UpdateDraftDto, user: ILoggedUserInfo): Promise<FormResultResponseDto
|
|
23
|
+
submitForm(dto: SubmitFormDto, user: ILoggedUserInfo): Promise<SingleResponseDto<FormResultResponseDto>>;
|
|
24
|
+
submitPublicForm(dto: SubmitFormDto): Promise<SingleResponseDto<FormResultResponseDto>>;
|
|
25
|
+
getMyDraft(dto: GetMyDraftDto, user: ILoggedUserInfo): Promise<SingleResponseDto<FormResultResponseDto | null>>;
|
|
26
|
+
updateDraft(dto: UpdateDraftDto, user: ILoggedUserInfo): Promise<SingleResponseDto<FormResultResponseDto>>;
|
|
27
27
|
getByFormId(dto: GetResultsByFormDto, user: ILoggedUserInfo): Promise<ListResponseDto<FormResultResponseDto>>;
|
|
28
28
|
hasUserSubmitted(dto: GetMyDraftDto, user: ILoggedUserInfo): Promise<SingleResponseDto<boolean>>;
|
|
29
29
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SingleResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
1
2
|
import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
2
3
|
import { CreateFormDto, FormAccessInfoResponseDto, FormResponseDto, PublicFormResponseDto, UpdateFormDto } from '../dtos';
|
|
3
4
|
import { FormService } from '../services/form.service';
|
|
@@ -5,24 +6,24 @@ declare const FormController_base: abstract new (service: FormService) => {
|
|
|
5
6
|
readonly enabledEndpoints: import("@flusys/nestjs-shared/classes").ApiEndpoint[] | "all";
|
|
6
7
|
service: FormService;
|
|
7
8
|
isEnabled(endpoint: import("@flusys/nestjs-shared/classes").ApiEndpoint): boolean;
|
|
8
|
-
insert(addDto: CreateFormDto, user: ILoggedUserInfo | null): Promise<
|
|
9
|
-
insertMany(addDto: CreateFormDto[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").BulkResponseDto<FormResponseDto>>;
|
|
10
|
-
getById(id: string, body: import("@flusys/nestjs-shared").GetByIdBodyDto, user: ILoggedUserInfo | null): Promise<
|
|
11
|
-
getByIds(body: import("@flusys/nestjs-shared").GetByIdsDto, user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").ListResponseDto<FormResponseDto>>;
|
|
12
|
-
update(updateDto: UpdateFormDto, user: ILoggedUserInfo | null): Promise<
|
|
13
|
-
updateMany(updateDtos: UpdateFormDto[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").BulkResponseDto<FormResponseDto>>;
|
|
14
|
-
bulkUpsert(dtos: (CreateFormDto | UpdateFormDto)[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").BulkResponseDto<FormResponseDto>>;
|
|
15
|
-
getByFilter(filter: Record<string, any>, user: ILoggedUserInfo | null): Promise<
|
|
16
|
-
getAll(filterAndPaginationDto: import("@flusys/nestjs-shared").FilterAndPaginationDto, user: ILoggedUserInfo | null, search?: string): Promise<import("@flusys/nestjs-shared").ListResponseDto<FormResponseDto>>;
|
|
17
|
-
delete(deleteDto: import("@flusys/nestjs-shared").DeleteDto, user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").MessageResponseDto>;
|
|
9
|
+
insert(addDto: CreateFormDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<FormResponseDto>>;
|
|
10
|
+
insertMany(addDto: CreateFormDto[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared/dtos").BulkResponseDto<FormResponseDto>>;
|
|
11
|
+
getById(id: string, body: import("@flusys/nestjs-shared/dtos").GetByIdBodyDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<FormResponseDto>>;
|
|
12
|
+
getByIds(body: import("@flusys/nestjs-shared/dtos").GetByIdsDto, user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared/dtos").ListResponseDto<FormResponseDto>>;
|
|
13
|
+
update(updateDto: UpdateFormDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<FormResponseDto>>;
|
|
14
|
+
updateMany(updateDtos: UpdateFormDto[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared/dtos").BulkResponseDto<FormResponseDto>>;
|
|
15
|
+
bulkUpsert(dtos: (CreateFormDto | UpdateFormDto)[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared/dtos").BulkResponseDto<FormResponseDto>>;
|
|
16
|
+
getByFilter(filter: Record<string, any>, user: ILoggedUserInfo | null): Promise<SingleResponseDto<FormResponseDto>>;
|
|
17
|
+
getAll(filterAndPaginationDto: import("@flusys/nestjs-shared/dtos").FilterAndPaginationDto, user: ILoggedUserInfo | null, search?: string): Promise<import("@flusys/nestjs-shared/dtos").ListResponseDto<FormResponseDto>>;
|
|
18
|
+
delete(deleteDto: import("@flusys/nestjs-shared/dtos").DeleteDto, user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared/dtos").MessageResponseDto>;
|
|
18
19
|
};
|
|
19
20
|
export declare class FormController extends FormController_base {
|
|
20
21
|
formService: FormService;
|
|
21
22
|
constructor(formService: FormService);
|
|
22
|
-
getFormAccessInfo(id: string): Promise<FormAccessInfoResponseDto
|
|
23
|
-
getPublicForm(id: string): Promise<PublicFormResponseDto
|
|
24
|
-
getAuthenticatedForm(id: string, user: ILoggedUserInfo): Promise<PublicFormResponseDto
|
|
25
|
-
getBySlug(slug: string, _user: ILoggedUserInfo): Promise<FormResponseDto | null
|
|
26
|
-
getPublicFormBySlug(slug: string): Promise<PublicFormResponseDto | null
|
|
23
|
+
getFormAccessInfo(id: string): Promise<SingleResponseDto<FormAccessInfoResponseDto>>;
|
|
24
|
+
getPublicForm(id: string): Promise<SingleResponseDto<PublicFormResponseDto>>;
|
|
25
|
+
getAuthenticatedForm(id: string, user: ILoggedUserInfo): Promise<SingleResponseDto<PublicFormResponseDto>>;
|
|
26
|
+
getBySlug(slug: string, _user: ILoggedUserInfo): Promise<SingleResponseDto<FormResponseDto | null>>;
|
|
27
|
+
getPublicFormBySlug(slug: string): Promise<SingleResponseDto<PublicFormResponseDto | null>>;
|
|
27
28
|
}
|
|
28
29
|
export {};
|
|
@@ -3,7 +3,6 @@ export declare class SubmitFormDto {
|
|
|
3
3
|
formId: string;
|
|
4
4
|
data: Record<string, unknown>;
|
|
5
5
|
isDraft?: boolean;
|
|
6
|
-
metadata?: Record<string, unknown>;
|
|
7
6
|
}
|
|
8
7
|
export declare class CreateFormResultDto extends SubmitFormDto {
|
|
9
8
|
schemaVersionSnapshot?: Record<string, unknown>;
|
|
@@ -33,6 +32,5 @@ export declare class FormResultResponseDto extends IdentityResponseDto {
|
|
|
33
32
|
submittedById: string | null;
|
|
34
33
|
submittedAt: Date;
|
|
35
34
|
isDraft: boolean;
|
|
36
|
-
metadata: Record<string, unknown> | null;
|
|
37
35
|
}
|
|
38
36
|
export {};
|
package/dtos/form.dto.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export declare class CreateFormDto {
|
|
|
9
9
|
actionGroups?: string[];
|
|
10
10
|
companyId?: string;
|
|
11
11
|
isActive?: boolean;
|
|
12
|
-
metadata?: Record<string, unknown>;
|
|
13
12
|
}
|
|
14
13
|
declare const UpdateFormDto_base: import("@nestjs/common").Type<Partial<CreateFormDto>>;
|
|
15
14
|
export declare class UpdateFormDto extends UpdateFormDto_base {
|
|
@@ -26,7 +25,6 @@ export declare class FormResponseDto extends IdentityResponseDto {
|
|
|
26
25
|
actionGroups: string[] | null;
|
|
27
26
|
companyId: string | null;
|
|
28
27
|
isActive: boolean;
|
|
29
|
-
metadata: Record<string, unknown> | null;
|
|
30
28
|
}
|
|
31
29
|
declare const PublicFormResponseDto_base: import("@nestjs/common").Type<Pick<FormResponseDto, "description" | "name" | "schema" | "id" | "schemaVersion">>;
|
|
32
30
|
export declare class PublicFormResponseDto extends PublicFormResponseDto_base {
|
|
@@ -1,42 +1,20 @@
|
|
|
1
1
|
// ==================== FORM BUILDER MODULE MESSAGE KEYS ====================
|
|
2
2
|
export const FORM_MESSAGES = {
|
|
3
|
-
CREATE_SUCCESS: 'form.create.success',
|
|
4
|
-
CREATE_MANY_SUCCESS: 'form.create.many.success',
|
|
5
|
-
GET_SUCCESS: 'form.get.success',
|
|
6
|
-
GET_ALL_SUCCESS: 'form.get.all.success',
|
|
7
|
-
UPDATE_SUCCESS: 'form.update.success',
|
|
8
|
-
UPDATE_MANY_SUCCESS: 'form.update.many.success',
|
|
9
|
-
DELETE_SUCCESS: 'form.delete.success',
|
|
10
|
-
RESTORE_SUCCESS: 'form.restore.success',
|
|
11
3
|
NOT_FOUND: 'form.not.found',
|
|
12
|
-
SCHEMA_SUCCESS: 'form.schema.success',
|
|
13
|
-
PUBLISH_SUCCESS: 'form.publish.success',
|
|
14
|
-
UNPUBLISH_SUCCESS: 'form.unpublish.success',
|
|
15
|
-
DUPLICATE_SUCCESS: 'form.duplicate.success',
|
|
16
4
|
NOT_PUBLIC: 'form.not.public',
|
|
17
5
|
AUTH_REQUIRED: 'form.auth.required',
|
|
18
6
|
ACCESS_DENIED: 'form.access.denied',
|
|
19
7
|
INVALID_ACCESS_TYPE: 'form.invalid.access.type',
|
|
20
|
-
PERMISSION_CHECK_FAILED: 'form.permission.check.failed'
|
|
8
|
+
PERMISSION_CHECK_FAILED: 'form.permission.check.failed',
|
|
9
|
+
GET_SUCCESS: 'form.get.success',
|
|
10
|
+
GET_ACCESS_INFO_SUCCESS: 'form.get.access.info.success'
|
|
21
11
|
};
|
|
22
12
|
export const FORM_RESULT_MESSAGES = {
|
|
23
|
-
CREATE_SUCCESS: 'form.result.create.success',
|
|
24
|
-
CREATE_MANY_SUCCESS: 'form.result.create.many.success',
|
|
25
|
-
GET_SUCCESS: 'form.result.get.success',
|
|
26
13
|
GET_ALL_SUCCESS: 'form.result.get.all.success',
|
|
27
|
-
UPDATE_SUCCESS: 'form.result.update.success',
|
|
28
|
-
UPDATE_MANY_SUCCESS: 'form.result.update.many.success',
|
|
29
|
-
DELETE_SUCCESS: 'form.result.delete.success',
|
|
30
|
-
RESTORE_SUCCESS: 'form.result.restore.success',
|
|
31
14
|
NOT_FOUND: 'form.result.not.found',
|
|
32
|
-
SUBMIT_SUCCESS: 'form.result.submit.success',
|
|
33
|
-
EXPORT_SUCCESS: 'form.result.export.success',
|
|
34
|
-
STATS_SUCCESS: 'form.result.stats.success',
|
|
35
15
|
HAS_SUBMITTED_SUCCESS: 'form.result.has.submitted.success',
|
|
36
|
-
HAS_NOT_SUBMITTED_SUCCESS: 'form.result.has.not.submitted.success'
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
FORM: FORM_MESSAGES,
|
|
41
|
-
FORM_RESULT: FORM_RESULT_MESSAGES
|
|
16
|
+
HAS_NOT_SUBMITTED_SUCCESS: 'form.result.has.not.submitted.success',
|
|
17
|
+
SUBMIT_SUCCESS: 'form.result.submit.success',
|
|
18
|
+
DRAFT_GET_SUCCESS: 'form.result.draft.get.success',
|
|
19
|
+
DRAFT_UPDATE_SUCCESS: 'form.result.draft.update.success'
|
|
42
20
|
};
|