@solidstarters/solid-code-builder 1.0.12 → 1.0.14

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.
Files changed (173) hide show
  1. package/dist/code-builder/lib/field/FieldManager.d.ts +1 -1
  2. package/dist/code-builder/lib/field/FieldManager.js +20 -21
  3. package/dist/code-builder/lib/field/FieldManager.js.map +1 -1
  4. package/dist/code-builder/lib/field/decorator-managers/entity/IndexDecoratorManager.d.ts +3 -0
  5. package/dist/code-builder/lib/field/decorator-managers/entity/IndexDecoratorManager.js +38 -3
  6. package/dist/code-builder/lib/field/decorator-managers/entity/IndexDecoratorManager.js.map +1 -1
  7. package/dist/code-builder/lib/field/decorator-managers/entity/JoinColumnDecoratorManager.d.ts +1 -1
  8. package/dist/code-builder/lib/field/decorator-managers/entity/JoinColumnDecoratorManager.js +4 -4
  9. package/dist/code-builder/lib/field/decorator-managers/entity/JoinColumnDecoratorManager.js.map +1 -1
  10. package/dist/code-builder/lib/field/decorator-managers/entity/ManyToOneDecoratorManager.d.ts +1 -1
  11. package/dist/code-builder/lib/field/decorator-managers/entity/ManyToOneDecoratorManager.js +2 -2
  12. package/dist/code-builder/lib/field/decorator-managers/entity/ManyToOneDecoratorManager.js.map +1 -1
  13. package/dist/code-builder/lib/field/decorator-managers/entity/UniqueIndexDecoratorManager.d.ts +1 -0
  14. package/dist/code-builder/lib/field/decorator-managers/entity/UniqueIndexDecoratorManager.js +3 -1
  15. package/dist/code-builder/lib/field/decorator-managers/entity/UniqueIndexDecoratorManager.js.map +1 -1
  16. package/dist/code-builder/lib/field/field-managers/base/BaseFieldManagerForDto.d.ts +6 -3
  17. package/dist/code-builder/lib/field/field-managers/base/BaseFieldManagerForDto.js +50 -15
  18. package/dist/code-builder/lib/field/field-managers/base/BaseFieldManagerForDto.js.map +1 -1
  19. package/dist/code-builder/lib/field/field-managers/base/BaseFieldManagerForEntity.d.ts +2 -1
  20. package/dist/code-builder/lib/field/field-managers/base/BaseFieldManagerForEntity.js +11 -10
  21. package/dist/code-builder/lib/field/field-managers/base/BaseFieldManagerForEntity.js.map +1 -1
  22. package/dist/code-builder/lib/field/field-managers/bigint/BigIntFieldHandler.d.ts +1 -1
  23. package/dist/code-builder/lib/field/field-managers/bigint/BigIntFieldHandler.js +2 -2
  24. package/dist/code-builder/lib/field/field-managers/bigint/BigIntFieldHandler.js.map +1 -1
  25. package/dist/code-builder/lib/field/field-managers/bigint/BigIntFieldManagerForEntity.d.ts +1 -1
  26. package/dist/code-builder/lib/field/field-managers/bigint/BigIntFieldManagerForEntity.js +2 -2
  27. package/dist/code-builder/lib/field/field-managers/bigint/BigIntFieldManagerForEntity.js.map +1 -1
  28. package/dist/code-builder/lib/field/field-managers/boolean/BooleanFieldHandler.d.ts +1 -1
  29. package/dist/code-builder/lib/field/field-managers/boolean/BooleanFieldHandler.js +2 -2
  30. package/dist/code-builder/lib/field/field-managers/boolean/BooleanFieldHandler.js.map +1 -1
  31. package/dist/code-builder/lib/field/field-managers/boolean/BooleanFieldManagerForEntity.d.ts +1 -1
  32. package/dist/code-builder/lib/field/field-managers/boolean/BooleanFieldManagerForEntity.js +2 -2
  33. package/dist/code-builder/lib/field/field-managers/boolean/BooleanFieldManagerForEntity.js.map +1 -1
  34. package/dist/code-builder/lib/field/field-managers/computed/ComputedFieldHandler.d.ts +1 -1
  35. package/dist/code-builder/lib/field/field-managers/computed/ComputedFieldHandler.js +2 -2
  36. package/dist/code-builder/lib/field/field-managers/computed/ComputedFieldHandler.js.map +1 -1
  37. package/dist/code-builder/lib/field/field-managers/computed/ComputedFieldManagerForEntity.d.ts +1 -1
  38. package/dist/code-builder/lib/field/field-managers/computed/ComputedFieldManagerForEntity.js +2 -2
  39. package/dist/code-builder/lib/field/field-managers/computed/ComputedFieldManagerForEntity.js.map +1 -1
  40. package/dist/code-builder/lib/field/field-managers/date/DateFieldHandler.d.ts +1 -1
  41. package/dist/code-builder/lib/field/field-managers/date/DateFieldHandler.js +2 -2
  42. package/dist/code-builder/lib/field/field-managers/date/DateFieldHandler.js.map +1 -1
  43. package/dist/code-builder/lib/field/field-managers/date/DateFieldManagerForEntity.d.ts +1 -1
  44. package/dist/code-builder/lib/field/field-managers/date/DateFieldManagerForEntity.js +2 -2
  45. package/dist/code-builder/lib/field/field-managers/date/DateFieldManagerForEntity.js.map +1 -1
  46. package/dist/code-builder/lib/field/field-managers/decimal/DecimalFieldHandler.d.ts +1 -1
  47. package/dist/code-builder/lib/field/field-managers/decimal/DecimalFieldHandler.js +2 -2
  48. package/dist/code-builder/lib/field/field-managers/decimal/DecimalFieldHandler.js.map +1 -1
  49. package/dist/code-builder/lib/field/field-managers/decimal/DecimalFieldManagerForEntity.d.ts +1 -1
  50. package/dist/code-builder/lib/field/field-managers/decimal/DecimalFieldManagerForEntity.js +2 -2
  51. package/dist/code-builder/lib/field/field-managers/decimal/DecimalFieldManagerForEntity.js.map +1 -1
  52. package/dist/code-builder/lib/field/field-managers/email/EmailFieldHandler.d.ts +1 -1
  53. package/dist/code-builder/lib/field/field-managers/email/EmailFieldHandler.js +2 -2
  54. package/dist/code-builder/lib/field/field-managers/email/EmailFieldHandler.js.map +1 -1
  55. package/dist/code-builder/lib/field/field-managers/email/EmailFieldManagerForEntity.d.ts +1 -1
  56. package/dist/code-builder/lib/field/field-managers/email/EmailFieldManagerForEntity.js +2 -2
  57. package/dist/code-builder/lib/field/field-managers/email/EmailFieldManagerForEntity.js.map +1 -1
  58. package/dist/code-builder/lib/field/field-managers/int/IntFieldHandler.d.ts +1 -1
  59. package/dist/code-builder/lib/field/field-managers/int/IntFieldHandler.js +2 -2
  60. package/dist/code-builder/lib/field/field-managers/int/IntFieldHandler.js.map +1 -1
  61. package/dist/code-builder/lib/field/field-managers/int/IntFieldManagerForEntity.d.ts +1 -1
  62. package/dist/code-builder/lib/field/field-managers/int/IntFieldManagerForEntity.js +2 -2
  63. package/dist/code-builder/lib/field/field-managers/int/IntFieldManagerForEntity.js.map +1 -1
  64. package/dist/code-builder/lib/field/field-managers/json/JsonFieldHandler.d.ts +1 -1
  65. package/dist/code-builder/lib/field/field-managers/json/JsonFieldHandler.js +2 -2
  66. package/dist/code-builder/lib/field/field-managers/json/JsonFieldHandler.js.map +1 -1
  67. package/dist/code-builder/lib/field/field-managers/json/JsonFieldManagerForEntity.d.ts +1 -1
  68. package/dist/code-builder/lib/field/field-managers/json/JsonFieldManagerForEntity.js +2 -2
  69. package/dist/code-builder/lib/field/field-managers/json/JsonFieldManagerForEntity.js.map +1 -1
  70. package/dist/code-builder/lib/field/field-managers/long-text/LongTextFieldHandler.d.ts +1 -1
  71. package/dist/code-builder/lib/field/field-managers/long-text/LongTextFieldHandler.js +2 -2
  72. package/dist/code-builder/lib/field/field-managers/long-text/LongTextFieldHandler.js.map +1 -1
  73. package/dist/code-builder/lib/field/field-managers/long-text/LongTextFieldManagerForEntity.d.ts +1 -1
  74. package/dist/code-builder/lib/field/field-managers/long-text/LongTextFieldManagerForEntity.js +2 -2
  75. package/dist/code-builder/lib/field/field-managers/long-text/LongTextFieldManagerForEntity.js.map +1 -1
  76. package/dist/code-builder/lib/field/field-managers/password/PasswordFieldHandler.d.ts +1 -1
  77. package/dist/code-builder/lib/field/field-managers/password/PasswordFieldHandler.js +2 -2
  78. package/dist/code-builder/lib/field/field-managers/password/PasswordFieldHandler.js.map +1 -1
  79. package/dist/code-builder/lib/field/field-managers/password/PasswordFieldManagerForEntity.d.ts +1 -1
  80. package/dist/code-builder/lib/field/field-managers/password/PasswordFieldManagerForEntity.js +2 -2
  81. package/dist/code-builder/lib/field/field-managers/password/PasswordFieldManagerForEntity.js.map +1 -1
  82. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyInverseRelationFieldHandler.d.ts +1 -1
  83. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyInverseRelationFieldHandler.js +2 -2
  84. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyInverseRelationFieldHandler.js.map +1 -1
  85. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldHandler.d.ts +1 -1
  86. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldHandler.js +2 -2
  87. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldHandler.js.map +1 -1
  88. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForDto.js +14 -9
  89. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForDto.js.map +1 -1
  90. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForEntity.js +5 -5
  91. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForEntity.js.map +1 -1
  92. package/dist/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldHandler.d.ts +1 -1
  93. package/dist/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldHandler.js +2 -2
  94. package/dist/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldHandler.js.map +1 -1
  95. package/dist/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldManagerForDto.js +3 -0
  96. package/dist/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldManagerForDto.js.map +1 -1
  97. package/dist/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldManagerForEntity.js +6 -6
  98. package/dist/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldManagerForEntity.js.map +1 -1
  99. package/dist/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldHandler.d.ts +1 -1
  100. package/dist/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldHandler.js +2 -2
  101. package/dist/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldHandler.js.map +1 -1
  102. package/dist/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldManagerForDto.js +7 -2
  103. package/dist/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldManagerForDto.js.map +1 -1
  104. package/dist/code-builder/lib/field/field-managers/rich-text/RichTextFieldHandler.d.ts +1 -1
  105. package/dist/code-builder/lib/field/field-managers/rich-text/RichTextFieldHandler.js +2 -2
  106. package/dist/code-builder/lib/field/field-managers/rich-text/RichTextFieldHandler.js.map +1 -1
  107. package/dist/code-builder/lib/field/field-managers/rich-text/RichTextFieldManagerForEntity.d.ts +1 -1
  108. package/dist/code-builder/lib/field/field-managers/rich-text/RichTextFieldManagerForEntity.js +2 -2
  109. package/dist/code-builder/lib/field/field-managers/rich-text/RichTextFieldManagerForEntity.js.map +1 -1
  110. package/dist/code-builder/lib/field/field-managers/short-text/ShortTextFieldHandler.d.ts +1 -1
  111. package/dist/code-builder/lib/field/field-managers/short-text/ShortTextFieldHandler.js +2 -2
  112. package/dist/code-builder/lib/field/field-managers/short-text/ShortTextFieldHandler.js.map +1 -1
  113. package/dist/code-builder/lib/field/field-managers/short-text/ShortTextFieldManagerForEntity.d.ts +1 -1
  114. package/dist/code-builder/lib/field/field-managers/short-text/ShortTextFieldManagerForEntity.js +2 -2
  115. package/dist/code-builder/lib/field/field-managers/short-text/ShortTextFieldManagerForEntity.js.map +1 -1
  116. package/dist/code-builder/lib/field/field-managers/uuid/UUIDFieldHandler.d.ts +1 -1
  117. package/dist/code-builder/lib/field/field-managers/uuid/UUIDFieldHandler.js +2 -2
  118. package/dist/code-builder/lib/field/field-managers/uuid/UUIDFieldHandler.js.map +1 -1
  119. package/dist/code-builder/lib/field/field-managers/uuid/UUIDFieldManagerForEntity.d.ts +1 -1
  120. package/dist/code-builder/lib/field/field-managers/uuid/UUIDFieldManagerForEntity.js +2 -2
  121. package/dist/code-builder/lib/field/field-managers/uuid/UUIDFieldManagerForEntity.js.map +1 -1
  122. package/dist/code-builder/lib/model/add-model.schema.json +4 -0
  123. package/dist/code-builder/lib/model/helpers.js +3 -3
  124. package/dist/code-builder/lib/model/helpers.js.map +1 -1
  125. package/dist/code-builder/lib/model/refresh-model.schema.json +4 -0
  126. package/dist/files/generate-model/controllers/__model@dasherize__.controller.ts +6 -2
  127. package/files/generate-model/controllers/__model@dasherize__.controller.ts +6 -2
  128. package/package.json +1 -1
  129. package/src/code-builder/lib/field/FieldManager.ts +20 -20
  130. package/src/code-builder/lib/field/decorator-managers/entity/IndexDecoratorManager.ts +48 -4
  131. package/src/code-builder/lib/field/decorator-managers/entity/JoinColumnDecoratorManager.ts +5 -5
  132. package/src/code-builder/lib/field/decorator-managers/entity/ManyToOneDecoratorManager.ts +3 -3
  133. package/src/code-builder/lib/field/decorator-managers/entity/UniqueIndexDecoratorManager.ts +3 -1
  134. package/src/code-builder/lib/field/field-managers/base/BaseFieldManagerForDto.ts +74 -26
  135. package/src/code-builder/lib/field/field-managers/base/BaseFieldManagerForEntity.ts +10 -10
  136. package/src/code-builder/lib/field/field-managers/bigint/BigIntFieldHandler.ts +2 -1
  137. package/src/code-builder/lib/field/field-managers/bigint/BigIntFieldManagerForEntity.ts +2 -2
  138. package/src/code-builder/lib/field/field-managers/boolean/BooleanFieldHandler.ts +2 -1
  139. package/src/code-builder/lib/field/field-managers/boolean/BooleanFieldManagerForEntity.ts +2 -2
  140. package/src/code-builder/lib/field/field-managers/computed/ComputedFieldHandler.ts +2 -0
  141. package/src/code-builder/lib/field/field-managers/computed/ComputedFieldManagerForEntity.ts +2 -2
  142. package/src/code-builder/lib/field/field-managers/date/DateFieldHandler.ts +2 -1
  143. package/src/code-builder/lib/field/field-managers/date/DateFieldManagerForEntity.ts +2 -2
  144. package/src/code-builder/lib/field/field-managers/decimal/DecimalFieldHandler.ts +2 -1
  145. package/src/code-builder/lib/field/field-managers/decimal/DecimalFieldManagerForEntity.ts +2 -2
  146. package/src/code-builder/lib/field/field-managers/email/EmailFieldHandler.ts +2 -0
  147. package/src/code-builder/lib/field/field-managers/email/EmailFieldManagerForEntity.ts +2 -2
  148. package/src/code-builder/lib/field/field-managers/int/IntFieldHandler.ts +2 -1
  149. package/src/code-builder/lib/field/field-managers/int/IntFieldManagerForEntity.ts +2 -2
  150. package/src/code-builder/lib/field/field-managers/json/JsonFieldHandler.ts +2 -0
  151. package/src/code-builder/lib/field/field-managers/json/JsonFieldManagerForEntity.ts +2 -2
  152. package/src/code-builder/lib/field/field-managers/long-text/LongTextFieldHandler.ts +2 -0
  153. package/src/code-builder/lib/field/field-managers/long-text/LongTextFieldManagerForEntity.ts +2 -2
  154. package/src/code-builder/lib/field/field-managers/password/PasswordFieldHandler.ts +2 -0
  155. package/src/code-builder/lib/field/field-managers/password/PasswordFieldManagerForEntity.ts +2 -2
  156. package/src/code-builder/lib/field/field-managers/relation/ManyToManyInverseRelationFieldHandler.ts +2 -1
  157. package/src/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldHandler.ts +2 -1
  158. package/src/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForDto.ts +14 -9
  159. package/src/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForEntity.ts +5 -5
  160. package/src/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldHandler.ts +2 -1
  161. package/src/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldManagerForDto.ts +3 -0
  162. package/src/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldManagerForEntity.ts +6 -6
  163. package/src/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldHandler.ts +2 -1
  164. package/src/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldManagerForDto.ts +7 -2
  165. package/src/code-builder/lib/field/field-managers/rich-text/RichTextFieldHandler.ts +2 -0
  166. package/src/code-builder/lib/field/field-managers/rich-text/RichTextFieldManagerForEntity.ts +2 -2
  167. package/src/code-builder/lib/field/field-managers/short-text/ShortTextFieldHandler.ts +2 -0
  168. package/src/code-builder/lib/field/field-managers/short-text/ShortTextFieldManagerForEntity.ts +2 -2
  169. package/src/code-builder/lib/field/field-managers/uuid/UUIDFieldHandler.ts +2 -0
  170. package/src/code-builder/lib/field/field-managers/uuid/UUIDFieldManagerForEntity.ts +2 -2
  171. package/src/code-builder/lib/model/add-model.schema.json +4 -0
  172. package/src/code-builder/lib/model/helpers.ts +3 -0
  173. package/src/code-builder/lib/model/refresh-model.schema.json +4 -0
@@ -182,51 +182,51 @@ export function getFieldHandler(
182
182
  moduleName: string,
183
183
  modelName: string,
184
184
  field: any,
185
+ modelEnableSoftDelete: any,
185
186
  ): FieldHandler {
186
- // console.log('field', field);
187
187
  switch (field.type) {
188
188
  case SolidFieldType.shortText:
189
189
  case SolidFieldType.selectionStatic:
190
190
  case SolidFieldType.selectionDynamic:
191
191
  if (field.selectionValueType === "int") {
192
- return new IntFieldHandler(tree, moduleName, modelName, field);
192
+ return new IntFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
193
193
  }
194
- return new ShortTextFieldHandler(tree, moduleName, modelName, field);
194
+ return new ShortTextFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
195
195
  case SolidFieldType.longtext:
196
- return new LongTextFieldHandler(tree, moduleName, modelName, field);
196
+ return new LongTextFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
197
197
  case SolidFieldType.richText:
198
- return new RichTextFieldHandler(tree, moduleName, modelName, field);
198
+ return new RichTextFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
199
199
  case SolidFieldType.json:
200
- return new JsonFieldHandler(tree, moduleName, modelName, field);
200
+ return new JsonFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
201
201
  case SolidFieldType.int:
202
- return new IntFieldHandler(tree, moduleName, modelName, field);
202
+ return new IntFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
203
203
  case SolidFieldType.decimal:
204
- return new DecimalFieldHandler(tree, moduleName, modelName, field);
204
+ return new DecimalFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
205
205
  case SolidFieldType.bigint:
206
- return new BigIntFieldHandler(tree, moduleName, modelName, field);
206
+ return new BigIntFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
207
207
  case SolidFieldType.boolean:
208
- return new BooleanFieldHandler(tree, moduleName, modelName, field);
208
+ return new BooleanFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
209
209
  case SolidFieldType.email:
210
- return new EmailFieldHandler(tree, moduleName, modelName, field);
210
+ return new EmailFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
211
211
  case SolidFieldType.password:
212
- return new PasswordFieldHandler(tree, moduleName, modelName, field);
212
+ return new PasswordFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
213
213
  case SolidFieldType.date:
214
214
  case SolidFieldType.datetime:
215
215
  case SolidFieldType.time:
216
- return new DateFieldHandler(tree, moduleName, modelName, field);
216
+ return new DateFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
217
217
  case SolidFieldType.relation: {
218
218
  if (field.relationType === RelationType.ManyToOne) {
219
- return new ManyToOneRelationFieldHandler(tree, moduleName, modelName, field);
219
+ return new ManyToOneRelationFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
220
220
  }
221
221
  else if (field.relationType === RelationType.OneToMany) {
222
- return new OneToManyRelationFieldHandler(tree, moduleName, modelName, field);
222
+ return new OneToManyRelationFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
223
223
  }
224
224
  else if (field.relationType === RelationType.ManyToMany) {
225
225
  if (field.isRelationManyToManyOwner) {
226
- return new ManyToManyRelationFieldHandler(tree, moduleName, modelName, field);
226
+ return new ManyToManyRelationFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
227
227
  }
228
228
  else {
229
- return new ManyToManyInverseRelationFieldHandler(tree, moduleName, modelName, field);
229
+ return new ManyToManyInverseRelationFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
230
230
  }
231
231
  }
232
232
  return new NoOpsFieldHandler(tree, moduleName, modelName, field);
@@ -235,9 +235,9 @@ export function getFieldHandler(
235
235
  case SolidFieldType.mediaMultiple:
236
236
  return new NoOpsFieldHandler(tree, moduleName, modelName, field);
237
237
  case SolidFieldType.uuid:
238
- return new UUIDFieldHandler(tree, moduleName, modelName, field);
238
+ return new UUIDFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
239
239
  case SolidFieldType.computed:
240
- return new ComputedFieldHandler(tree, moduleName, modelName, field);
240
+ return new ComputedFieldHandler(tree, moduleName, modelName, field, modelEnableSoftDelete);
241
241
  default:
242
242
  console.log(`Field ${field.name} of type ${field.type} not supported yet`);
243
243
  return new NoOpsFieldHandler(tree, moduleName, modelName, field);
@@ -295,7 +295,7 @@ export class ManagerForDtoOptions {
295
295
  public sourceType: DtoSourceType,
296
296
  ) {}
297
297
  }
298
- // insertImport(this.source, this.source.fileName, `Update${classify(this.field.relationModelSingularName)}Dto`, relatedEntityPath);
298
+ // insertImport(this.source, this.source.fileName, `Update${classify(this.field.relationCoModelSingularName)}Dto`, relatedEntityPath);
299
299
  export function safeInsertImport(source: ts.SourceFile, symbolName: string, importFileName: string, currentModuleName: string ): Change {
300
300
  // Check if in current source, there exists a class with the same symbolName
301
301
  if (importFileName.startsWith(`src/${SOLID_CORE_MODULE_NAME }`)) {
@@ -7,13 +7,13 @@ interface IndexDecoratorOptions {
7
7
  index: boolean;
8
8
  source: ts.SourceFile;
9
9
  field: any;
10
+ modelEnableSoftDelete?: any
10
11
  }
11
12
 
12
13
  export class IndexDecoratorManager implements DecoratorManager {
13
-
14
14
  constructor(public options: IndexDecoratorOptions, public fieldNode?: PropertyDeclaration) { }
15
15
  isApplyDecorator(): boolean {
16
- return this.options.index && this.options.field.relationType !== RelationType.ManyToMany && this.options.field.relationType !== RelationType.OneToMany;
16
+ return (this.options.index || (!this.options.modelEnableSoftDelete && this.options.field.unique)) && this.options.field.relationType !== RelationType.ManyToMany && this.options.field.relationType !== RelationType.OneToMany;
17
17
  }
18
18
  decoratorName(): string {
19
19
  return 'Index';
@@ -25,7 +25,8 @@ export class IndexDecoratorManager implements DecoratorManager {
25
25
  const fieldSourceLines = [];
26
26
  const changes: Change[] = [];
27
27
  // if (this.field.index) {
28
- const indexDecoratorLine = `@Index()`;
28
+ const indexOptions = this.buildColumnOptionsCode();
29
+ const indexDecoratorLine = indexOptions ? `@Index(${indexOptions})` : `@Index()`;
29
30
  fieldSourceLines.push(indexDecoratorLine);
30
31
  changes.push(...this.decoratorImports());
31
32
  // }
@@ -78,11 +79,23 @@ export class IndexDecoratorManager implements DecoratorManager {
78
79
  }
79
80
 
80
81
  private createIndexDecorator(): ts.ModifierLike {
82
+ const indexArguments: ts.Expression[] = [];
83
+ if ((this.options.modelEnableSoftDelete === undefined || this.options.modelEnableSoftDelete === false)
84
+ && this.options.field.unique) {
85
+ indexArguments.push(
86
+ ts.factory.createObjectLiteralExpression([
87
+ ts.factory.createPropertyAssignment(
88
+ 'unique',
89
+ ts.factory.createTrue()
90
+ )
91
+ ])
92
+ );
93
+ }
81
94
  return ts.factory.createDecorator(
82
95
  ts.factory.createCallExpression(
83
96
  ts.factory.createIdentifier('Index'),
84
97
  undefined,
85
- [],
98
+ indexArguments
86
99
  ),
87
100
  );
88
101
  }
@@ -101,5 +114,36 @@ export class IndexDecoratorManager implements DecoratorManager {
101
114
  return identifier.text === identifierName;
102
115
  }
103
116
 
117
+ private buildColumnDecoratorOptions(): Map<string, any> {
118
+ const options: Map<string, any> = new Map<string, any>();
119
+
120
+ if ((this.options.modelEnableSoftDelete === undefined || this.options.modelEnableSoftDelete === false)
121
+ && this.options.field.unique) {
122
+ options.set('unique', true);
123
+ }
124
+
125
+ return options;
126
+ }
104
127
 
128
+ private buildColumnOptionsCode(): string {
129
+ const options = this.buildColumnDecoratorOptions();
130
+ const keys = Array.from(options.keys());
131
+
132
+ if (keys.length === 0) {
133
+ return '';
134
+ }
135
+
136
+ const optionsString = keys
137
+ .filter((key) => options.get(key) !== null)
138
+ .map((key) => {
139
+ if (typeof options.get(key) === 'string') {
140
+ return `${key}: "${options.get(key)}"`;
141
+ } else {
142
+ return `${key}: ${options.get(key)}`;
143
+ }
144
+ })
145
+ .join(', ');
146
+
147
+ return `{ ${optionsString} }`;
148
+ }
105
149
  }
@@ -8,7 +8,7 @@ interface JoinColumnDecoratorOptions {
8
8
  source: ts.SourceFile;
9
9
  field: any;
10
10
  fieldName: string;
11
- relationModelFieldName?: string;
11
+ relationCoModelColumnName?: string;
12
12
  }
13
13
 
14
14
  export class JoinColumnDecoratorManager implements DecoratorManager {
@@ -88,8 +88,8 @@ export class JoinColumnDecoratorManager implements DecoratorManager {
88
88
  private buildRelationOptionsCode(): string {
89
89
  const options: Record<string, string> = {};
90
90
 
91
- if (this.options.relationModelFieldName) {
92
- options['name'] = `"${this.options.relationModelFieldName}_id"`;
91
+ if (this.options.relationCoModelColumnName) {
92
+ options['name'] = `"${this.options.relationCoModelColumnName}"`;
93
93
  return `{ ${Object.entries(options)
94
94
  .map(([key, value]) => `${key}: ${value}`)
95
95
  .join(', ')} }`;
@@ -102,11 +102,11 @@ export class JoinColumnDecoratorManager implements DecoratorManager {
102
102
 
103
103
  const newOptions: ts.ObjectLiteralElementLike[] = [];
104
104
 
105
- if (this.options.relationModelFieldName) {
105
+ if (this.options.relationCoModelColumnName) {
106
106
  newOptions.push(
107
107
  ts.factory.createPropertyAssignment(
108
108
  'name',
109
- ts.factory.createStringLiteral(`${this.options.relationModelFieldName}_id`)
109
+ ts.factory.createStringLiteral(`${this.options.relationCoModelColumnName}`)
110
110
  )
111
111
  );
112
112
  }
@@ -6,7 +6,7 @@ import { DecoratorManager, DeleteType, PartialAddFieldChange } from "../../Field
6
6
  import _ from 'lodash';
7
7
  interface ManyToOneDecoratorOptions {
8
8
  isManyToOne: boolean;
9
- relationModelSingularName: string;
9
+ relationCoModelSingularName: string;
10
10
  relationCascade: DeleteType;
11
11
  required: boolean;
12
12
  source: ts.SourceFile;
@@ -37,7 +37,7 @@ export class ManyToOneDecoratorManager implements DecoratorManager {
37
37
  // }
38
38
  // Add the relation decorator
39
39
  fieldSourceLines.push(
40
- `@${this.decoratorName()}(() => ${classify(this.options.relationModelSingularName)}, ${this.buildRelationOptionsCode()})`,
40
+ `@${this.decoratorName()}(() => ${classify(this.options.relationCoModelSingularName)}, ${this.buildRelationOptionsCode()})`,
41
41
  );
42
42
  changes.push(...this.decoratorImports());
43
43
  return {
@@ -148,7 +148,7 @@ export class ManyToOneDecoratorManager implements DecoratorManager {
148
148
  [],
149
149
  undefined,
150
150
  ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),
151
- ts.factory.createIdentifier(classify(this.options.relationModelSingularName))
151
+ ts.factory.createIdentifier(classify(this.options.relationCoModelSingularName))
152
152
  )
153
153
  const decoratorOptionsExpression = ts.factory.createObjectLiteralExpression(newPropertyAssignments);
154
154
  const call = ts.factory.createCallExpression(decoratorIdentifier, undefined, [typeFunctionOrTarget, decoratorOptionsExpression]);
@@ -8,12 +8,13 @@ interface UniqueIndexDecoratorOptions {
8
8
  fieldName: string;
9
9
  source: ts.SourceFile;
10
10
  field: any;
11
+ modelEnableSoftDelete?: any;
11
12
  }
12
13
 
13
14
  export class UniqueIndexDecoratorManager {
14
15
  constructor(public options: UniqueIndexDecoratorOptions, public classNode: ClassDeclaration, public fieldNode?: PropertyDeclaration) { }
15
16
  isApplyDecorator(): boolean {
16
- return this.options.unique;
17
+ return this.options.unique && this.options.modelEnableSoftDelete;
17
18
  }
18
19
  decoratorName(): string {
19
20
  return 'Index';
@@ -47,6 +48,7 @@ export class UniqueIndexDecoratorManager {
47
48
  // @returns the updated property declaration
48
49
  updateDecorator(): [ClassDeclaration, Change[]] {
49
50
  if (!this.classNode) throw new Error('Class node is required for updating the unique index decorator');
51
+ if (!this.fieldNode) throw new Error('Field node is required for updating the unique index decorator');
50
52
 
51
53
  let existingModifierLikes: ts.NodeArray<ModifierLike> | undefined = this.classNode.modifiers;
52
54
 
@@ -1,6 +1,7 @@
1
1
  import { classify, dasherize } from '@angular-devkit/core/src/utils/strings';
2
2
  import { Tree } from '@angular-devkit/schematics';
3
3
  import ts, {
4
+ ClassDeclaration,
4
5
  PropertyDeclaration,
5
6
  SourceFile,
6
7
  } from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
@@ -48,6 +49,7 @@ import { ApiPropertyDecoratorManager } from '../../decorator-managers/dto/ApiPro
48
49
  // The validation decorators added use the class-validator library
49
50
  export abstract class BaseFieldManagerForDto implements FieldManager {
50
51
  source: SourceFile;
52
+ updatedSourceClassNode?: ts.ClassDeclaration;
51
53
  decoratorManagers: DecoratorManager[];
52
54
 
53
55
  constructor(
@@ -137,7 +139,7 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
137
139
  protected addFieldInternal(fieldName: string, fieldType: string, decoratorManagers: DecoratorManager[], field: any, modelName: any, source: ts.SourceFile): FieldChange {
138
140
  //FIXME There might a case where the main field is not present, but additional field is present. Do we update the fields or throw an error. Needs to be discussed
139
141
  // For now, we assume, that if primary field is not present, then additional field is also not present
140
- if (this.isFieldPresent(fieldName, source)) {
142
+ if (this.isFieldPresent(fieldName, source)) {
141
143
  return {
142
144
  filePath: source.fileName,
143
145
  field: field,
@@ -166,14 +168,8 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
166
168
  fieldSourceLines.push(...builderChange.fieldSourceLines);
167
169
  });
168
170
 
169
- // Create the field definition changes
170
- // const classNode = findNodes(source, ts.SyntaxKind.ClassDeclaration)[0];
171
- const className = (this.options.sourceType === DtoSourceType.Create) ? `Create${classify(modelName)}Dto` : `Update${classify(modelName)}Dto`;
172
- const classNode = getClassNode(className,source);
173
- if (!classNode) {
174
- throw new Error(`Class ${className} not found in file ${source.fileName}`);
175
- }
176
-
171
+ const classNode = this.getClassNode(modelName, this.options, source);
172
+
177
173
  const fieldDefinition = `\n${fieldSourceLines.reverse().join('\n')}\n`;
178
174
  changes.push(
179
175
  new InsertChange(
@@ -208,9 +204,9 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
208
204
 
209
205
  const fieldName = this.fieldName();
210
206
  const fieldType = this.fieldType().text;
211
- const source= this.source
207
+ const source = this.source
212
208
  const field = this.field
213
- const modelName = this.modelName
209
+ const modelName = this.modelName
214
210
  const decoratorManagers = this.decoratorManagers;
215
211
 
216
212
  fieldChanges.push(this.addFieldInternal(fieldName, fieldType, decoratorManagers, field, modelName, source));
@@ -241,7 +237,20 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
241
237
  updatedPropertyDeclarationNode = updatedPropertyDeclarationNodeTransformed;
242
238
  changes.push(...decoratorChanges);
243
239
 
244
- changes.push(...this.calculateReplaceChanges(this.printNode(updatedPropertyDeclarationNode, source), fieldPropertyDeclarationNode, source));
240
+ // changes.push(...this.calculateReplaceChanges(this.printNode(updatedPropertyDeclarationNode, source), fieldPropertyDeclarationNode, source));
241
+
242
+ // if (!this.isAdditionalFieldRequired()) {
243
+ // Get the source class node i.e CreateDto or UpdateDto
244
+ const sourceClassNode = this.getClassNode(this.modelName, this.options, source); // FIXME Avoid this.model to avoid stateful behaviour
245
+ const classNode = this.updatedSourceClassNode ?? sourceClassNode;
246
+ // Set the updated property declaration node to the source class node
247
+ const updatedClassNode = this.updateClassNode(classNode, updatedPropertyDeclarationNode, fieldName);
248
+ this.updatedSourceClassNode = updatedClassNode; // Set the updated class node to the source class node, so it can be used for additional operations e.g for additional field updates
249
+ changes.push(...this.calculateReplaceChanges(this.printNode(updatedClassNode, source), sourceClassNode, source.fileName));
250
+ // }
251
+ // else {
252
+ // changes.push(...this.calculateReplaceChanges(this.printNode(updatedPropertyDeclarationNode, source), fieldPropertyDeclarationNode, source.fileName));
253
+ // }
245
254
 
246
255
  return {
247
256
  filePath: source.fileName,
@@ -250,6 +259,32 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
250
259
  };
251
260
  }
252
261
 
262
+ updateClassNode(sourceClassNode: ts.ClassDeclaration, updatedFieldNode: ts.PropertyDeclaration, fieldName: string): ClassDeclaration {
263
+ // Replace the class memeber matching the field name with the updated field node
264
+ const newMembers = sourceClassNode.members.map((member) => {
265
+ // Check if the member is a PropertyDeclaration
266
+ if (ts.isPropertyDeclaration(member)) {
267
+ // Compare the name of the property with the field name
268
+ const memberName = member.name.getText();
269
+ if (memberName === fieldName) {
270
+ return updatedFieldNode!;
271
+ }
272
+ }
273
+ return member;
274
+ });
275
+
276
+ // Update the class node with the new modifiers
277
+ const updatedClass = ts.factory.updateClassDeclaration(
278
+ sourceClassNode,
279
+ sourceClassNode.modifiers,
280
+ sourceClassNode.name,
281
+ sourceClassNode.typeParameters,
282
+ sourceClassNode.heritageClauses,
283
+ newMembers,
284
+ );
285
+ return updatedClass;
286
+ }
287
+
253
288
  updateField(): FieldChange[] {
254
289
  const fieldChanges: FieldChange[] = [];
255
290
 
@@ -257,7 +292,7 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
257
292
 
258
293
  const fieldName = this.fieldName();
259
294
  const fieldType = this.fieldType().node(this.field);
260
- const source= this.source
295
+ const source = this.source
261
296
  const field = this.field
262
297
  const decoratorManagers = this.decoratorManagers;
263
298
 
@@ -365,7 +400,7 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
365
400
  }
366
401
  }
367
402
  }
368
- }
403
+ }
369
404
 
370
405
  protected applyBuildDecoratorTransformations(...transformers: DecoratorManager[]): PartialAddFieldChange[] {
371
406
  const partialFieldChanges: PartialAddFieldChange[] = [];
@@ -385,24 +420,24 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
385
420
  }
386
421
  }
387
422
 
388
- protected calculateReplaceChanges(updatedPropertyDeclarationNodeText: string, fieldPropertyDeclarationNode: ts.PropertyDeclaration, source: ts.SourceFile): Change[] {
423
+ protected calculateReplaceChanges(updatedSourceNodeText: string, sourceNode:ts.Node, sourceFileName: string): Change[] {
389
424
  const changes: Change[] = [];
390
- if (updatedPropertyDeclarationNodeText.trim() !==
391
- fieldPropertyDeclarationNode.getFullText().trim()) {
392
- console.log(`Updated Code:\n${updatedPropertyDeclarationNodeText.trim()}\nwith length ${updatedPropertyDeclarationNodeText.trim().length}\n`);
393
- console.log(`Old Code:\n${fieldPropertyDeclarationNode.getFullText().trim()}\nwith length ${fieldPropertyDeclarationNode.getFullText().trim().length}\n`);
425
+ if (updatedSourceNodeText.trim() !==
426
+ sourceNode.getFullText().trim()) {
427
+ console.log(`Updated Code:\n${updatedSourceNodeText.trim()}\nwith length ${updatedSourceNodeText.trim().length}\n`);
428
+ console.log(`Old Code:\n${sourceNode.getFullText().trim()}\nwith length ${sourceNode.getFullText().trim().length}\n`);
394
429
  const replaceChange = new ReplaceChangeSSS(
395
- source.fileName,
396
- fieldPropertyDeclarationNode.pos,
397
- fieldPropertyDeclarationNode.getFullText(),
398
- `\n\n${updatedPropertyDeclarationNodeText}`
430
+ sourceFileName,
431
+ sourceNode.pos,
432
+ sourceNode.getFullText(),
433
+ `\n\n${updatedSourceNodeText}`
399
434
  );
400
435
  changes.push(replaceChange);
401
436
  }
402
437
  return changes;
403
438
  }
404
439
 
405
- protected printNode(updatedPropertyDeclarationNode: ts.PropertyDeclaration, nodeSource: SourceFile): string {
440
+ protected printNode(updatedPropertyDeclarationNode: ts.Node, nodeSource: SourceFile): string {
406
441
  const printer = ts.createPrinter({
407
442
  newLine: ts.NewLineKind.LineFeed,
408
443
  removeComments: false,
@@ -432,7 +467,7 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
432
467
  case DecoratorType.MinLength:
433
468
  return new MinLengthDecoratorManager({ isApplyMinLength: this.isApplyMinLength(), length: field.min, source: source, field: field });
434
469
  case DecoratorType.MaxLength:
435
- return new MaxLengthDecoratorManager({ isApplyMaxLength: this.isApplyMaxLength(), length: field.max, source: source, field: field });
470
+ return new MaxLengthDecoratorManager({ isApplyMaxLength: this.isApplyMaxLength(), length: field.max, source: source, field: field });
436
471
  case DecoratorType.Required:
437
472
  return new RequiredDecoratorManager({ isApplyRequired: true, required: field.required, source: source, field: field });
438
473
  case DecoratorType.Optional:
@@ -447,7 +482,7 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
447
482
  return new IntDecoratorManager({ isInt: this.isInt(), source: source, field: field });
448
483
  case DecoratorType.Decimal:
449
484
  return new DecimalDecoratorManager({ isDecimal: this.isDecimal(), source: source, field: field });
450
- case DecoratorType.BigInt:
485
+ case DecoratorType.BigInt:
451
486
  return new BigIntDecoratorManager({ isBigInt: this.isBigInt(), source: source, field: field });
452
487
  case DecoratorType.Date:
453
488
  return new DateDecoratorManager({ isDate: this.isDate(), source: source, field: field });
@@ -482,4 +517,17 @@ export abstract class BaseFieldManagerForDto implements FieldManager {
482
517
  }
483
518
  }
484
519
 
520
+ private getClassNode(modelName: any, options: ManagerForDtoOptions, source: ts.SourceFile) {
521
+ // if (this.updatedSourceClassNode) {
522
+ // return this.updatedSourceClassNode;
523
+ // }
524
+ const classifiedModelName = classify(modelName);
525
+ const sourceClassName = (options.sourceType === DtoSourceType.Create) ? `Create${classifiedModelName}Dto` : `Update${classifiedModelName}Dto`;
526
+ const classNode = getClassNode(sourceClassName, source);
527
+ if (!classNode) {
528
+ throw new Error(`Class ${sourceClassName} not found in file ${source.fileName}`);
529
+ }
530
+ return classNode;
531
+ }
532
+
485
533
  }
@@ -45,6 +45,7 @@ export abstract class BaseFieldManagerForEntity implements FieldManager {
45
45
  protected readonly moduleName: string,
46
46
  protected readonly modelName: string,
47
47
  protected readonly field: any,
48
+ protected readonly modelEnableSoftDelete?: any
48
49
  ) {
49
50
  // TODO: Note that the source file instance is created during construction
50
51
  // So every operation should use a new instance of the field manager, so updated tree/source is used before each operation
@@ -52,14 +53,13 @@ export abstract class BaseFieldManagerForEntity implements FieldManager {
52
53
  tree,
53
54
  `src/${dasherize(moduleName)}/entities/${dasherize(modelName)}.entity.ts`,
54
55
  );
55
-
56
56
  const fieldPropertyDeclarationNode = this.getFieldIdentifierNode(
57
57
  this.fieldName(),
58
58
  this.source
59
59
  )?.parent as PropertyDeclaration | undefined;
60
60
 
61
61
  this.indexDecoratorManager = new IndexDecoratorManager(
62
- { index: this.field.index, source: this.source, field: this.field },
62
+ { index: this.field.index, source: this.source, field: this.field, modelEnableSoftDelete: this.modelEnableSoftDelete },
63
63
  fieldPropertyDeclarationNode,
64
64
  );
65
65
  this.columnDecoratorManager = new ColumnDecoratorManager(
@@ -78,7 +78,7 @@ export abstract class BaseFieldManagerForEntity implements FieldManager {
78
78
  this.manyToOneDecoratorManager = new ManyToOneDecoratorManager(
79
79
  {
80
80
  isManyToOne: this.isManyToOne(),
81
- relationModelSingularName: this.field.relationModelSingularName,
81
+ relationCoModelSingularName: this.field.relationCoModelSingularName,
82
82
  relationCascade: this.field.relationCascade,
83
83
  required: this.field.required,
84
84
  source: this.source,
@@ -94,14 +94,14 @@ export abstract class BaseFieldManagerForEntity implements FieldManager {
94
94
  source: this.source,
95
95
  field: this.field,
96
96
  fieldName: this.fieldName(),
97
- relationModelFieldName: this.field.relationModelFieldName
97
+ relationCoModelColumnName: this.field.relationCoModelColumnName
98
98
  },
99
99
  );
100
100
  this.manyToManyDecoratorManager = new ManyToManyDecoratorManager(
101
101
  {
102
102
  isManyToMany: this.isManyToMany(),
103
- relationModelName: this.field.relationModelSingularName,
104
- relationInverseFieldName: this.field.relationModelFieldName,
103
+ relationModelName: this.field.relationCoModelSingularName,
104
+ relationInverseFieldName: this.field.relationCoModelFieldName,
105
105
  relationCascade: this.field.relationCascade,
106
106
  owner: this.field.isRelationManyToManyOwner,
107
107
  source: this.source,
@@ -118,12 +118,12 @@ export abstract class BaseFieldManagerForEntity implements FieldManager {
118
118
  fieldName: this.fieldName(),
119
119
  modelName: this.modelName,
120
120
  relationJoinTableName: this.field.relationJoinTableName,
121
- relationJoinColumnName: this.field.relationJoinColumnName,
122
- joinColumnName: this. field.joinColumnName
121
+ relationJoinColumnName: this.field.relationCoModelColumnName,
122
+ joinColumnName: this.field.columnName
123
123
  },
124
124
  );
125
125
  this.uniqueIndexDecoratorManager = new UniqueIndexDecoratorManager(
126
- { unique: this.field.unique, fieldName: this.fieldName(), source: this.source, field: this.field },
126
+ { unique: this.field.unique, fieldName: this.fieldName(), source: this.source, field: this.field, modelEnableSoftDelete: this.modelEnableSoftDelete},
127
127
  this.getClassNode(this.modelName, this.source)
128
128
  );
129
129
  this.oneToManyDecoratorManager = new OneToManyDecoratorManager(
@@ -457,7 +457,7 @@ export abstract class BaseFieldManagerForEntity implements FieldManager {
457
457
  }
458
458
 
459
459
  protected inverseRelationFieldName(): string {
460
- return `${this.field.relationModelSingularName}s`;
460
+ return `${this.field.relationCoModelSingularName}s`;
461
461
  }
462
462
 
463
463
 
@@ -6,12 +6,13 @@ export class BigIntFieldHandler implements FieldHandler {
6
6
  entityFieldManager: FieldManager;
7
7
  createDtoFieldManager: FieldManager;
8
8
  updateDtoFieldManager: FieldManager;
9
- constructor(tree: any, moduleName: string, modelName: string, field: any) {
9
+ constructor(tree: any, moduleName: string, modelName: string, field: any, modelEnableSoftDelete: any) {
10
10
  this.entityFieldManager = new BigIntFieldManagerForEntity(
11
11
  tree,
12
12
  moduleName,
13
13
  modelName,
14
14
  field,
15
+ modelEnableSoftDelete
15
16
  );
16
17
  this.createDtoFieldManager = new BigIntFieldManagerForDto(
17
18
  tree,
@@ -9,8 +9,8 @@ export class BigIntFieldManagerForEntity
9
9
  {
10
10
  source: ts.SourceFile;
11
11
 
12
- constructor(tree: Tree, moduleName: string, modelName: string, field: any) {
13
- super(tree, moduleName, modelName, field);
12
+ constructor(tree: Tree, moduleName: string, modelName: string, field: any, modelEnableSoftDelete: any) {
13
+ super(tree, moduleName, modelName, field, modelEnableSoftDelete);
14
14
  }
15
15
 
16
16
  fieldType(): FieldType {
@@ -6,12 +6,13 @@ export class BooleanFieldHandler implements FieldHandler {
6
6
  entityFieldManager: FieldManager;
7
7
  createDtoFieldManager: FieldManager;
8
8
  updateDtoFieldManager: FieldManager
9
- constructor(tree: any, moduleName: string, modelName: string, field: any) {
9
+ constructor(tree: any, moduleName: string, modelName: string, field: any, modelEnableSoftDelete: any) {
10
10
  this.entityFieldManager = new BooleanFieldManagerForEntity(
11
11
  tree,
12
12
  moduleName,
13
13
  modelName,
14
14
  field,
15
+ modelEnableSoftDelete
15
16
  );
16
17
  this.createDtoFieldManager = new BooleanFieldManagerForDto(
17
18
  tree,
@@ -9,8 +9,8 @@ export class BooleanFieldManagerForEntity
9
9
  {
10
10
  source: ts.SourceFile;
11
11
 
12
- constructor(tree: Tree, moduleName: string, modelName: string, field: any) {
13
- super(tree, moduleName, modelName, field);
12
+ constructor(tree: Tree, moduleName: string, modelName: string, field: any, modelEnableSoftDelete: any) {
13
+ super(tree, moduleName, modelName, field, modelEnableSoftDelete);
14
14
  }
15
15
 
16
16
  fieldType(): FieldType {
@@ -11,12 +11,14 @@ export class ComputedFieldHandler implements FieldHandler {
11
11
  moduleName: string,
12
12
  modelName: string,
13
13
  field: string,
14
+ modelEnableSoftDelete: any
14
15
  ) {
15
16
  this.entityFieldManager = new ComputedFieldManagerForEntity(
16
17
  tree,
17
18
  moduleName,
18
19
  modelName,
19
20
  field,
21
+ modelEnableSoftDelete,
20
22
  );
21
23
  //Instantiate the entity and dto source files
22
24
  }
@@ -8,8 +8,8 @@ export class ComputedFieldManagerForEntity
8
8
  implements FieldManager {
9
9
  source: ts.SourceFile;
10
10
 
11
- constructor(tree: Tree, moduleName: string, modelName: string, field: any) {
12
- super(tree, moduleName, modelName, field);
11
+ constructor(tree: Tree, moduleName: string, modelName: string, field: any, modelEnableSoftDelete: any) {
12
+ super(tree, moduleName, modelName, field, modelEnableSoftDelete);
13
13
  }
14
14
 
15
15
  fieldType(): FieldType {
@@ -6,12 +6,13 @@ export class DateFieldHandler implements FieldHandler {
6
6
  entityFieldManager: FieldManager;
7
7
  createDtoFieldManager: FieldManager;
8
8
  updateDtoFieldManager: FieldManager;
9
- constructor(tree: any, moduleName: string, modelName: string, field: any) {
9
+ constructor(tree: any, moduleName: string, modelName: string, field: any, modelEnableSoftDelete: any) {
10
10
  this.entityFieldManager = new DateFieldManagerForEntity(
11
11
  tree,
12
12
  moduleName,
13
13
  modelName,
14
14
  field,
15
+ modelEnableSoftDelete
15
16
  );
16
17
  this.createDtoFieldManager = new DateFieldManagerForDto(
17
18
  tree,
@@ -8,8 +8,8 @@ export class DateFieldManagerForEntity
8
8
  implements FieldManager {
9
9
  source: ts.SourceFile;
10
10
 
11
- constructor(tree: Tree, moduleName: string, modelName: string, field: any) {
12
- super(tree, moduleName, modelName, field);
11
+ constructor(tree: Tree, moduleName: string, modelName: string, field: any, modelEnableSoftDelete: any) {
12
+ super(tree, moduleName, modelName, field, modelEnableSoftDelete);
13
13
  }
14
14
 
15
15
  fieldType(): FieldType {