@flusys/nestjs-form-builder 4.1.0 → 5.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.
@@ -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
- return this.formService.getFormAccessInfo(id);
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
- * Get public form for submission (no authentication required)
101
- * Only works for forms with accessType = 'public'
102
- */ async getPublicForm(id) {
103
- return this.formService.getPublicForm(id);
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
- * Get form for authenticated submission
107
- * Works for 'authenticated' and 'action_group' access types
108
- */ async getAuthenticatedForm(id, user) {
109
- return this.formService.getAuthenticatedForm(id, user);
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
- * Get form by slug
113
- */ async getBySlug(slug, _user) {
114
- return this.formService.getBySlug(slug);
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
- * Get public form by slug (no authentication required)
118
- */ async getPublicFormBySlug(slug) {
119
- return this.formService.getPublicFormBySlug(slug);
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), _define_property(this, "metadata", 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);
@@ -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), _define_property(this, "metadata", 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), _define_property(this, "metadata", 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([
@@ -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'
@@ -35,7 +35,7 @@ function _ts_metadata(k, v) {
35
35
  }
36
36
  let Form = class Form extends _entities.Identity {
37
37
  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), _define_property(this, "metadata", void 0);
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
39
  }
40
40
  };
41
41
  _ts_decorate([
@@ -89,7 +89,7 @@ _ts_decorate([
89
89
  ], Form.prototype, "accessType", void 0);
90
90
  _ts_decorate([
91
91
  (0, _typeorm.Column)({
92
- type: 'simple-array',
92
+ type: 'json',
93
93
  nullable: true,
94
94
  name: 'action_groups'
95
95
  }),
@@ -104,12 +104,6 @@ _ts_decorate([
104
104
  }),
105
105
  _ts_metadata("design:type", Boolean)
106
106
  ], 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
107
  Form = _ts_decorate([
114
108
  (0, _typeorm.Entity)({
115
109
  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,
@@ -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
- export declare const FORM_BUILDER_MODULE_MESSAGES: {
38
- readonly FORM: {
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<import("@flusys/nestjs-shared").SingleResponseDto<FormResponseDto>>;
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<import("@flusys/nestjs-shared").SingleResponseDto<FormResponseDto>>;
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<import("@flusys/nestjs-shared").SingleResponseDto<FormResponseDto>>;
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<import("@flusys/nestjs-shared").SingleResponseDto<FormResponseDto>>;
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 {};
@@ -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 {
@@ -7,5 +7,4 @@ export declare class FormResult extends Identity {
7
7
  submittedById: string | null;
8
8
  submittedAt: Date;
9
9
  isDraft: boolean;
10
- metadata: Record<string, unknown> | null;
11
10
  }
@@ -9,5 +9,4 @@ export declare class Form extends Identity {
9
9
  accessType: FormAccessType;
10
10
  actionGroups: string[] | null;
11
11
  isActive: boolean;
12
- metadata: Record<string, unknown> | null;
13
12
  }
@@ -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
- // Aggregated export for backward compatibility
39
- export const FORM_BUILDER_MODULE_MESSAGES = {
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
  };
@@ -26,16 +26,16 @@ function _ts_param(paramIndex, decorator) {
26
26
  };
27
27
  }
28
28
  import { createApiController, FORM_RESULT_PERMISSIONS } from '@flusys/nestjs-shared/classes';
29
- import { FORM_RESULT_MESSAGES } from '../config';
30
29
  import { CurrentUser, Public, RequirePermission } from '@flusys/nestjs-shared/decorators';
31
30
  import { JwtAuthGuard } from '@flusys/nestjs-shared/guards';
32
31
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
33
32
  import { Body, Controller, HttpCode, HttpStatus, Inject, Post, UseGuards } from '@nestjs/common';
34
33
  import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
34
+ import { FORM_RESULT_MESSAGES } from '../config';
35
35
  import { CreateFormResultDto, FormResultResponseDto, GetMyDraftDto, GetResultsByFormDto, SubmitFormDto, UpdateDraftDto, UpdateFormResultDto } from '../dtos';
36
36
  import { FormResultService } from '../services/form-result.service';
37
37
  export class FormResultController extends createApiController(CreateFormResultDto, UpdateFormResultDto, FormResultResponseDto, {
38
- entityName: 'formResult',
38
+ entityName: 'form.result',
39
39
  security: {
40
40
  insert: {
41
41
  level: 'permission',
@@ -85,24 +85,41 @@ export class FormResultController extends createApiController(CreateFormResultDt
85
85
  /**
86
86
  * Submit form with authentication
87
87
  */ async submitForm(dto, user) {
88
- return this.formResultService.submitForm(dto, user, false);
88
+ const data = await this.formResultService.submitForm(dto, user, false);
89
+ return {
90
+ success: true,
91
+ message: 'Form submitted successfully',
92
+ messageKey: FORM_RESULT_MESSAGES.SUBMIT_SUCCESS,
93
+ data
94
+ };
89
95
  }
90
- /**
91
- * Submit public form (no authentication required)
92
- * Only works for forms with accessType = 'public'
93
- */ async submitPublicForm(dto) {
94
- return this.formResultService.submitForm(dto, null, true);
96
+ async submitPublicForm(dto) {
97
+ const data = await this.formResultService.submitForm(dto, null, true);
98
+ return {
99
+ success: true,
100
+ message: 'Form submitted successfully',
101
+ messageKey: FORM_RESULT_MESSAGES.SUBMIT_SUCCESS,
102
+ data
103
+ };
95
104
  }
96
105
  // Draft Endpoints
97
- /**
98
- * Get current user's draft for a form
99
- */ async getMyDraft(dto, user) {
100
- return this.formResultService.getMyDraft(dto.formId, user);
106
+ async getMyDraft(dto, user) {
107
+ const data = await this.formResultService.getMyDraft(dto.formId, user);
108
+ return {
109
+ success: true,
110
+ message: 'Draft retrieved',
111
+ messageKey: FORM_RESULT_MESSAGES.DRAFT_GET_SUCCESS,
112
+ data
113
+ };
101
114
  }
102
- /**
103
- * Update existing draft or convert to final submission
104
- */ async updateDraft(dto, user) {
105
- return this.formResultService.updateDraft(dto.draftId, dto, user);
115
+ async updateDraft(dto, user) {
116
+ const data = await this.formResultService.updateDraft(dto.draftId, dto, user);
117
+ return {
118
+ success: true,
119
+ message: 'Draft updated successfully',
120
+ messageKey: FORM_RESULT_MESSAGES.DRAFT_UPDATE_SUCCESS,
121
+ data
122
+ };
106
123
  }
107
124
  // Query Endpoints
108
125
  /**