@solidstarters/solid-core 1.2.88 → 1.2.90

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 (102) hide show
  1. package/dist/controllers/export-template.controller.d.ts +3 -2
  2. package/dist/controllers/export-template.controller.d.ts.map +1 -1
  3. package/dist/controllers/export-template.controller.js +23 -10
  4. package/dist/controllers/export-template.controller.js.map +1 -1
  5. package/dist/controllers/import-transaction-error-log.controller.d.ts +41 -0
  6. package/dist/controllers/import-transaction-error-log.controller.d.ts.map +1 -0
  7. package/dist/controllers/import-transaction-error-log.controller.js +179 -0
  8. package/dist/controllers/import-transaction-error-log.controller.js.map +1 -0
  9. package/dist/controllers/import-transaction.controller.d.ts +46 -0
  10. package/dist/controllers/import-transaction.controller.d.ts.map +1 -0
  11. package/dist/controllers/import-transaction.controller.js +236 -0
  12. package/dist/controllers/import-transaction.controller.js.map +1 -0
  13. package/dist/dtos/create-import-transaction-error-log.dto.d.ts +10 -0
  14. package/dist/dtos/create-import-transaction-error-log.dto.d.ts.map +1 -0
  15. package/dist/dtos/create-import-transaction-error-log.dto.js +65 -0
  16. package/dist/dtos/create-import-transaction-error-log.dto.js.map +1 -0
  17. package/dist/dtos/create-import-transaction.dto.d.ts +14 -0
  18. package/dist/dtos/create-import-transaction.dto.d.ts.map +1 -0
  19. package/dist/dtos/create-import-transaction.dto.js +90 -0
  20. package/dist/dtos/create-import-transaction.dto.js.map +1 -0
  21. package/dist/dtos/export.dto.d.ts +5 -0
  22. package/dist/dtos/export.dto.d.ts.map +1 -0
  23. package/dist/dtos/export.dto.js +12 -0
  24. package/dist/dtos/export.dto.js.map +1 -0
  25. package/dist/dtos/import-instructions.dto.d.ts +19 -0
  26. package/dist/dtos/import-instructions.dto.d.ts.map +1 -0
  27. package/dist/dtos/import-instructions.dto.js +110 -0
  28. package/dist/dtos/import-instructions.dto.js.map +1 -0
  29. package/dist/dtos/update-import-transaction-error-log.dto.d.ts +11 -0
  30. package/dist/dtos/update-import-transaction-error-log.dto.d.ts.map +1 -0
  31. package/dist/dtos/update-import-transaction-error-log.dto.js +72 -0
  32. package/dist/dtos/update-import-transaction-error-log.dto.js.map +1 -0
  33. package/dist/dtos/update-import-transaction.dto.d.ts +15 -0
  34. package/dist/dtos/update-import-transaction.dto.d.ts.map +1 -0
  35. package/dist/dtos/update-import-transaction.dto.js +91 -0
  36. package/dist/dtos/update-import-transaction.dto.js.map +1 -0
  37. package/dist/entities/export-transaction.entity.js +1 -1
  38. package/dist/entities/export-transaction.entity.js.map +1 -1
  39. package/dist/entities/import-transaction-error-log.entity.d.ts +11 -0
  40. package/dist/entities/import-transaction-error-log.entity.d.ts.map +1 -0
  41. package/dist/entities/import-transaction-error-log.entity.js +53 -0
  42. package/dist/entities/import-transaction-error-log.entity.js.map +1 -0
  43. package/dist/entities/import-transaction.entity.d.ts +11 -0
  44. package/dist/entities/import-transaction.entity.d.ts.map +1 -0
  45. package/dist/entities/import-transaction.entity.js +55 -0
  46. package/dist/entities/import-transaction.entity.js.map +1 -0
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +2 -0
  50. package/dist/index.js.map +1 -1
  51. package/dist/seeders/seed-data/solid-core-metadata.json +317 -1
  52. package/dist/services/csv.service.d.ts +11 -1
  53. package/dist/services/csv.service.d.ts.map +1 -1
  54. package/dist/services/csv.service.js +72 -5
  55. package/dist/services/csv.service.js.map +1 -1
  56. package/dist/services/excel.service.d.ts +11 -1
  57. package/dist/services/excel.service.d.ts.map +1 -1
  58. package/dist/services/excel.service.js +68 -10
  59. package/dist/services/excel.service.js.map +1 -1
  60. package/dist/services/export-template.service.d.ts +3 -2
  61. package/dist/services/export-template.service.d.ts.map +1 -1
  62. package/dist/services/export-template.service.js +6 -6
  63. package/dist/services/export-template.service.js.map +1 -1
  64. package/dist/services/export-transaction.service.d.ts +6 -3
  65. package/dist/services/export-transaction.service.d.ts.map +1 -1
  66. package/dist/services/export-transaction.service.js +101 -22
  67. package/dist/services/export-transaction.service.js.map +1 -1
  68. package/dist/services/import-transaction-error-log.service.d.ts +22 -0
  69. package/dist/services/import-transaction-error-log.service.d.ts.map +1 -0
  70. package/dist/services/import-transaction-error-log.service.js +56 -0
  71. package/dist/services/import-transaction-error-log.service.js.map +1 -0
  72. package/dist/services/import-transaction.service.d.ts +64 -0
  73. package/dist/services/import-transaction.service.d.ts.map +1 -0
  74. package/dist/services/import-transaction.service.js +231 -0
  75. package/dist/services/import-transaction.service.js.map +1 -0
  76. package/dist/solid-core.module.d.ts.map +1 -1
  77. package/dist/solid-core.module.js +13 -1
  78. package/dist/solid-core.module.js.map +1 -1
  79. package/dist/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +1 -1
  81. package/src/controllers/export-template.controller.ts +20 -7
  82. package/src/controllers/import-transaction-error-log.controller.ts +93 -0
  83. package/src/controllers/import-transaction.controller.ts +128 -0
  84. package/src/dtos/create-import-transaction-error-log.dto.ts +34 -0
  85. package/src/dtos/create-import-transaction.dto.ts +50 -0
  86. package/src/dtos/export.dto.ts +5 -0
  87. package/src/dtos/import-instructions.dto.ts +66 -0
  88. package/src/dtos/update-import-transaction-error-log.dto.ts +39 -0
  89. package/src/dtos/update-import-transaction.dto.ts +52 -0
  90. package/src/entities/export-transaction.entity.ts +1 -1
  91. package/src/entities/import-transaction-error-log.entity.ts +22 -0
  92. package/src/entities/import-transaction.entity.ts +22 -0
  93. package/src/index.ts +2 -0
  94. package/src/seeders/seed-data/solid-core-metadata.json +319 -3
  95. package/src/services/csv.service.ts +116 -7
  96. package/src/services/excel.service.ts +109 -64
  97. package/src/services/export-template.service.ts +7 -6
  98. package/src/services/export-transaction.service.ts +136 -25
  99. package/src/services/export_issues.txt +5 -1
  100. package/src/services/import-transaction-error-log.service.ts +34 -0
  101. package/src/services/import-transaction.service.ts +281 -0
  102. package/src/solid-core.module.ts +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core",
3
- "version": "1.2.88",
3
+ "version": "1.2.90",
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",
@@ -5,6 +5,7 @@ import { ExportTemplateService } from '../services/export-template.service';
5
5
  import { CreateExportTemplateDto } from '../dtos/create-export-template.dto';
6
6
  import { UpdateExportTemplateDto } from '../dtos/update-export-template.dto';
7
7
  import { Response } from 'express';
8
+ import { StartExportSyncDto } from 'src/dtos/export.dto';
8
9
 
9
10
  @ApiTags('Solid')
10
11
  @Controller('export-template') //FIXME: Change this to the model plural name
@@ -74,13 +75,19 @@ export class ExportTemplateController {
74
75
  }
75
76
 
76
77
  @ApiBearerAuth("jwt")
77
- @Post(':id/startExport/sync')
78
- async startExportSync(@Param('id') id: number, @Res() res: Response) {
79
- const exportFileInfo = await this.service.startExportSync(+id);
78
+ @Post('/startExport/sync')
79
+ async startExportSync(@Body() dto: StartExportSyncDto, @Res() res: Response) {
80
+ const { filters, ...rest } = dto;
81
+ let updateDto = { ...rest };
82
+ // Check if templateName is present → create template
83
+ if (updateDto?.templateName) {
84
+ const newTemplate = await this.service.create(updateDto, []);
85
+ updateDto = { ...updateDto, id: newTemplate.id };
86
+ }
87
+ const exportFileInfo = await this.service.startExportSync(updateDto, filters);
80
88
  if (exportFileInfo.exportStream === null) {
81
89
  throw new InternalServerErrorException("Export stream is null");
82
90
  }
83
-
84
91
  // ✅ Set response headers for streaming
85
92
  res.setHeader('Content-Disposition', `attachment; filename="${exportFileInfo.fileName}"`);
86
93
  res.setHeader('Content-Type', exportFileInfo.mimeType);
@@ -90,9 +97,15 @@ export class ExportTemplateController {
90
97
  }
91
98
 
92
99
  @ApiBearerAuth("jwt")
93
- @Post(':id/startExport/async')
94
- async startExportAsync(@Param('id') id: number) {
95
- return this.service.startExportAsync(+id);
100
+ @Post('/startExport/async')
101
+ async startExportAsync(@Body() dto: StartExportSyncDto) {
102
+ const { filters, ...rest } = dto;
103
+ let updateDto = { ...rest };
104
+ if (updateDto.templateName) {
105
+ const newTemplate = await this.service.create(updateDto, []);
106
+ updateDto = { ...updateDto, id: newTemplate.id };
107
+ }
108
+ return this.service.startExportAsync(updateDto, filters);
96
109
  }
97
110
 
98
111
  }
@@ -0,0 +1,93 @@
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 { ImportTransactionErrorLogService } from '../services/import-transaction-error-log.service';
5
+ import { CreateImportTransactionErrorLogDto } from '../dtos/create-import-transaction-error-log.dto';
6
+ import { UpdateImportTransactionErrorLogDto } from '../dtos/update-import-transaction-error-log.dto';
7
+
8
+ enum ShowSoftDeleted {
9
+ INCLUSIVE = "inclusive",
10
+ EXCLUSIVE = "exclusive",
11
+ }
12
+
13
+ @ApiTags('Solid Core')
14
+ @Controller('import-transaction-error-log')
15
+ export class ImportTransactionErrorLogController {
16
+ constructor(private readonly service: ImportTransactionErrorLogService) {}
17
+
18
+ @ApiBearerAuth("jwt")
19
+ @Post()
20
+ @UseInterceptors(AnyFilesInterceptor())
21
+ create(@Body() createDto: CreateImportTransactionErrorLogDto, @UploadedFiles() files: Array<Express.Multer.File>) {
22
+ return this.service.create(createDto, files);
23
+ }
24
+
25
+ @ApiBearerAuth("jwt")
26
+ @Post('/bulk')
27
+ @UseInterceptors(AnyFilesInterceptor())
28
+ insertMany(@Body() createDtos: CreateImportTransactionErrorLogDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {
29
+ return this.service.insertMany(createDtos, filesArray);
30
+ }
31
+
32
+
33
+ @ApiBearerAuth("jwt")
34
+ @Put(':id')
35
+ @UseInterceptors(AnyFilesInterceptor())
36
+ update(@Param('id') id: number, @Body() updateDto: UpdateImportTransactionErrorLogDto, @UploadedFiles() files: Array<Express.Multer.File>) {
37
+ return this.service.update(id, updateDto, files);
38
+ }
39
+
40
+ @ApiBearerAuth("jwt")
41
+ @Patch(':id')
42
+ @UseInterceptors(AnyFilesInterceptor())
43
+ partialUpdate(@Param('id') id: number, @Body() updateDto: UpdateImportTransactionErrorLogDto, @UploadedFiles() files: Array<Express.Multer.File>) {
44
+ return this.service.update(id, updateDto, files, true);
45
+ }
46
+
47
+ @ApiBearerAuth("jwt")
48
+ @Post('/bulk-recover')
49
+ async recoverMany(@Body() ids: number[]) {
50
+ return this.service.recoverMany(ids);
51
+ }
52
+
53
+ @ApiBearerAuth("jwt")
54
+ @Get('/recover/:id')
55
+ async recover(@Param('id') id: number) {
56
+ return this.service.recover(id);
57
+ }
58
+
59
+ @ApiBearerAuth("jwt")
60
+ @ApiQuery({ name: 'showSoftDeleted', required: false, enum: ShowSoftDeleted })
61
+ @ApiQuery({ name: 'limit', required: false, type: Number })
62
+ @ApiQuery({ name: 'offset', required: false, type: Number })
63
+ @ApiQuery({ name: 'fields', required: false, type: Array })
64
+ @ApiQuery({ name: 'sort', required: false, type: Array })
65
+ @ApiQuery({ name: 'groupBy', required: false, type: Array })
66
+ @ApiQuery({ name: 'populate', required: false, type: Array })
67
+ @ApiQuery({ name: 'populateMedia', required: false, type: Array })
68
+ @ApiQuery({ name: 'filters', required: false, type: Array })
69
+ @Get()
70
+ async findMany(@Query() query: any) {
71
+ return this.service.find(query);
72
+ }
73
+
74
+ @ApiBearerAuth("jwt")
75
+ @Get(':id')
76
+ async findOne(@Param('id') id: string, @Query() query: any) {
77
+ return this.service.findOne(+id, query);
78
+ }
79
+
80
+ @ApiBearerAuth("jwt")
81
+ @Delete('/bulk')
82
+ async deleteMany(@Body() ids: number[]) {
83
+ return this.service.deleteMany(ids);
84
+ }
85
+
86
+ @ApiBearerAuth("jwt")
87
+ @Delete(':id')
88
+ async delete(@Param('id') id: number) {
89
+ return this.service.delete(id);
90
+ }
91
+
92
+
93
+ }
@@ -0,0 +1,128 @@
1
+ import { Controller, Post, Body, Param, UploadedFiles, UseInterceptors, Put, Get, Query, Delete, Patch, InternalServerErrorException, Res } from '@nestjs/common';
2
+ import { AnyFilesInterceptor } from "@nestjs/platform-express";
3
+ import { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';
4
+ import { ImportFormat, ImportTransactionService } from '../services/import-transaction.service';
5
+ import { CreateImportTransactionDto } from '../dtos/create-import-transaction.dto';
6
+ import { UpdateImportTransactionDto } from '../dtos/update-import-transaction.dto';
7
+ import { Response } from 'express';
8
+
9
+ enum ShowSoftDeleted {
10
+ INCLUSIVE = "inclusive",
11
+ EXCLUSIVE = "exclusive",
12
+ }
13
+
14
+ @ApiTags('Solid Core')
15
+ @Controller('import-transaction')
16
+ export class ImportTransactionController {
17
+ constructor(private readonly service: ImportTransactionService) {}
18
+
19
+ @ApiBearerAuth("jwt")
20
+ @Get('/import-template/:modelMetadataId/:format')
21
+ async getImportTemplate(@Param('modelMetadataId') modelMetadataId: number, @Param('format') format: string, @Res() res: Response) {
22
+ const importTemplateFileInfo = await this.service.getImportTemplate(+modelMetadataId, format as ImportFormat);
23
+ if (importTemplateFileInfo.stream === null) {
24
+ throw new InternalServerErrorException("Sample Import template stream is null");
25
+ }
26
+
27
+ // ✅ Set response headers for streaming
28
+ res.setHeader('Content-Disposition', `attachment; filename="${importTemplateFileInfo.fileName}"`);
29
+ res.setHeader('Content-Type', importTemplateFileInfo.mimeType);
30
+ res.setHeader('Access-Control-Expose-Headers', 'Content-Disposition, Content-Type');
31
+ // Pipe the stream to the response as an excel file
32
+ importTemplateFileInfo.stream.pipe(res);
33
+ }
34
+
35
+ @ApiBearerAuth("jwt")
36
+ @Get('/import-instructions/:modelMetadataId')
37
+ async getImportInstructions(@Param('modelMetadataId') modelMetadataId: number) {
38
+ // return this.service.getImportInstructions(modelMetadataId);
39
+ return this.service.getImportInstructions(modelMetadataId);
40
+ }
41
+
42
+ @ApiBearerAuth("jwt")
43
+ @Post()
44
+ @UseInterceptors(AnyFilesInterceptor())
45
+ create(@Body() createDto: CreateImportTransactionDto, @UploadedFiles() files: Array<Express.Multer.File>) {
46
+ return this.service.create(createDto, files);
47
+ }
48
+
49
+ @ApiBearerAuth("jwt")
50
+ @Post('/bulk')
51
+ @UseInterceptors(AnyFilesInterceptor())
52
+ insertMany(@Body() createDtos: CreateImportTransactionDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {
53
+ return this.service.insertMany(createDtos, filesArray);
54
+ }
55
+
56
+
57
+ @ApiBearerAuth("jwt")
58
+ @Put(':id')
59
+ @UseInterceptors(AnyFilesInterceptor())
60
+ update(@Param('id') id: number, @Body() updateDto: UpdateImportTransactionDto, @UploadedFiles() files: Array<Express.Multer.File>) {
61
+ return this.service.update(id, updateDto, files);
62
+ }
63
+
64
+ @ApiBearerAuth("jwt")
65
+ @Patch(':id')
66
+ @UseInterceptors(AnyFilesInterceptor())
67
+ partialUpdate(@Param('id') id: number, @Body() updateDto: UpdateImportTransactionDto, @UploadedFiles() files: Array<Express.Multer.File>) {
68
+ return this.service.update(id, updateDto, files, true);
69
+ }
70
+
71
+ @ApiBearerAuth("jwt")
72
+ @Post('/bulk-recover')
73
+ async recoverMany(@Body() ids: number[]) {
74
+ return this.service.recoverMany(ids);
75
+ }
76
+
77
+ @ApiBearerAuth("jwt")
78
+ @Get('/recover/:id')
79
+ async recover(@Param('id') id: number) {
80
+ return this.service.recover(id);
81
+ }
82
+
83
+ @ApiBearerAuth("jwt")
84
+ @ApiQuery({ name: 'showSoftDeleted', required: false, enum: ShowSoftDeleted })
85
+ @ApiQuery({ name: 'limit', required: false, type: Number })
86
+ @ApiQuery({ name: 'offset', required: false, type: Number })
87
+ @ApiQuery({ name: 'fields', required: false, type: Array })
88
+ @ApiQuery({ name: 'sort', required: false, type: Array })
89
+ @ApiQuery({ name: 'groupBy', required: false, type: Array })
90
+ @ApiQuery({ name: 'populate', required: false, type: Array })
91
+ @ApiQuery({ name: 'populateMedia', required: false, type: Array })
92
+ @ApiQuery({ name: 'filters', required: false, type: Array })
93
+ @Get()
94
+ async findMany(@Query() query: any) {
95
+ return this.service.find(query);
96
+ }
97
+
98
+ @ApiBearerAuth("jwt")
99
+ @Get(':id')
100
+ async findOne(@Param('id') id: string, @Query() query: any) {
101
+ return this.service.findOne(+id, query);
102
+ }
103
+
104
+ @ApiBearerAuth("jwt")
105
+ @Get(':id/import-mapping-info')
106
+ async getImportMappingInfo(@Param('id') id: string) {
107
+ return this.service.getImportMappingInfo(+id);
108
+ }
109
+
110
+ @ApiBearerAuth("jwt")
111
+ @Post(':id/import-mapping')
112
+ async saveImportMapping(@Param('id') id: string) {
113
+ return this.service.saveImportMapping(+id);
114
+ }
115
+
116
+ @ApiBearerAuth("jwt")
117
+ @Delete('/bulk')
118
+ async deleteMany(@Body() ids: number[]) {
119
+ return this.service.deleteMany(ids);
120
+ }
121
+
122
+ @ApiBearerAuth("jwt")
123
+ @Delete(':id')
124
+ async delete(@Param('id') id: number) {
125
+ return this.service.delete(id);
126
+ }
127
+
128
+ }
@@ -0,0 +1,34 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { IsString } from 'class-validator';
3
+ import { IsNotEmpty, IsInt, IsJSON, IsOptional } from 'class-validator';
4
+
5
+ export class CreateImportTransactionErrorLogDto {
6
+ @IsNotEmpty()
7
+ @IsString()
8
+ @ApiProperty()
9
+ importTransactionErrorLogId: string;
10
+ @IsNotEmpty()
11
+ @IsInt()
12
+ @ApiProperty()
13
+ rowNumber: number;
14
+ @IsOptional()
15
+ @IsJSON()
16
+ @ApiProperty()
17
+ rowData: any;
18
+ @IsOptional()
19
+ @IsInt()
20
+ @ApiProperty()
21
+ importTransactionId: number;
22
+ @IsString()
23
+ @IsOptional()
24
+ @ApiProperty()
25
+ importTransactionUserKey: string;
26
+ @IsNotEmpty()
27
+ @IsString()
28
+ @ApiProperty()
29
+ errorMessage: string;
30
+ @IsOptional()
31
+ @IsString()
32
+ @ApiProperty()
33
+ errorTrace: string;
34
+ }
@@ -0,0 +1,50 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { IsString } from 'class-validator';
3
+ import { IsOptional, IsJSON, IsInt, ValidateNested, IsArray } from 'class-validator';
4
+ import { Type } from 'class-transformer';
5
+ import { UpdateImportTransactionErrorLogDto } from 'src/dtos/update-import-transaction-error-log.dto';
6
+
7
+ export class CreateImportTransactionDto {
8
+ @IsOptional()
9
+ @IsString()
10
+ @ApiProperty()
11
+ status: string = "draft";
12
+ @IsOptional()
13
+ @IsString()
14
+ @ApiProperty()
15
+ importTransactionId: string;
16
+ @IsOptional()
17
+ @IsJSON()
18
+ @ApiProperty()
19
+ mapping: any;
20
+ @IsOptional()
21
+ @IsInt()
22
+ @ApiProperty()
23
+ modelMetadataId: number;
24
+ @IsString()
25
+ @IsOptional()
26
+ @ApiProperty()
27
+ modelMetadataUserKey: string;
28
+ @IsOptional()
29
+ @IsInt()
30
+ @ApiProperty()
31
+ moduleMetadataId: number;
32
+ @IsString()
33
+ @IsOptional()
34
+ @ApiProperty()
35
+ moduleMetadataUserKey: string;
36
+ @IsOptional()
37
+ @ApiProperty()
38
+ @IsArray()
39
+ @ValidateNested({ each: true })
40
+ @Type(() => UpdateImportTransactionErrorLogDto)
41
+ importTransactionErrorLog: UpdateImportTransactionErrorLogDto[];
42
+ @IsOptional()
43
+ @IsArray()
44
+ @ApiProperty()
45
+ importTransactionErrorLogIds: number[];
46
+ @IsString()
47
+ @IsOptional()
48
+ @ApiProperty()
49
+ importTransactionErrorLogCommand: string;
50
+ }
@@ -0,0 +1,5 @@
1
+ import { UpdateExportTemplateDto } from "./update-export-template.dto";
2
+
3
+ export class StartExportSyncDto extends UpdateExportTemplateDto {
4
+ filters?: any;
5
+ }
@@ -0,0 +1,66 @@
1
+ import { ApiProperty } from "@nestjs/swagger";
2
+
3
+ export class ImportInstructionsResponseDto {
4
+ standard: StandardImportInstructionsResponseDto;
5
+ @ApiProperty({
6
+ type: [String],
7
+ description: 'List of custom import instructions',
8
+ })
9
+ custom: string[];
10
+ }
11
+
12
+ export class StandardImportInstructionsResponseDto {
13
+ @ApiProperty({
14
+ type: [String],
15
+ description: 'List of required fields for import',
16
+ })
17
+ requiredFields: string[];
18
+ @ApiProperty({
19
+ type: [String],
20
+ description: 'List of date fields for import',
21
+ })
22
+ dateFields: string[];
23
+ @ApiProperty({
24
+ type: [String],
25
+ description: 'List of date-time fields for import',
26
+ })
27
+ dateTimeFields: string[];
28
+ @ApiProperty({
29
+ type: [String],
30
+ description: 'List of number fields for import',
31
+ })
32
+ numberFields: string[];
33
+ @ApiProperty({
34
+ type: [String],
35
+ description: 'List of email fields for import',
36
+ })
37
+ emailFields: string[];
38
+ @ApiProperty({
39
+ type: [Object],
40
+ description: 'List of regex fields for import, each with field name and regex pattern',
41
+ })
42
+ regexFields: RegexFieldInstructionResponseDto[];
43
+ @ApiProperty({
44
+ type: [String],
45
+ description: 'List of JSON fields for import',
46
+ })
47
+ jsonFields: string[];
48
+ @ApiProperty({
49
+ type: [String],
50
+ description: 'List of boolean fields for import',
51
+ })
52
+ booleanFields: string[];
53
+ }
54
+
55
+ export class RegexFieldInstructionResponseDto {
56
+ @ApiProperty({
57
+ type: String,
58
+ description: 'Name of the field',
59
+ })
60
+ fieldName: string;
61
+ @ApiProperty({
62
+ type: String,
63
+ description: 'Regex pattern for the field',
64
+ })
65
+ regexPattern: string;
66
+ }
@@ -0,0 +1,39 @@
1
+ import { IsInt,IsOptional, IsString, IsNotEmpty, IsJSON } from 'class-validator';
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+
4
+ export class UpdateImportTransactionErrorLogDto {
5
+ @IsOptional()
6
+ @IsInt()
7
+ id: number;
8
+ @IsNotEmpty()
9
+ @IsOptional()
10
+ @IsString()
11
+ @ApiProperty()
12
+ importTransactionErrorLogId: string;
13
+ @IsNotEmpty()
14
+ @IsOptional()
15
+ @IsInt()
16
+ @ApiProperty()
17
+ rowNumber: number;
18
+ @IsOptional()
19
+ @IsJSON()
20
+ @ApiProperty()
21
+ rowData: any;
22
+ @IsOptional()
23
+ @IsInt()
24
+ @ApiProperty()
25
+ importTransactionId: number;
26
+ @IsString()
27
+ @IsOptional()
28
+ @ApiProperty()
29
+ importTransactionUserKey: string;
30
+ @IsNotEmpty()
31
+ @IsOptional()
32
+ @IsString()
33
+ @ApiProperty()
34
+ errorMessage: string;
35
+ @IsOptional()
36
+ @IsString()
37
+ @ApiProperty()
38
+ errorTrace: string;
39
+ }
@@ -0,0 +1,52 @@
1
+ import { IsInt,IsOptional, IsString, IsJSON, ValidateNested, IsArray } from 'class-validator';
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+ import { Type } from 'class-transformer';
4
+ import { UpdateImportTransactionErrorLogDto } from 'src/dtos/update-import-transaction-error-log.dto';
5
+
6
+ export class UpdateImportTransactionDto {
7
+ @IsOptional()
8
+ @IsInt()
9
+ id: number;
10
+ @IsOptional()
11
+ @IsString()
12
+ @ApiProperty()
13
+ status: string;
14
+ @IsOptional()
15
+ @IsString()
16
+ @ApiProperty()
17
+ importTransactionId: string;
18
+ @IsOptional()
19
+ @IsJSON()
20
+ @ApiProperty()
21
+ mapping: any;
22
+ @IsOptional()
23
+ @IsInt()
24
+ @ApiProperty()
25
+ modelMetadataId: number;
26
+ @IsString()
27
+ @IsOptional()
28
+ @ApiProperty()
29
+ modelMetadataUserKey: string;
30
+ @IsOptional()
31
+ @IsInt()
32
+ @ApiProperty()
33
+ moduleMetadataId: number;
34
+ @IsString()
35
+ @IsOptional()
36
+ @ApiProperty()
37
+ moduleMetadataUserKey: string;
38
+ @IsOptional()
39
+ @ApiProperty()
40
+ @IsArray()
41
+ @ValidateNested({ each: true })
42
+ @Type(() => UpdateImportTransactionErrorLogDto)
43
+ importTransactionErrorLog: UpdateImportTransactionErrorLogDto[];
44
+ @IsOptional()
45
+ @IsArray()
46
+ @ApiProperty()
47
+ importTransactionErrorLogIds: number[];
48
+ @IsString()
49
+ @IsOptional()
50
+ @ApiProperty()
51
+ importTransactionErrorLogCommand: string;
52
+ }
@@ -17,6 +17,6 @@ export class ExportTransaction extends CommonEntity {
17
17
  @Column({ type: "text", nullable: true })
18
18
  error: string;
19
19
  @Index()
20
- @ManyToOne(() => ExportTemplate, { onDelete: "CASCADE", nullable: false })
20
+ @ManyToOne(() => ExportTemplate, { onDelete: "CASCADE", nullable: true })
21
21
  exportTemplate: ExportTemplate;
22
22
  }
@@ -0,0 +1,22 @@
1
+ import { CommonEntity } from 'src/entities/common.entity'
2
+ import {Entity, Column, Index, JoinColumn, ManyToOne} from 'typeorm';
3
+ import { ImportTransaction } from 'src/entities/import-transaction.entity'
4
+
5
+ @Entity("ss_import_transaction_error_log")
6
+ export class ImportTransactionErrorLog extends CommonEntity {
7
+ @Index({ unique: true })
8
+ @Column({ type: "varchar" })
9
+ importTransactionErrorLogId: string;
10
+ @Column({ type: "integer" })
11
+ rowNumber: number;
12
+ @Column({ type: "text", nullable: true })
13
+ rowData: any;
14
+ @Index()
15
+ @ManyToOne(() => ImportTransaction, { onDelete: "CASCADE", nullable: false })
16
+ @JoinColumn()
17
+ importTransaction: ImportTransaction;
18
+ @Column({ type: "varchar" })
19
+ errorMessage: string;
20
+ @Column({ type: "text", nullable: true })
21
+ errorTrace: string;
22
+ }
@@ -0,0 +1,22 @@
1
+ import { CommonEntity } from 'src/entities/common.entity'
2
+ import {Entity, Column, Index, JoinColumn, ManyToOne, OneToMany} from 'typeorm';
3
+ import { ModelMetadata } from 'src/entities/model-metadata.entity';
4
+ import { ImportTransactionErrorLog } from 'src/entities/import-transaction-error-log.entity'
5
+
6
+ @Entity("ss_import_transaction")
7
+ export class ImportTransaction extends CommonEntity {
8
+ @Index()
9
+ @Column({ type: "varchar", nullable: true, default: "draft" })
10
+ status: string = "draft";
11
+ @Index({ unique: true })
12
+ @Column({ type: "varchar", nullable: true })
13
+ importTransactionId: string;
14
+ @Column({ type: "text", nullable: true })
15
+ mapping: any;
16
+ @Index()
17
+ @ManyToOne(() => ModelMetadata, { onDelete: "CASCADE", nullable: true })
18
+ @JoinColumn()
19
+ modelMetadata: ModelMetadata;
20
+ @OneToMany(() => ImportTransactionErrorLog, importTransactionErrorLog => importTransactionErrorLog.importTransaction, { cascade: true })
21
+ importTransactionErrorLog: ImportTransactionErrorLog[];
22
+ }
package/src/index.ts CHANGED
@@ -113,6 +113,8 @@ export * from './entities/chatter-message.entity'
113
113
  export * from './entities/chatter-message-details.entity'
114
114
  export * from './entities/export-template.entity'
115
115
  export * from './entities/export-transaction.entity'
116
+ export * from './entities/import-transaction.entity'
117
+ export * from './entities/import-transaction-error-log.entity'
116
118
 
117
119
  export * from './enums/auth-type.enum'
118
120