@solidstarters/solid-core 1.2.6 → 1.2.9

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 (82) hide show
  1. package/dist/commands/refresh-model.command.d.ts +4 -4
  2. package/dist/commands/refresh-model.command.d.ts.map +1 -1
  3. package/dist/commands/refresh-model.command.js +8 -8
  4. package/dist/commands/refresh-model.command.js.map +1 -1
  5. package/dist/commands/refresh-module.command.d.ts +4 -4
  6. package/dist/commands/refresh-module.command.d.ts.map +1 -1
  7. package/dist/commands/refresh-module.command.js +8 -8
  8. package/dist/commands/refresh-module.command.js.map +1 -1
  9. package/dist/controllers/setting.controller.d.ts +34 -0
  10. package/dist/controllers/setting.controller.d.ts.map +1 -0
  11. package/dist/controllers/setting.controller.js +161 -0
  12. package/dist/controllers/setting.controller.js.map +1 -0
  13. package/dist/dtos/create-field-metadata.dto.d.ts +1 -0
  14. package/dist/dtos/create-field-metadata.dto.d.ts.map +1 -1
  15. package/dist/dtos/create-field-metadata.dto.js +7 -1
  16. package/dist/dtos/create-field-metadata.dto.js.map +1 -1
  17. package/dist/dtos/create-model-metadata.dto.d.ts +0 -1
  18. package/dist/dtos/create-model-metadata.dto.d.ts.map +1 -1
  19. package/dist/dtos/create-model-metadata.dto.js +1 -6
  20. package/dist/dtos/create-model-metadata.dto.js.map +1 -1
  21. package/dist/dtos/create-setting.dto.d.ts +18 -0
  22. package/dist/dtos/create-setting.dto.d.ts.map +1 -0
  23. package/dist/dtos/create-setting.dto.js +106 -0
  24. package/dist/dtos/create-setting.dto.js.map +1 -0
  25. package/dist/dtos/update-setting.dto.d.ts +19 -0
  26. package/dist/dtos/update-setting.dto.d.ts.map +1 -0
  27. package/dist/dtos/update-setting.dto.js +110 -0
  28. package/dist/dtos/update-setting.dto.js.map +1 -0
  29. package/dist/entities/field-metadata.entity.d.ts +1 -0
  30. package/dist/entities/field-metadata.entity.d.ts.map +1 -1
  31. package/dist/entities/field-metadata.entity.js +5 -1
  32. package/dist/entities/field-metadata.entity.js.map +1 -1
  33. package/dist/entities/model-metadata.entity.d.ts +0 -1
  34. package/dist/entities/model-metadata.entity.d.ts.map +1 -1
  35. package/dist/entities/model-metadata.entity.js +1 -5
  36. package/dist/entities/model-metadata.entity.js.map +1 -1
  37. package/dist/entities/setting.entity.d.ts +19 -0
  38. package/dist/entities/setting.entity.d.ts.map +1 -0
  39. package/dist/entities/setting.entity.js +95 -0
  40. package/dist/entities/setting.entity.js.map +1 -0
  41. package/dist/index.d.ts +4 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +4 -0
  44. package/dist/index.js.map +1 -1
  45. package/dist/seeders/seed-data/solid-core-metadata.json +410 -94
  46. package/dist/services/field-metadata.service.d.ts.map +1 -1
  47. package/dist/services/field-metadata.service.js +2 -1
  48. package/dist/services/field-metadata.service.js.map +1 -1
  49. package/dist/services/file.service.d.ts +1 -0
  50. package/dist/services/file.service.d.ts.map +1 -1
  51. package/dist/services/file.service.js +8 -0
  52. package/dist/services/file.service.js.map +1 -1
  53. package/dist/services/model-metadata.service.d.ts.map +1 -1
  54. package/dist/services/model-metadata.service.js +28 -10
  55. package/dist/services/model-metadata.service.js.map +1 -1
  56. package/dist/services/setting.service.d.ts +31 -0
  57. package/dist/services/setting.service.d.ts.map +1 -0
  58. package/dist/services/setting.service.js +94 -0
  59. package/dist/services/setting.service.js.map +1 -0
  60. package/dist/solid-core.module.d.ts.map +1 -1
  61. package/dist/solid-core.module.js +6 -0
  62. package/dist/solid-core.module.js.map +1 -1
  63. package/dist/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +1 -1
  65. package/src/commands/refresh-model.command.ts +31 -31
  66. package/src/commands/refresh-module.command.ts +32 -32
  67. package/src/controllers/setting.controller.ts +80 -0
  68. package/src/dtos/create-field-metadata.dto.ts +5 -0
  69. package/src/dtos/create-model-metadata.dto.ts +0 -4
  70. package/src/dtos/create-setting.dto.ts +63 -0
  71. package/src/dtos/update-setting.dto.ts +66 -0
  72. package/src/entities/field-metadata.entity.ts +2 -0
  73. package/src/entities/model-metadata.entity.ts +0 -3
  74. package/src/entities/setting.entity.ts +49 -0
  75. package/src/index.ts +5 -0
  76. package/src/seeders/seed-data/solid-core-metadata.json +410 -94
  77. package/src/services/1.js +6 -0
  78. package/src/services/field-metadata.service.ts +2 -1
  79. package/src/services/file.service.ts +9 -0
  80. package/src/services/model-metadata.service.ts +36 -11
  81. package/src/services/setting.service.ts +71 -0
  82. package/src/solid-core.module.ts +6 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core",
3
- "version": "1.2.6",
3
+ "version": "1.2.9",
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",
@@ -4,8 +4,8 @@ import { ModelMetadataService } from 'src/services/model-metadata.service';
4
4
  import { CommandError } from './helper';
5
5
 
6
6
  interface CommandOptions {
7
- modelName: string;
8
- modelId: number;
7
+ name: string;
8
+ id: number;
9
9
  dryRun: boolean;
10
10
  }
11
11
 
@@ -29,45 +29,45 @@ export class RefreshModelCommand extends CommandRunner {
29
29
  }
30
30
 
31
31
  const codeGenerationOptions = {
32
- modelId: options.modelId,
33
- modelUserKey: options.modelName,
32
+ modelId: options.id,
33
+ modelUserKey: options.name,
34
34
  dryRun: options.dryRun,
35
35
  };
36
36
  await this.modelMetadataService.generateCode(codeGenerationOptions);
37
37
  }
38
38
 
39
39
  @Option({
40
- flags: '-id, --id [model ID]',
40
+ flags: '-i, --id [model ID]',
41
41
  description: 'Model ID from the ss_model_metadata table',
42
42
  })
43
- parseModelId(val: string): number {
43
+ parseId(val: string): number {
44
44
  return +val;
45
45
  }
46
46
 
47
- // Accept the module name as an argument
48
- @Option({
49
- flags: '-n, --name [model name]',
50
- description: 'Model Name from the ss_model_metadata table',
51
- })
52
- parseModelName(val: string): string {
53
- return val;
54
- }
55
-
56
- @Option({
57
- flags: '-d, --dryRun [dry run]',
58
- description: 'Dry run the command',
59
- })
60
- parseDryRun(val: string): boolean {
61
- this.logger.debug(`Dry run : ${val}`);
62
- return (val === 'false')? false : true;
63
- }
64
-
65
- // Validate the options passed
66
- validate(options: CommandOptions): CommandError[] {
67
- if (!options.modelId && !options.modelName) {
68
- return [new CommandError('Model ID or Model Name is required')];
69
- }
70
- return [];
47
+ // Accept the module name as an argument
48
+ @Option({
49
+ flags: '-n, --name [model name]',
50
+ description: 'Model Name from the ss_model_metadata table',
51
+ })
52
+ parseName(val: string): string {
53
+ return val;
54
+ }
55
+
56
+ @Option({
57
+ flags: '-d, --dryRun [dry run]',
58
+ description: 'Dry run the command',
59
+ })
60
+ parseDryRun(val: string): boolean {
61
+ this.logger.debug(`Dry run : ${val}`);
62
+ return (val === 'false') ? false : true;
63
+ }
64
+
65
+ // Validate the options passed
66
+ validate(options: CommandOptions): CommandError[] {
67
+ if (!options.id && !options.name) {
68
+ return [new CommandError('Model ID or Model Name is required')];
71
69
  }
72
-
70
+ return [];
71
+ }
72
+
73
73
  }
@@ -4,8 +4,8 @@ import { ModuleMetadataService } from '../services/module-metadata.service';
4
4
  import { CommandError } from './helper';
5
5
 
6
6
  interface CommandOptions {
7
- moduleId: number;
8
- moduleName: string;
7
+ id: number;
8
+ name: string;
9
9
  dryRun: boolean;
10
10
  }
11
11
 
@@ -13,7 +13,7 @@ interface CommandOptions {
13
13
  name: 'refresh-module',
14
14
  description: 'Refreshes a module and its model and fields i.e (entity,dto,service,controller files)',
15
15
  })
16
- export class RefreshModuleCommand extends CommandRunner {
16
+ export class RefreshModuleCommand extends CommandRunner {
17
17
  constructor(
18
18
  private readonly moduleMetadataService: ModuleMetadataService,
19
19
  ) {
@@ -28,8 +28,8 @@ export class RefreshModuleCommand extends CommandRunner {
28
28
  return;
29
29
  }
30
30
  const codeGenerationOptions = {
31
- moduleId: options.moduleId,
32
- moduleUserKey: options.moduleName,
31
+ moduleId: options.id,
32
+ moduleUserKey: options.name,
33
33
  dryRun: options.dryRun,
34
34
  };
35
35
  await this.moduleMetadataService.generateCode(codeGenerationOptions);
@@ -37,38 +37,38 @@ export class RefreshModuleCommand extends CommandRunner {
37
37
 
38
38
 
39
39
  @Option({
40
- flags: '-id, --id [module ID]',
40
+ flags: '-i, --id [module ID]',
41
41
  description: 'Module ID from the ss_module_metadata table',
42
42
  })
43
- parseModuleId(val: string): number {
43
+ parseId(val: string): number {
44
44
  return +val;
45
45
  }
46
46
 
47
- // Accept the module name as an argument
48
- @Option({
49
- flags: '-n, --name [module name]',
50
- description: 'Module Name from the ss_module_metadata table',
51
- })
52
- parseModuleName(val: string): string {
53
- return val;
54
- }
55
-
56
- @Option({
57
- flags: '-d, --dryRun [dry run]',
58
- description: 'Dry run the command',
59
- })
60
- parseDryRun(val: string): boolean {
61
- this.logger.debug(`Dry run : ${val}`);
62
- return (val === 'false')? false : true;
63
- }
64
-
47
+ // Accept the module name as an argument
48
+ @Option({
49
+ flags: '-n, --name [module name]',
50
+ description: 'Module Name from the ss_module_metadata table',
51
+ })
52
+ parseName(val: string): string {
53
+ return val;
54
+ }
55
+
56
+ @Option({
57
+ flags: '-d, --dryRun [dry run]',
58
+ description: 'Dry run the command',
59
+ })
60
+ parseDryRun(val: string): boolean {
61
+ this.logger.debug(`Dry run : ${val}`);
62
+ return (val === 'false') ? false : true;
63
+ }
65
64
 
66
- // Validate the options passed
67
- validate(options: CommandOptions): CommandError[] {
68
- if (!options.moduleId && !options.moduleName) {
69
- return [new CommandError('Module ID or Module Name is required')];
70
- }
71
- return [];
65
+
66
+ // Validate the options passed
67
+ validate(options: CommandOptions): CommandError[] {
68
+ if (!options.id && !options.name) {
69
+ return [new CommandError('Module ID or Module Name is required')];
72
70
  }
73
-
71
+ return [];
72
+ }
73
+
74
74
  }
@@ -0,0 +1,80 @@
1
+ import { Controller, Post, Body, Param, UploadedFiles, UseInterceptors, Put, Get, Query, Delete, Patch } from '@nestjs/common';
2
+ import { AnyFilesInterceptor } from "@nestjs/platform-express";
3
+ import { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';
4
+ import { SettingService } from '../services/setting.service';
5
+ import { CreateSettingDto } from '../dtos/create-setting.dto';
6
+ import { UpdateSettingDto } from '../dtos/update-setting.dto';
7
+
8
+ @ApiTags('Solid')
9
+ @Controller('setting') //FIXME: Change this to the model plural name
10
+ export class SettingController {
11
+ constructor(private readonly service: SettingService) {}
12
+
13
+ @ApiBearerAuth("jwt")
14
+ @Post()
15
+ @UseInterceptors(AnyFilesInterceptor())
16
+ create(@Body() createDto: CreateSettingDto, @UploadedFiles() files: Array<Express.Multer.File>) {
17
+ return this.service.create(createDto, files);
18
+ }
19
+
20
+ @ApiBearerAuth("jwt")
21
+ @Post('/bulk')
22
+ @UseInterceptors(AnyFilesInterceptor())
23
+ insertMany(@Body() createDtos: CreateSettingDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {
24
+ return this.service.insertMany(createDtos, filesArray);
25
+ }
26
+
27
+
28
+ @ApiBearerAuth("jwt")
29
+ @Put(':id')
30
+ @UseInterceptors(AnyFilesInterceptor())
31
+ update(@Param('id') id: number, @Body() updateDto: UpdateSettingDto, @UploadedFiles() files: Array<Express.Multer.File>) {
32
+ return this.service.update(id, updateDto, files);
33
+ }
34
+
35
+ @ApiBearerAuth("jwt")
36
+ @Patch(':id')
37
+ @UseInterceptors(AnyFilesInterceptor())
38
+ partialUpdate(@Param('id') id: number, @Body() updateDto: UpdateSettingDto, @UploadedFiles() files: Array<Express.Multer.File>) {
39
+ return this.service.update(id, updateDto, files, true);
40
+ }
41
+
42
+ @ApiBearerAuth("jwt")
43
+ @Get('/getSettings')
44
+ async getAllSettings() {
45
+ return this.service.getAllSettings();
46
+ }
47
+
48
+ @ApiBearerAuth("jwt")
49
+ @ApiQuery({ name: 'showSoftDeleted', required: false, type: Boolean })
50
+ @ApiQuery({ name: 'showOnlySoftDeleted', required: false, type: Boolean })
51
+ @ApiQuery({ name: 'limit', required: false, type: Number })
52
+ @ApiQuery({ name: 'offset', required: false, type: Number })
53
+ @ApiQuery({ name: 'fields', required: false, type: Array })
54
+ @ApiQuery({ name: 'sort', required: false, type: Array })
55
+ @ApiQuery({ name: 'groupBy', required: false, type: Array })
56
+ @ApiQuery({ name: 'populate', required: false, type: Array })
57
+ @ApiQuery({ name: 'populateMedia', required: false, type: Array })
58
+ @ApiQuery({ name: 'filters', required: false, type: Array })
59
+ @Get()
60
+ async findMany(@Query() query: any) {
61
+ return this.service.find(query);
62
+ }
63
+
64
+ @ApiBearerAuth("jwt")
65
+ @Get(':id')
66
+ async findOne(@Param('id') id: string, @Query() query: any) {
67
+ return this.service.findOne(+id, query);
68
+ }
69
+
70
+ @Delete('/bulk')
71
+ async deleteMany(@Body() ids: number[]) {
72
+ return this.service.deleteMany(ids);
73
+ }
74
+
75
+ @ApiBearerAuth("jwt")
76
+ @Delete(':id')
77
+ async delete(@Param('id') id: number) {
78
+ return this.service.delete(id);
79
+ }
80
+ }
@@ -382,4 +382,9 @@ export class CreateFieldMetadataDto {
382
382
  @IsString()
383
383
  @IsOptional()
384
384
  columnName: string
385
+
386
+ @ApiProperty({ description: "Is User Key" })
387
+ @IsOptional()
388
+ @IsBoolean()
389
+ readonly isUserKey: boolean
385
390
  }
@@ -91,10 +91,6 @@ export class CreateModelMetadataDto {
91
91
  @Type(() => CreateFieldMetadataDto)
92
92
  fields: CreateFieldMetadataDto[];
93
93
 
94
- @ApiProperty({ description: "Is Exportable" })
95
- @IsBoolean()
96
- readonly isExportable: boolean
97
-
98
94
  @ApiProperty({ description: 'System models are not included in the code generation, the assumption being that system models have manually written code.', })
99
95
  @IsBoolean()
100
96
  isSystem: boolean;
@@ -0,0 +1,63 @@
1
+ import { IsString } from 'class-validator';
2
+ import { IsOptional, IsBoolean } from 'class-validator';
3
+ export class CreateSettingDto {
4
+ @IsOptional()
5
+ @IsString()
6
+ authPagesLayout: string;
7
+
8
+ @IsOptional()
9
+ @IsString()
10
+ authPagesTheme: string;
11
+
12
+ @IsOptional()
13
+ @IsString()
14
+ appTitle: string;
15
+
16
+ @IsOptional()
17
+ @IsString()
18
+ appLogo: string;
19
+
20
+ @IsOptional()
21
+ @IsString()
22
+ appDescription: string;
23
+
24
+ @IsOptional()
25
+ @IsString()
26
+ appTnc: string;
27
+
28
+ @IsOptional()
29
+ @IsString()
30
+ appPrivacyPolicy: string;
31
+
32
+ @IsOptional()
33
+ @IsBoolean()
34
+ iamAllowPublicRegistration: boolean = false;
35
+
36
+ @IsOptional()
37
+ @IsBoolean()
38
+ iamPasswordRegistrationEnabled: boolean = false;
39
+
40
+ @IsOptional()
41
+ @IsBoolean()
42
+ iamPasswordLessRegistrationEnabled: boolean = false;
43
+
44
+ @IsOptional()
45
+ @IsBoolean()
46
+ iamActivateUserOnRegistration: boolean = false;
47
+
48
+ @IsOptional()
49
+ @IsString()
50
+ iamDefaultRole: string;
51
+
52
+ @IsOptional()
53
+ @IsBoolean()
54
+ iamGoogleOAuthEnabled: boolean = false;
55
+
56
+ @IsOptional()
57
+ @IsBoolean()
58
+ shouldQueueEmails: boolean = false;
59
+
60
+ @IsOptional()
61
+ @IsBoolean()
62
+ shouldQueueSms: boolean = false;
63
+ }
@@ -0,0 +1,66 @@
1
+ import { IsInt,IsOptional, IsString, IsBoolean } from 'class-validator';
2
+ export class UpdateSettingDto {
3
+ @IsOptional()
4
+ @IsInt()
5
+ id: number;
6
+
7
+ @IsOptional()
8
+ @IsString()
9
+ authPagesLayout: string;
10
+
11
+ @IsOptional()
12
+ @IsString()
13
+ authPagesTheme: string;
14
+
15
+ @IsOptional()
16
+ @IsString()
17
+ appTitle: string;
18
+
19
+ @IsOptional()
20
+ @IsString()
21
+ appLogo: string;
22
+
23
+ @IsOptional()
24
+ @IsString()
25
+ appDescription: string;
26
+
27
+ @IsOptional()
28
+ @IsString()
29
+ appTnc: string;
30
+
31
+ @IsOptional()
32
+ @IsString()
33
+ appPrivacyPolicy: string;
34
+
35
+ @IsOptional()
36
+ @IsBoolean()
37
+ iamAllowPublicRegistration: boolean = false;
38
+
39
+ @IsOptional()
40
+ @IsBoolean()
41
+ iamPasswordRegistrationEnabled: boolean = false;
42
+
43
+ @IsOptional()
44
+ @IsBoolean()
45
+ iamPasswordLessRegistrationEnabled: boolean = false;
46
+
47
+ @IsOptional()
48
+ @IsBoolean()
49
+ iamActivateUserOnRegistration: boolean = false;
50
+
51
+ @IsOptional()
52
+ @IsString()
53
+ iamDefaultRole: string;
54
+
55
+ @IsOptional()
56
+ @IsBoolean()
57
+ iamGoogleOAuthEnabled: boolean = false;
58
+
59
+ @IsOptional()
60
+ @IsBoolean()
61
+ shouldQueueEmails: boolean = false;
62
+
63
+ @IsOptional()
64
+ @IsBoolean()
65
+ shouldQueueSms: boolean = false;
66
+ }
@@ -135,4 +135,6 @@ export class FieldMetadata extends CommonEntity {
135
135
  @Column({ name: 'column_name', nullable: true })
136
136
  columnName: string;
137
137
 
138
+ @Column({ name: "isUserKey", default: false })
139
+ isUserKey: boolean;
138
140
  }
@@ -47,9 +47,6 @@ export class ModelMetadata extends CommonEntity {
47
47
  @JoinColumn({ name: 'module_id', referencedColumnName: 'id' })
48
48
  module: ModuleMetadata;
49
49
 
50
- @Column({ name: "is_exportable", default: false })
51
- isExportable: boolean;
52
-
53
50
  // ExternalId
54
51
  // 1. Single field.
55
52
  // 2. Composite field.
@@ -0,0 +1,49 @@
1
+ import { CommonEntity } from 'src/entities/common.entity'
2
+ import {Entity, Column} from 'typeorm'
3
+ @Entity("ss_setting")
4
+ export class Setting extends CommonEntity{
5
+ @Column({ type: "varchar", nullable: true })
6
+ authPagesLayout: string;
7
+
8
+ @Column({ type: "varchar", nullable: true })
9
+ authPagesTheme: string;
10
+
11
+ @Column({ type: "varchar", nullable: true })
12
+ appTitle: string;
13
+
14
+ @Column({ type: "varchar", nullable: true })
15
+ appLogo: string;
16
+
17
+ @Column({ type: "varchar", nullable: true })
18
+ appDescription: string;
19
+
20
+ @Column({ type: "varchar", nullable: true })
21
+ appTnc: string;
22
+
23
+ @Column({ type: "varchar", nullable: true })
24
+ appPrivacyPolicy: string;
25
+
26
+ @Column({ type: "boolean", nullable: true, default: false })
27
+ iamAllowPublicRegistration: boolean = false;
28
+
29
+ @Column({ type: "boolean", nullable: true, default: false })
30
+ iamPasswordRegistrationEnabled: boolean = false;
31
+
32
+ @Column({ type: "boolean", nullable: true, default: false })
33
+ iamPasswordLessRegistrationEnabled: boolean = false;
34
+
35
+ @Column({ type: "boolean", nullable: true, default: false })
36
+ iamActivateUserOnRegistration: boolean = false;
37
+
38
+ @Column({ type: "varchar", nullable: true })
39
+ iamDefaultRole: string;
40
+
41
+ @Column({ type: "boolean", nullable: true, default: false })
42
+ iamGoogleOAuthEnabled: boolean = false;
43
+
44
+ @Column({ type: "boolean", nullable: true, default: false })
45
+ shouldQueueEmails: boolean = false;
46
+
47
+ @Column({ type: "boolean", nullable: true, default: false })
48
+ shouldQueueSms: boolean = false;
49
+ }
package/src/index.ts CHANGED
@@ -76,6 +76,9 @@ export * from './dtos/update-role-metadata.dto'
76
76
  export * from './dtos/update-sms-template.dto'
77
77
  export * from './dtos/update-user.dto'
78
78
  export * from './dtos/update-view-metadata.dto'
79
+ export * from './dtos/create-setting.dto'
80
+ export * from './dtos/update-setting.dto'
81
+
79
82
 
80
83
  export * from './entities/action-metadata.entity'
81
84
  export * from './entities/common.entity'
@@ -96,6 +99,7 @@ export * from './entities/sms-template.entity'
96
99
  export * from './entities/user-password-history.entity'
97
100
  export * from './entities/user.entity'
98
101
  export * from './entities/view-metadata.entity'
102
+ export * from './entities/setting.entity'
99
103
 
100
104
  export * from './enums/auth-type.enum'
101
105
 
@@ -208,6 +212,7 @@ export * from './services/solid-introspect.service'
208
212
  export * from './services/user.service'
209
213
  export * from './services/view-metadata.service'
210
214
  export * from './services/whatsapp/Msg91WhatsappService' //rename
215
+ export * from './services/setting.service'
211
216
 
212
217
 
213
218
  //softDeleteAwareEventSubscriber.subscriber.ts