@solidstarters/solid-core 1.2.23 → 1.2.25

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 (107) hide show
  1. package/dist/controllers/user.controller.d.ts +1 -0
  2. package/dist/controllers/user.controller.d.ts.map +1 -1
  3. package/dist/controllers/user.controller.js +14 -0
  4. package/dist/controllers/user.controller.js.map +1 -1
  5. package/dist/dtos/create-field-metadata.dto.d.ts +3 -4
  6. package/dist/dtos/create-field-metadata.dto.d.ts.map +1 -1
  7. package/dist/dtos/create-field-metadata.dto.js +9 -15
  8. package/dist/dtos/create-field-metadata.dto.js.map +1 -1
  9. package/dist/dtos/create-media.dto.d.ts +3 -0
  10. package/dist/dtos/create-media.dto.d.ts.map +1 -1
  11. package/dist/dtos/create-media.dto.js +16 -1
  12. package/dist/dtos/create-media.dto.js.map +1 -1
  13. package/dist/entities/field-metadata.entity.d.ts +3 -4
  14. package/dist/entities/field-metadata.entity.d.ts.map +1 -1
  15. package/dist/entities/field-metadata.entity.js +10 -14
  16. package/dist/entities/field-metadata.entity.js.map +1 -1
  17. package/dist/entities/media-storage-provider-metadata.entity.js +1 -1
  18. package/dist/entities/media-storage-provider-metadata.entity.js.map +1 -1
  19. package/dist/entities/media.entity.d.ts +3 -0
  20. package/dist/entities/media.entity.d.ts.map +1 -1
  21. package/dist/entities/media.entity.js +13 -1
  22. package/dist/entities/media.entity.js.map +1 -1
  23. package/dist/entities/permission-metadata.entity.js +2 -2
  24. package/dist/entities/permission-metadata.entity.js.map +1 -1
  25. package/dist/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.d.ts +2 -2
  26. package/dist/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.d.ts.map +1 -1
  27. package/dist/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.js +4 -4
  28. package/dist/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.js.map +1 -1
  29. package/dist/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.d.ts +1 -1
  30. package/dist/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.d.ts.map +1 -1
  31. package/dist/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.js +3 -3
  32. package/dist/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.js.map +1 -1
  33. package/dist/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.d.ts +2 -2
  34. package/dist/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.d.ts.map +1 -1
  35. package/dist/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.js +4 -4
  36. package/dist/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.js.map +1 -1
  37. package/dist/helpers/schematic.service.d.ts +1 -0
  38. package/dist/helpers/schematic.service.d.ts.map +1 -1
  39. package/dist/helpers/schematic.service.js +3 -0
  40. package/dist/helpers/schematic.service.js.map +1 -1
  41. package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
  42. package/dist/seeders/module-metadata-seeder.service.js +14 -2
  43. package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
  44. package/dist/seeders/seed-data/solid-core-metadata.json +95 -68
  45. package/dist/services/authentication.service.d.ts.map +1 -1
  46. package/dist/services/authentication.service.js +1 -0
  47. package/dist/services/authentication.service.js.map +1 -1
  48. package/dist/services/crud.service.js +9 -9
  49. package/dist/services/crud.service.js.map +1 -1
  50. package/dist/services/field-metadata.service.d.ts.map +1 -1
  51. package/dist/services/field-metadata.service.js +14 -21
  52. package/dist/services/field-metadata.service.js.map +1 -1
  53. package/dist/services/media.service.d.ts.map +1 -1
  54. package/dist/services/media.service.js +17 -3
  55. package/dist/services/media.service.js.map +1 -1
  56. package/dist/services/mediaStorageProviders/file-s3-storage-provider.d.ts.map +1 -1
  57. package/dist/services/mediaStorageProviders/file-s3-storage-provider.js +4 -1
  58. package/dist/services/mediaStorageProviders/file-s3-storage-provider.js.map +1 -1
  59. package/dist/services/mediaStorageProviders/file-storage-provider.d.ts.map +1 -1
  60. package/dist/services/mediaStorageProviders/file-storage-provider.js +6 -3
  61. package/dist/services/mediaStorageProviders/file-storage-provider.js.map +1 -1
  62. package/dist/services/menu-item-metadata.service.d.ts.map +1 -1
  63. package/dist/services/menu-item-metadata.service.js +10 -1
  64. package/dist/services/menu-item-metadata.service.js.map +1 -1
  65. package/dist/services/model-metadata.service.d.ts.map +1 -1
  66. package/dist/services/model-metadata.service.js +1 -0
  67. package/dist/services/model-metadata.service.js.map +1 -1
  68. package/dist/services/role-metadata.service.d.ts +1 -1
  69. package/dist/services/role-metadata.service.d.ts.map +1 -1
  70. package/dist/services/role-metadata.service.js +1 -1
  71. package/dist/services/role-metadata.service.js.map +1 -1
  72. package/dist/services/user.service.d.ts +1 -0
  73. package/dist/services/user.service.d.ts.map +1 -1
  74. package/dist/services/user.service.js +14 -0
  75. package/dist/services/user.service.js.map +1 -1
  76. package/dist/services/view-metadata.service.js +1 -1
  77. package/dist/services/view-metadata.service.js.map +1 -1
  78. package/dist/subscribers/model.subscriber.js +1 -1
  79. package/dist/subscribers/model.subscriber.js.map +1 -1
  80. package/dist/tsconfig.tsbuildinfo +1 -1
  81. package/package.json +2 -1
  82. package/src/controllers/user.controller.ts +8 -0
  83. package/src/dtos/create-field-metadata.dto.ts +7 -12
  84. package/src/dtos/create-media.dto.ts +15 -3
  85. package/src/entities/field-metadata.entity.ts +8 -11
  86. package/src/entities/media-storage-provider-metadata.entity.ts +1 -1
  87. package/src/entities/media.entity.ts +9 -0
  88. package/src/entities/mysql-issues +14 -0
  89. package/src/entities/permission-metadata.entity.ts +2 -2
  90. package/src/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.ts +6 -6
  91. package/src/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.ts +4 -4
  92. package/src/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.ts +6 -6
  93. package/src/helpers/schematic.service.ts +5 -1
  94. package/src/seeders/module-metadata-seeder.service.ts +15 -3
  95. package/src/seeders/seed-data/solid-core-metadata.json +95 -68
  96. package/src/services/authentication.service.ts +2 -0
  97. package/src/services/crud.service.ts +9 -9
  98. package/src/services/field-metadata.service.ts +14 -21
  99. package/src/services/media.service.ts +35 -5
  100. package/src/services/mediaStorageProviders/file-s3-storage-provider.ts +4 -1
  101. package/src/services/mediaStorageProviders/file-storage-provider.ts +6 -3
  102. package/src/services/menu-item-metadata.service.ts +8 -2
  103. package/src/services/model-metadata.service.ts +1 -0
  104. package/src/services/role-metadata.service.ts +2 -2
  105. package/src/services/user.service.ts +15 -0
  106. package/src/services/view-metadata.service.ts +2 -2
  107. package/src/subscribers/model.subscriber.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core",
3
- "version": "1.2.23",
3
+ "version": "1.2.25",
4
4
  "description": "This module is a NestJS module containing all the required core providers required by a Solid application",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,6 +53,7 @@
53
53
  "passport-jwt": "^4.0.1",
54
54
  "passport-local": "^1.0.0",
55
55
  "pg": "^8.11.3",
56
+ "mysql2": "^3.13.0",
56
57
  "pluralize": "^8.0.0",
57
58
  "puppeteer": "^23.2.0",
58
59
  "reflect-metadata": "^0.1.13",
@@ -36,6 +36,14 @@ export class UserController {
36
36
  return this.service.update(id, updateDto, files);
37
37
  }
38
38
 
39
+
40
+ @ApiBearerAuth("jwt")
41
+ @Patch(':id/update-user-and-roles')
42
+ updateUser(@Param('id') id: number, @Body() updateDto: any, @UploadedFiles() files: Array<Express.Multer.File>) {
43
+ return this.service.updateUser(id, updateDto, files);
44
+ }
45
+
46
+
39
47
  @ApiBearerAuth("jwt")
40
48
  @Patch(':id')
41
49
  @UseInterceptors(AnyFilesInterceptor())
@@ -301,7 +301,7 @@ export class CreateFieldMetadataDto {
301
301
  @ApiProperty({ description: 'Related model for the relation. Only for type=relation' })
302
302
  @IsString()
303
303
  @IsOptional()
304
- relationModelSingularName: string;
304
+ relationCoModelSingularName: string;
305
305
 
306
306
  @ApiProperty({ description: 'Create inverse relation. Only for type=relation', })
307
307
  @IsBoolean()
@@ -319,7 +319,7 @@ export class CreateFieldMetadataDto {
319
319
 
320
320
  @ApiProperty({ description: 'Related field module. Only required for type=relation and relationType=many-to-many, i.e if the related many to many field belongs to a different model' })
321
321
  @IsOptional()
322
- relationModelFieldName: string;
322
+ relationCoModelFieldName: string;
323
323
 
324
324
  @ApiProperty({description: 'Only for type=relation, many-to-many. This field is used to set the owner of the many-to-many relation'})
325
325
  @IsOptional()
@@ -386,20 +386,15 @@ export class CreateFieldMetadataDto {
386
386
  @IsOptional()
387
387
  columnName: string
388
388
 
389
- @ApiProperty({ description: "Is User Key" })
390
- @IsOptional()
391
- @IsBoolean()
392
- readonly isUserKey: boolean
393
-
394
- @ApiProperty({ description: 'Relation Join Column Name of Field', })
389
+ @ApiProperty({ description: 'Relation CoModel Column Name of Field', })
395
390
  @IsString()
396
391
  @IsOptional()
397
- relationJoinColumnName: string
392
+ relationCoModelColumnName: string
398
393
 
399
- @ApiProperty({ description: 'Join Column Name of Field', })
400
- @IsString()
394
+ @ApiProperty({ description: "Is User Key" })
401
395
  @IsOptional()
402
- joinColumnName: string
396
+ @IsBoolean()
397
+ readonly isUserKey: boolean
403
398
 
404
399
  @ApiProperty({ description: 'Relation Join Table Name of Field', })
405
400
  @IsString()
@@ -7,17 +7,29 @@ export class CreateMediaDto {
7
7
 
8
8
  @IsNotEmpty()
9
9
  @IsInt()
10
- modelMetadataId: number;
10
+ modelMetadataId: number;
11
11
 
12
12
  @IsNotEmpty()
13
13
  @IsString()
14
14
  relativeUri: string;
15
-
15
+
16
+ @IsOptional()
17
+ @IsString()
18
+ mimeType: string;
19
+
20
+ @IsOptional()
21
+ @IsInt()
22
+ fileSize: number;
23
+
24
+ @IsOptional()
25
+ @IsString()
26
+ originalFileName: string;
27
+
16
28
  @IsNotEmpty()
17
29
  @IsInt()
18
30
  mediaStorageProviderMetadataId: number;
19
31
 
20
32
  @IsNotEmpty()
21
33
  @IsInt()
22
- fieldMetadataId: number;
34
+ fieldMetadataId: number;
23
35
  }
@@ -67,7 +67,7 @@ export class FieldMetadata extends CommonEntity {
67
67
  @Column({ name: "private", default: false })
68
68
  private: boolean;
69
69
 
70
- @Column("text", { array: true, name: 'media_types', nullable: true })
70
+ @Column("json", { name: 'media_types', nullable: true })
71
71
  mediaTypes: string[];
72
72
 
73
73
  @Column({ name: 'media_max_size_kb', nullable: true })
@@ -84,7 +84,7 @@ export class FieldMetadata extends CommonEntity {
84
84
  relationType: string;
85
85
 
86
86
  @Column({ name: 'relation_model_singular_name', nullable: true })
87
- relationModelSingularName: string;
87
+ relationCoModelSingularName: string;
88
88
 
89
89
  @Column({ name: "relation_create_inverse", default: false })
90
90
  relationCreateInverse: boolean;
@@ -97,7 +97,7 @@ export class FieldMetadata extends CommonEntity {
97
97
 
98
98
  // This field will be used to set the inverse field name in the related model e.g required for many to many relation
99
99
  @Column({ name: 'relation_model_field_name', nullable: true })
100
- relationModelFieldName: string;
100
+ relationCoModelFieldName: string;
101
101
 
102
102
  @Column({ name: 'is_relation_many_to_many_owner', nullable: true })
103
103
  isRelationManyToManyOwner: boolean;
@@ -111,7 +111,7 @@ export class FieldMetadata extends CommonEntity {
111
111
  @Column({ name: 'selection_static_values', nullable: true, type: 'simple-array' })
112
112
  selectionStaticValues: string[];
113
113
 
114
- @Column({ name: 'selection_value_type', nullable: true, type: 'text', default: 'string' })
114
+ @Column({ name: 'selection_value_type', nullable: true, type: 'text' }) // text type cannot have a default value
115
115
  selectionValueType: string = 'string';
116
116
 
117
117
  // @Column({ name: "computed", default: false })
@@ -138,14 +138,11 @@ export class FieldMetadata extends CommonEntity {
138
138
  @Column({ name: 'column_name', nullable: true })
139
139
  columnName: string;
140
140
 
141
- @Column({ name: "isUserKey", default: false })
142
- isUserKey: boolean;
143
-
144
- @Column({ name: 'relation_join_column_name', nullable: true })
145
- relationJoinColumnName: string;
141
+ @Column({ name: 'relation_co_model_column_name', nullable: true })
142
+ relationCoModelColumnName: string;
146
143
 
147
- @Column({ name: 'join_column_name', nullable: true })
148
- joinColumnName: string;
144
+ @Column({ name: "is_user_key", default: false })
145
+ isUserKey: boolean;
149
146
 
150
147
  @Column({ name: 'relation_join_table_name', nullable: true })
151
148
  relationJoinTableName: string;
@@ -4,7 +4,7 @@ import { Column, Entity, Index } from "typeorm";
4
4
  @Entity("ss_media_storage_provider_metadata")
5
5
  export class MediaStorageProviderMetadata extends CommonEntity {
6
6
  @Index({ unique: true })
7
- @Column({ unique: true })
7
+ @Column({ })
8
8
  name: string;
9
9
 
10
10
  @Column()
@@ -19,6 +19,15 @@ export class Media extends CommonEntity {
19
19
  @Column({ name: "relative_uri" })
20
20
  relativeUri: string;
21
21
 
22
+ @Column({ name: "mime_type" })
23
+ mimeType: string;
24
+
25
+ @Column({ name: "file_size" })
26
+ fileSize: number;
27
+
28
+ @Column({ name: "original_file_name" })
29
+ originalFileName: string;
30
+
22
31
  @Index()
23
32
  @ManyToOne(() => MediaStorageProviderMetadata)
24
33
  @JoinColumn({ name: "media_storage_provider_metadata_id" })
@@ -0,0 +1,14 @@
1
+ # Issues
2
+ 1. @Column("text", { array: true, name: 'media_types', nullable: true }) // array type not supported. No impact on code generation. not being used
3
+ 2.
4
+ default values not allowed for text,blog // Code generation impact. If we want to support default values for long text/rich text, then changes to be made.
5
+ date value is not supported propertly in mysql
6
+ i.e new Date("2025-02-11T00:00:00.000Z")
7
+ 3. Below type of code cannot exist. // No impact on code generation. Not being used.
8
+ @Index({ unique: true })
9
+ @Column({ unique: true })
10
+ 4. // Impact on code generation. unique index to be generated by using @Index and not @Column.
11
+ @Index({ unique: true })
12
+ @Column({ })
13
+ 5. i.e new Date("2025-02-11T00:00:00.000Z")
14
+ -> Remove the column default value
@@ -4,8 +4,8 @@ import { RoleMetadata } from 'src/entities/role-metadata.entity'
4
4
  @Entity("ss_permission_metadata")
5
5
  export class PermissionMetadata extends CommonEntity {
6
6
 
7
- @Index()
8
- @Column({ name: "name", type: "varchar", unique: true })
7
+ @Index({unique: true})
8
+ @Column({ name: "name", type: "varchar" })
9
9
  name: string;
10
10
 
11
11
  @ManyToMany(() => RoleMetadata, roleMetadata => roleMetadata.permissions, { cascade: ['insert', 'update'] })
@@ -8,12 +8,12 @@ import { EntityManager, In } from "typeorm";
8
8
  export interface ManyToManyRelationFieldOptions {
9
9
  // Add options for relation field
10
10
  required: boolean | undefined | null;
11
- relationModelSingularName: string | undefined | null;
11
+ relationCoModelSingularName: string | undefined | null;
12
12
  modelSingularName: string | undefined | null;
13
13
  isInverseSide: boolean;
14
14
  entityManager: EntityManager;
15
15
  fieldName: string;
16
- relationModelFieldName?: string;
16
+ relationCoModelFieldName?: string;
17
17
  }
18
18
 
19
19
  const linkCommands = [RelationFieldsCommand.link, RelationFieldsCommand.unlink, RelationFieldsCommand.set];
@@ -33,9 +33,9 @@ export class ManyToManyRelationFieldCrudManager implements FieldCrudManager {
33
33
  this.commandFieldName = `${this.options.fieldName}Command`;
34
34
  }
35
35
  else {
36
- this.valueFieldName = `${this.options.relationModelFieldName}`;
37
- this.idFieldName = `${this.options.relationModelFieldName}Ids`;
38
- this.commandFieldName = `${this.options.relationModelFieldName}Command`;
36
+ this.valueFieldName = `${this.options.relationCoModelFieldName}`;
37
+ this.idFieldName = `${this.options.relationCoModelFieldName}Ids`;
38
+ this.commandFieldName = `${this.options.relationCoModelFieldName}Command`;
39
39
  }
40
40
  }
41
41
 
@@ -71,7 +71,7 @@ export class ManyToManyRelationFieldCrudManager implements FieldCrudManager {
71
71
  const currentEntityTarget = this.getEntityTarget(classify(this.options.modelSingularName));
72
72
  const currentEntityRepository = this.options.entityManager.getRepository(currentEntityTarget);
73
73
 
74
- const relatedEntityTarget = this.getEntityTarget(classify(this.options.relationModelSingularName));
74
+ const relatedEntityTarget = this.getEntityTarget(classify(this.options.relationCoModelSingularName));
75
75
  const relatedEntityRepository = this.options.entityManager.getRepository(relatedEntityTarget)
76
76
 
77
77
  dto[this.valueFieldName] = await this.transformByCommand(dto, relatedEntityRepository, currentEntityRepository);
@@ -7,7 +7,7 @@ import { EntityManager } from "typeorm";
7
7
  export interface ManyToOneRelationFieldOptions {
8
8
  // Add options for relation field
9
9
  required: boolean | undefined | null;
10
- relationModelSingularName: string | undefined | null;
10
+ relationCoModelSingularName: string | undefined | null;
11
11
  fieldName: string | undefined | null;
12
12
  modelUserKeyFieldName: string | undefined | null;
13
13
  modelSingularName: string | undefined | null;
@@ -64,17 +64,17 @@ export class ManyToOneRelationFieldCrudManager implements FieldCrudManager {
64
64
  if ((isEmpty(fieldId)) && isEmpty(fieldUserKeyValue)) return dto;
65
65
 
66
66
  // // Load the related entity from the database, using the repository of the related entity
67
- const entityTarget = this.getRelatedEntityTarget(classify(this.options.relationModelSingularName));
67
+ const entityTarget = this.getRelatedEntityTarget(classify(this.options.relationCoModelSingularName));
68
68
  if (isNotEmpty(fieldId)) {
69
69
  dto[this.options.fieldName] = await this.options.entityManager.getRepository(entityTarget).findOneBy({ id: fieldId });
70
70
  if (this.options.required && isEmpty(dto[this.options.fieldName])) {
71
- throw new Error(`ManyToOneRelationFieldCrudManager: Record with id: ${fieldId} not found in ${this.options.relationModelSingularName}`);
71
+ throw new Error(`ManyToOneRelationFieldCrudManager: Record with id: ${fieldId} not found in ${this.options.relationCoModelSingularName}`);
72
72
  }
73
73
  }
74
74
  else {
75
75
  dto[this.options.fieldName] = await this.options.entityManager.getRepository(entityTarget).findOneBy({ [this.options.modelUserKeyFieldName]: fieldUserKeyValue });
76
76
  if (this.options.required && isEmpty(dto[this.options.fieldName])) {
77
- throw new Error(`ManyToOneRelationFieldCrudManager: Record with userKey: ${this.options.modelUserKeyFieldName}: ${fieldUserKeyValue} not found in ${this.options.relationModelSingularName}`);
77
+ throw new Error(`ManyToOneRelationFieldCrudManager: Record with userKey: ${this.options.modelUserKeyFieldName}: ${fieldUserKeyValue} not found in ${this.options.relationCoModelSingularName}`);
78
78
  }
79
79
  }
80
80
 
@@ -8,8 +8,8 @@ import { EntityManager, In } from "typeorm";
8
8
  export interface OneToManyRelationFieldOptions {
9
9
  // Add options for relation field
10
10
  required: boolean | undefined | null;
11
- relationModelSingularName: string | undefined | null;
12
- inverseRelationModelFieldName: string | undefined | null;
11
+ relationCoModelSingularName: string | undefined | null;
12
+ inverseRelationCoModelFieldName: string | undefined | null;
13
13
  modelSingularName: string | undefined | null;
14
14
  inverseFieldName: string | undefined | null;
15
15
  entityManager: EntityManager | undefined | null;
@@ -25,9 +25,9 @@ export class OneToManyRelationFieldCrudManager implements FieldCrudManager {
25
25
  private readonly commandFieldName: string;
26
26
 
27
27
  constructor(private readonly options: OneToManyRelationFieldOptions) {
28
- this.valueFieldName = this.options.inverseRelationModelFieldName ?? `${this.options.relationModelSingularName}s`;
29
- this.idFieldName = `${this.options.inverseRelationModelFieldName ?? this.options.relationModelSingularName}Ids`;
30
- this.commandFieldName = `${this.options.inverseRelationModelFieldName ?? this.options.relationModelSingularName}Command`;
28
+ this.valueFieldName = this.options.inverseRelationCoModelFieldName ?? `${this.options.relationCoModelSingularName}s`;
29
+ this.idFieldName = `${this.options.inverseRelationCoModelFieldName ?? this.options.relationCoModelSingularName}Ids`;
30
+ this.commandFieldName = `${this.options.inverseRelationCoModelFieldName ?? this.options.relationCoModelSingularName}Command`;
31
31
  }
32
32
 
33
33
  validate(dto: any) {
@@ -78,7 +78,7 @@ export class OneToManyRelationFieldCrudManager implements FieldCrudManager {
78
78
  const currentEntityTarget = this.getEntityTarget(classify(this.options.modelSingularName));
79
79
  const currentEntityRepository = this.options.entityManager.getRepository(currentEntityTarget);
80
80
 
81
- const relatedEntityTarget = this.getEntityTarget(classify(this.options.relationModelSingularName));
81
+ const relatedEntityTarget = this.getEntityTarget(classify(this.options.relationCoModelSingularName));
82
82
  const relatedEntityRepository = this.options.entityManager.getRepository(relatedEntityTarget)
83
83
 
84
84
  dto[this.valueFieldName] = await this.transformByCommand(dto, relatedEntityRepository, currentEntityRepository);
@@ -13,6 +13,7 @@ type FieldOptions = {
13
13
  table?: string;
14
14
  dataSource: string;
15
15
  fields: any[]; //FIXME This type can be improved
16
+ modelEnableSoftDelete?: boolean;
16
17
  };
17
18
  export const REMOVE_FIELDS_COMMAND = 'remove-fields';
18
19
  export const REFRESH_MODEL_COMMAND = 'refresh-model';
@@ -52,7 +53,6 @@ export class SchematicService {
52
53
  command === REFRESH_MODEL_COMMAND
53
54
  ) {
54
55
  const fieldOptions = options as FieldOptions;
55
- // console.log('fieldOptions', fieldOptions);
56
56
  let modelCommand = `${baseCommand} --module=${fieldOptions.module} --model=${fieldOptions.model}`;
57
57
  if (fieldOptions.moduleDisplayName) {
58
58
  modelCommand += ` --module-display-name=${snakeCase(fieldOptions.moduleDisplayName)}`;
@@ -65,6 +65,10 @@ export class SchematicService {
65
65
  if (fieldOptions.dataSource) {
66
66
  modelCommand += ` --data-source=${fieldOptions.dataSource}`;
67
67
  }
68
+
69
+ if (fieldOptions.modelEnableSoftDelete) {
70
+ modelCommand += ` --model-enable-soft-delete=${fieldOptions.modelEnableSoftDelete}`;
71
+ }
68
72
 
69
73
  let fieldCommand = fieldOptions.fields
70
74
  .filter((field) => {
@@ -205,7 +205,19 @@ export class ModuleMetadataSeederService {
205
205
  this.logger.debug(`About to add all permissions to the Admin role`);
206
206
  await this.roleService.addAllPermissionsToRole("Admin");
207
207
  // 2. Give wrapSettings permissions to the Public role.
208
- await this.roleService.addPermissionToRole('Public', 'SettingController.wrapSettings');
208
+ const internalRolePermission = ['UserController.findMany',
209
+ 'UserController.checkIfPermissionExists',
210
+ 'UserController.findOne',
211
+ 'MenuItemMetadataController.findMany',
212
+ 'MenuItemMetadataController.findUserMenus',
213
+ 'MenuItemMetadataController.findOne',
214
+ 'ViewMetadataController.getLayout',
215
+ 'ViewMetadataController.findMany',
216
+ 'ViewMetadataController.findOne',
217
+ 'AuthenticationController.changePassword'
218
+ ]
219
+ await this.roleService.addPermissionToRole('Internal User', internalRolePermission);
220
+ await this.roleService.addPermissionToRole('Public', ['SettingController.wrapSettings']);
209
221
  this.logger.log(`All Seeders finished`);
210
222
  this.logger.log(`Newly created username is: ${usersDetail?.length > 0 ? usersDetail[0]?.username : ''} and password is ${usersDetail?.length > 0 ? usersDetail[0]?.password : ''}`);
211
223
  }
@@ -354,9 +366,9 @@ export class ModuleMetadataSeederService {
354
366
  for (let j = 0; j < actions.length; j++) {
355
367
  const actionData = actions[j];
356
368
  actionData['module'] = await this.moduleMetadataService.findOneByUserKey(actionData.moduleUserKey);
369
+ actionData['model'] = await this.modelMetadataService.findOneByUserKey(actionData.modelUserKey);
357
370
  if (actionData.type === 'solid') {
358
371
  actionData['view'] = await this.solidViewService.findOneByUserKey(actionData.viewUserKey);
359
- actionData['model'] = await this.modelMetadataService.findOneByUserKey(actionData.modelUserKey);
360
372
  }
361
373
  await this.solidActionService.upsert(actionData);
362
374
  }
@@ -378,7 +390,7 @@ export class ModuleMetadataSeederService {
378
390
  viewData['model'] = await this.modelMetadataService.findOneByUserKey(viewData.modelUserKey);
379
391
  // await this.solidViewService.upsert(viewData);
380
392
  // First check if module already exists using name
381
- await this.solidViewService.createIfNotPresent(viewData);
393
+ await this.solidViewService.createIfNotPresent(viewData);
382
394
 
383
395
  }
384
396
  }