@solidstarters/solid-core 1.2.47 → 1.2.48
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.
- package/dist/controllers/email-template.controller.d.ts +25 -7
- package/dist/controllers/email-template.controller.d.ts.map +1 -1
- package/dist/controllers/email-template.controller.js +70 -36
- package/dist/controllers/email-template.controller.js.map +1 -1
- package/dist/controllers/google-authentication.controller.d.ts +0 -1
- package/dist/controllers/google-authentication.controller.d.ts.map +1 -1
- package/dist/controllers/sms-template.controller.d.ts +25 -7
- package/dist/controllers/sms-template.controller.d.ts.map +1 -1
- package/dist/controllers/sms-template.controller.js +71 -36
- package/dist/controllers/sms-template.controller.js.map +1 -1
- package/dist/controllers/user-view-metadata.controller.d.ts +2 -1
- package/dist/controllers/user-view-metadata.controller.d.ts.map +1 -1
- package/dist/controllers/user-view-metadata.controller.js +5 -3
- package/dist/controllers/user-view-metadata.controller.js.map +1 -1
- package/dist/controllers/view-metadata.controller.d.ts +2 -1
- package/dist/controllers/view-metadata.controller.d.ts.map +1 -1
- package/dist/controllers/view-metadata.controller.js +5 -3
- package/dist/controllers/view-metadata.controller.js.map +1 -1
- package/dist/dtos/create-email-attachment.dto.d.ts.map +1 -1
- package/dist/dtos/create-email-attachment.dto.js +8 -1
- package/dist/dtos/create-email-attachment.dto.js.map +1 -1
- package/dist/dtos/create-email-template.dto.d.ts +1 -0
- package/dist/dtos/create-email-template.dto.d.ts.map +1 -1
- package/dist/dtos/create-email-template.dto.js +26 -3
- package/dist/dtos/create-email-template.dto.js.map +1 -1
- package/dist/dtos/create-sms-template.dto.d.ts +1 -0
- package/dist/dtos/create-sms-template.dto.d.ts.map +1 -1
- package/dist/dtos/create-sms-template.dto.js +29 -2
- package/dist/dtos/create-sms-template.dto.js.map +1 -1
- package/dist/dtos/update-email-attachment.dto.d.ts +8 -0
- package/dist/dtos/update-email-attachment.dto.d.ts.map +1 -0
- package/dist/dtos/update-email-attachment.dto.js +58 -0
- package/dist/dtos/update-email-attachment.dto.js.map +1 -0
- package/dist/dtos/update-email-template.dto.d.ts +7 -0
- package/dist/dtos/update-email-template.dto.d.ts.map +1 -1
- package/dist/dtos/update-email-template.dto.js +61 -1
- package/dist/dtos/update-email-template.dto.js.map +1 -1
- package/dist/dtos/update-sms-template.dto.d.ts +7 -0
- package/dist/dtos/update-sms-template.dto.d.ts.map +1 -1
- package/dist/dtos/update-sms-template.dto.js +57 -1
- package/dist/dtos/update-sms-template.dto.js.map +1 -1
- package/dist/entities/email-attachment.entity.d.ts.map +1 -1
- package/dist/entities/email-attachment.entity.js +6 -5
- package/dist/entities/email-attachment.entity.js.map +1 -1
- package/dist/entities/email-template.entity.d.ts +1 -0
- package/dist/entities/email-template.entity.d.ts.map +1 -1
- package/dist/entities/email-template.entity.js +17 -7
- package/dist/entities/email-template.entity.js.map +1 -1
- package/dist/entities/sms-template.entity.d.ts +1 -0
- package/dist/entities/sms-template.entity.d.ts.map +1 -1
- package/dist/entities/sms-template.entity.js +16 -7
- package/dist/entities/sms-template.entity.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +640 -9
- package/dist/services/authentication.service.d.ts +0 -1
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +0 -1
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/email-template.service.d.ts +22 -12
- package/dist/services/email-template.service.d.ts.map +1 -1
- package/dist/services/email-template.service.js +37 -46
- package/dist/services/email-template.service.js.map +1 -1
- package/dist/services/sms-template.service.d.ts +23 -13
- package/dist/services/sms-template.service.d.ts.map +1 -1
- package/dist/services/sms-template.service.js +41 -49
- package/dist/services/sms-template.service.js.map +1 -1
- package/dist/services/user-view-metadata.service.d.ts +2 -1
- package/dist/services/user-view-metadata.service.d.ts.map +1 -1
- package/dist/services/user-view-metadata.service.js +3 -3
- package/dist/services/user-view-metadata.service.js.map +1 -1
- package/dist/services/view-metadata.service.d.ts +1 -1
- package/dist/services/view-metadata.service.d.ts.map +1 -1
- package/dist/services/view-metadata.service.js +4 -4
- package/dist/services/view-metadata.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/controllers/email-template.controller.ts +57 -38
- package/src/controllers/sms-template.controller.ts +58 -37
- package/src/controllers/user-view-metadata.controller.ts +4 -2
- package/src/controllers/view-metadata.controller.ts +18 -16
- package/src/dtos/create-email-attachment.dto.ts +8 -6
- package/src/dtos/create-email-template.dto.ts +22 -11
- package/src/dtos/create-sms-template.dto.ts +22 -8
- package/src/dtos/update-email-attachment.dto.ts +36 -0
- package/src/dtos/update-email-template.dto.ts +40 -2
- package/src/dtos/update-sms-template.dto.ts +42 -2
- package/src/entities/email-attachment.entity.ts +6 -10
- package/src/entities/email-template.entity.ts +12 -16
- package/src/entities/sms-template.entity.ts +11 -14
- package/src/seeders/seed-data/solid-core-metadata.json +640 -9
- package/src/services/authentication.service.ts +1 -1
- package/src/services/email-template.service.ts +27 -54
- package/src/services/sms-template.service.ts +32 -55
- package/src/services/user-view-metadata.service.ts +4 -3
- package/src/services/view-metadata.service.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidstarters/solid-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.48",
|
|
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",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Body, Controller, Delete, Get, Header, Param, Patch, Post, Query } from '@nestjs/common';
|
|
1
|
+
import { Body, Controller, Delete, Get, Header, Param, Patch, Post, Put, Query, UploadedFiles, UseInterceptors } from '@nestjs/common';
|
|
2
2
|
import { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';
|
|
3
3
|
import { PaginationQueryDto } from 'src/dtos/pagination-query.dto';
|
|
4
4
|
import { Roles } from 'src/decorators/roles.decorator';
|
|
@@ -12,48 +12,67 @@ import { Public } from 'src/decorators/public.decorator';
|
|
|
12
12
|
// TODO: esInterop not working somehow, defaulted to using the require syntax to import Mailgen. Figure a better way to do this.
|
|
13
13
|
// import { Mailgen } from 'mailgen';
|
|
14
14
|
import Mailgen = require('mailgen');
|
|
15
|
+
import { AnyFilesInterceptor } from '@nestjs/platform-express';
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
@Controller('email-
|
|
18
|
+
@Controller('email-template')
|
|
18
19
|
@ApiTags("Common")
|
|
19
20
|
export class EmailTemplateController {
|
|
20
|
-
constructor(private readonly
|
|
21
|
-
|
|
22
|
-
@ApiBearerAuth("jwt")
|
|
23
|
-
@Roles('Admin')
|
|
24
|
-
@Post()
|
|
25
|
-
create(@Body() dto: CreateEmailTemplateDto) {
|
|
26
|
-
return this.emailTemplateService.create(dto);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@ApiBearerAuth("jwt")
|
|
30
|
-
@Roles('Admin')
|
|
31
|
-
@ApiQuery({ name: 'limit', required: false, type: Number })
|
|
32
|
-
@ApiQuery({ name: 'offset', required: false, type: Number })
|
|
33
|
-
@Get()
|
|
34
|
-
findAll(@Query() paginationQuery: PaginationQueryDto) {
|
|
35
|
-
return this.emailTemplateService.findAll(paginationQuery);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@ApiBearerAuth("jwt")
|
|
39
|
-
@Roles('Admin')
|
|
40
|
-
@Get(':id')
|
|
41
|
-
findOne(@Param('id') id: string) {
|
|
42
|
-
return this.emailTemplateService.findOne(+id);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@ApiBearerAuth("jwt")
|
|
46
|
-
@Patch(':id')
|
|
47
|
-
update(@Param('id') id: string, @Body() dto: UpdateEmailTemplateDto) {
|
|
48
|
-
return this.emailTemplateService.update(+id, dto);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@ApiBearerAuth("jwt")
|
|
52
|
-
@Delete(':id')
|
|
53
|
-
async delete(@Param('id') id: number) {
|
|
54
|
-
return this.emailTemplateService.remove(+id);
|
|
55
|
-
}
|
|
21
|
+
constructor(private readonly service: EmailTemplateService) { }
|
|
56
22
|
|
|
23
|
+
@Public()
|
|
24
|
+
@Post()
|
|
25
|
+
@UseInterceptors(AnyFilesInterceptor())
|
|
26
|
+
create(@Body() createDto: CreateEmailTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {
|
|
27
|
+
return this.service.create(createDto, files);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Public()
|
|
31
|
+
@Post('/bulk')
|
|
32
|
+
@UseInterceptors(AnyFilesInterceptor())
|
|
33
|
+
insertMany(@Body() createDtos: CreateEmailTemplateDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {
|
|
34
|
+
return this.service.insertMany(createDtos, filesArray);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Public()
|
|
38
|
+
@Put(':id')
|
|
39
|
+
@UseInterceptors(AnyFilesInterceptor())
|
|
40
|
+
update(@Param('id') id: number, @Body() updateDto: UpdateEmailTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {
|
|
41
|
+
return this.service.update(id, updateDto, files);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Public()
|
|
45
|
+
@ApiQuery({ name: 'showSoftDeleted', required: false, type: Boolean })
|
|
46
|
+
@ApiQuery({ name: 'showOnlySoftDeleted', required: false, type: Boolean })
|
|
47
|
+
@ApiQuery({ name: 'limit', required: false, type: Number })
|
|
48
|
+
@ApiQuery({ name: 'offset', required: false, type: Number })
|
|
49
|
+
@ApiQuery({ name: 'fields', required: false, type: Array })
|
|
50
|
+
@ApiQuery({ name: 'sort', required: false, type: Array })
|
|
51
|
+
@ApiQuery({ name: 'groupBy', required: false, type: Array })
|
|
52
|
+
@ApiQuery({ name: 'populate', required: false, type: Array })
|
|
53
|
+
@ApiQuery({ name: 'populateMedia', required: false, type: Array })
|
|
54
|
+
@ApiQuery({ name: 'filters', required: false, type: Array })
|
|
55
|
+
@Get()
|
|
56
|
+
async findMany(@Query() query: any) {
|
|
57
|
+
return this.service.find(query);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@Public()
|
|
61
|
+
@Get(':id')
|
|
62
|
+
async findOne(@Param('id') id: string, @Query() query: any) {
|
|
63
|
+
return this.service.findOne(+id, query);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@Delete('/bulk')
|
|
67
|
+
async deleteMany(@Body() ids: number[]) {
|
|
68
|
+
return this.service.deleteMany(ids);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Public()
|
|
72
|
+
@Delete(':id')
|
|
73
|
+
async delete(@Param('id') id: number) {
|
|
74
|
+
return this.service.delete(id);
|
|
75
|
+
}
|
|
57
76
|
// /api/email-templates/mailgen-template/otp-template
|
|
58
77
|
// @ApiBearerAuth("jwt")
|
|
59
78
|
// @Roles('Admin')
|
|
@@ -1,49 +1,70 @@
|
|
|
1
|
-
import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from '@nestjs/common';
|
|
1
|
+
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query, UploadedFiles, UseInterceptors } from '@nestjs/common';
|
|
2
2
|
import { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';
|
|
3
3
|
import { PaginationQueryDto } from 'src/dtos/pagination-query.dto';
|
|
4
4
|
import { Roles } from 'src/decorators/roles.decorator';
|
|
5
5
|
import { SmsTemplateService } from '../services/sms-template.service';
|
|
6
6
|
import { CreateSmsTemplateDto } from '../dtos/create-sms-template.dto';
|
|
7
7
|
import { UpdateSmsTemplateDto } from '../dtos/update-sms-template.dto';
|
|
8
|
+
import { Public } from 'src/decorators/public.decorator';
|
|
9
|
+
import { AnyFilesInterceptor } from '@nestjs/platform-express';
|
|
8
10
|
|
|
9
11
|
|
|
10
|
-
@Controller('sms-
|
|
12
|
+
@Controller('sms-template')
|
|
11
13
|
@ApiTags("Common")
|
|
12
14
|
export class SmsTemplateController {
|
|
13
|
-
constructor(private readonly
|
|
15
|
+
constructor(private readonly service: SmsTemplateService) { }
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
17
|
+
@Public()
|
|
18
|
+
@Post()
|
|
19
|
+
@UseInterceptors(AnyFilesInterceptor())
|
|
20
|
+
create(@Body() createDto: CreateSmsTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {
|
|
21
|
+
return this.service.create(createDto, files);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Public()
|
|
25
|
+
@Post('/bulk')
|
|
26
|
+
@UseInterceptors(AnyFilesInterceptor())
|
|
27
|
+
insertMany(@Body() createDtos: CreateSmsTemplateDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {
|
|
28
|
+
return this.service.insertMany(createDtos, filesArray);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Public()
|
|
32
|
+
@Put(':id')
|
|
33
|
+
@UseInterceptors(AnyFilesInterceptor())
|
|
34
|
+
update(@Param('id') id: number, @Body() updateDto: UpdateSmsTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {
|
|
35
|
+
return this.service.update(id, updateDto, files);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@Public()
|
|
39
|
+
@ApiQuery({ name: 'showSoftDeleted', required: false, type: Boolean })
|
|
40
|
+
@ApiQuery({ name: 'showOnlySoftDeleted', required: false, type: Boolean })
|
|
41
|
+
@ApiQuery({ name: 'limit', required: false, type: Number })
|
|
42
|
+
@ApiQuery({ name: 'offset', required: false, type: Number })
|
|
43
|
+
@ApiQuery({ name: 'fields', required: false, type: Array })
|
|
44
|
+
@ApiQuery({ name: 'sort', required: false, type: Array })
|
|
45
|
+
@ApiQuery({ name: 'groupBy', required: false, type: Array })
|
|
46
|
+
@ApiQuery({ name: 'populate', required: false, type: Array })
|
|
47
|
+
@ApiQuery({ name: 'populateMedia', required: false, type: Array })
|
|
48
|
+
@ApiQuery({ name: 'filters', required: false, type: Array })
|
|
49
|
+
@Get()
|
|
50
|
+
async findMany(@Query() query: any) {
|
|
51
|
+
return this.service.find(query);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@Public()
|
|
55
|
+
@Get(':id')
|
|
56
|
+
async findOne(@Param('id') id: string, @Query() query: any) {
|
|
57
|
+
return this.service.findOne(+id, query);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@Delete('/bulk')
|
|
61
|
+
async deleteMany(@Body() ids: number[]) {
|
|
62
|
+
return this.service.deleteMany(ids);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Public()
|
|
66
|
+
@Delete(':id')
|
|
67
|
+
async delete(@Param('id') id: number) {
|
|
68
|
+
return this.service.delete(id);
|
|
69
|
+
}
|
|
49
70
|
}
|
|
@@ -5,6 +5,8 @@ import { UserViewMetadataService } from '../services/user-view-metadata.service'
|
|
|
5
5
|
import { CreateUserViewMetadataDto } from '../dtos/create-user-view-metadata.dto';
|
|
6
6
|
import { UpdateUserViewMetadataDto } from '../dtos/update-user-view-metadata.dto';
|
|
7
7
|
import { UpsertUserViewMetadataDto } from 'src/dtos/upsert-user-view-metadata.dto';
|
|
8
|
+
import { ActiveUser } from 'src/decorators/active-user.decorator';
|
|
9
|
+
import { ActiveUserData } from 'src/interfaces/active-user-data.interface';
|
|
8
10
|
|
|
9
11
|
enum ShowSoftDeleted {
|
|
10
12
|
INCLUSIVE = "inclusive",
|
|
@@ -92,8 +94,8 @@ export class UserViewMetadataController {
|
|
|
92
94
|
|
|
93
95
|
@ApiBearerAuth("jwt")
|
|
94
96
|
@Post('/upsert')
|
|
95
|
-
async upsert(@Body() query: UpsertUserViewMetadataDto) {
|
|
96
|
-
return this.service.upsert(query);
|
|
97
|
+
async upsert(@Body() query: UpsertUserViewMetadataDto, @ActiveUser() activeUser: ActiveUserData) {
|
|
98
|
+
return this.service.upsert(query, activeUser);
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
}
|
|
@@ -6,6 +6,8 @@ import { CreateViewMetadataDto } from '../dtos/create-view-metadata.dto';
|
|
|
6
6
|
import { UpdateViewMetadataDto } from '../dtos/update-view-metadata.dto';
|
|
7
7
|
import { SolidRequestContextDecorator } from 'src/decorators/solid-request-context.decorator';
|
|
8
8
|
import { SolidRequestContextDto } from 'src/dtos/solid-request-context.dto';
|
|
9
|
+
import { ActiveUser } from 'src/decorators/active-user.decorator';
|
|
10
|
+
import { ActiveUserData } from 'src/interfaces/active-user-data.interface';
|
|
9
11
|
|
|
10
12
|
@ApiTags('App')
|
|
11
13
|
@Controller('view-metadata') //FIXME: Change this to the model plural name
|
|
@@ -15,23 +17,23 @@ export class ViewMetadataController {
|
|
|
15
17
|
@ApiBearerAuth("jwt")
|
|
16
18
|
@Post()
|
|
17
19
|
@UseInterceptors(AnyFilesInterceptor())
|
|
18
|
-
create(@Body() createDto: CreateViewMetadataDto, @UploadedFiles() files: Array<Express.Multer.File
|
|
19
|
-
return this.service.create(createDto, files,solidRequestContext);
|
|
20
|
+
create(@Body() createDto: CreateViewMetadataDto, @UploadedFiles() files: Array<Express.Multer.File>, @SolidRequestContextDecorator() solidRequestContext: SolidRequestContextDto) {
|
|
21
|
+
return this.service.create(createDto, files, solidRequestContext);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
@ApiBearerAuth("jwt")
|
|
23
25
|
@Post('/bulk')
|
|
24
26
|
@UseInterceptors(AnyFilesInterceptor())
|
|
25
|
-
insertMany(@Body() createDtos: CreateViewMetadataDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []
|
|
26
|
-
return this.service.insertMany(createDtos, filesArray,solidRequestContext);
|
|
27
|
+
insertMany(@Body() createDtos: CreateViewMetadataDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = [], @SolidRequestContextDecorator() solidRequestContext: SolidRequestContextDto) {
|
|
28
|
+
return this.service.insertMany(createDtos, filesArray, solidRequestContext);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
@ApiBearerAuth("jwt")
|
|
31
33
|
@Put(':id')
|
|
32
34
|
@UseInterceptors(AnyFilesInterceptor())
|
|
33
|
-
update(@Param('id') id: number, @Body() updateDto: UpdateViewMetadataDto, @UploadedFiles() files: Array<Express.Multer.File
|
|
34
|
-
return this.service.update(id, updateDto, files,false,solidRequestContext);
|
|
35
|
+
update(@Param('id') id: number, @Body() updateDto: UpdateViewMetadataDto, @UploadedFiles() files: Array<Express.Multer.File>, @SolidRequestContextDecorator() solidRequestContext: SolidRequestContextDto) {
|
|
36
|
+
return this.service.update(id, updateDto, files, false, solidRequestContext);
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
@ApiBearerAuth("jwt")
|
|
@@ -46,31 +48,31 @@ export class ViewMetadataController {
|
|
|
46
48
|
@ApiQuery({ name: 'populateMedia', required: false, type: Array })
|
|
47
49
|
@ApiQuery({ name: 'filters', required: false, type: Array })
|
|
48
50
|
@Get()
|
|
49
|
-
async findMany(@Query() query: any
|
|
50
|
-
return this.service.find(query,solidRequestContext);
|
|
51
|
+
async findMany(@Query() query: any, @SolidRequestContextDecorator() solidRequestContext: SolidRequestContextDto) {
|
|
52
|
+
return this.service.find(query, solidRequestContext);
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
@ApiBearerAuth("jwt")
|
|
54
56
|
@Get(':id')
|
|
55
|
-
async findOne(@Param('id') id: string, @Query() query: any
|
|
56
|
-
return this.service.findOne(+id, query,solidRequestContext);
|
|
57
|
+
async findOne(@Param('id') id: string, @Query() query: any, @SolidRequestContextDecorator() solidRequestContext: SolidRequestContextDto) {
|
|
58
|
+
return this.service.findOne(+id, query, solidRequestContext);
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
@Delete('/bulk')
|
|
60
|
-
async deleteMany(@Body() ids: number[]
|
|
61
|
-
return this.service.deleteMany(ids,solidRequestContext);
|
|
62
|
+
async deleteMany(@Body() ids: number[], @SolidRequestContextDecorator() solidRequestContext: SolidRequestContextDto) {
|
|
63
|
+
return this.service.deleteMany(ids, solidRequestContext);
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
@ApiBearerAuth("jwt")
|
|
65
67
|
@Delete(':id')
|
|
66
|
-
async delete(@Param('id') id: number
|
|
67
|
-
return this.service.delete(id,solidRequestContext);
|
|
68
|
+
async delete(@Param('id') id: number, @SolidRequestContextDecorator() solidRequestContext: SolidRequestContextDto) {
|
|
69
|
+
return this.service.delete(id, solidRequestContext);
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
@ApiBearerAuth("jwt")
|
|
71
73
|
@Get('/custom/layout')
|
|
72
|
-
getLayout(@Query() query: any) {
|
|
73
|
-
return this.service.getLayout(query);
|
|
74
|
+
getLayout(@Query() query: any, @ActiveUser() activeUser: ActiveUserData) {
|
|
75
|
+
return this.service.getLayout(query, activeUser);
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
|
1
|
+
import { IsInt, IsNotEmpty, IsOptional, IsString, Matches } from "class-validator";
|
|
2
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
3
|
|
|
3
4
|
export class CreateEmailAttachmentDto {
|
|
4
5
|
@IsNotEmpty()
|
|
6
|
+
@Matches(/[a-z]+(-[a-z]+)*/)
|
|
5
7
|
@IsString()
|
|
8
|
+
@ApiProperty()
|
|
6
9
|
name: string;
|
|
7
|
-
|
|
8
10
|
@IsNotEmpty()
|
|
9
11
|
@IsString()
|
|
12
|
+
@ApiProperty()
|
|
10
13
|
displayName: string;
|
|
11
|
-
|
|
12
14
|
@IsOptional()
|
|
13
15
|
@IsString()
|
|
16
|
+
@ApiProperty()
|
|
14
17
|
relativePath: string;
|
|
15
|
-
|
|
16
18
|
@IsOptional()
|
|
17
19
|
@IsString()
|
|
20
|
+
@ApiProperty()
|
|
18
21
|
url: string;
|
|
19
|
-
|
|
20
22
|
@IsOptional()
|
|
21
23
|
@IsString()
|
|
24
|
+
@ApiProperty()
|
|
22
25
|
template: string;
|
|
23
|
-
|
|
24
26
|
@IsOptional()
|
|
25
27
|
@IsInt()
|
|
26
28
|
emailTemplateId: number;
|
|
@@ -1,30 +1,41 @@
|
|
|
1
|
-
import { IsArray, IsBoolean, IsEmail, IsNotEmpty, IsOptional, MaxLength, MinLength, ValidateNested } from 'class-validator';
|
|
1
|
+
import { IsArray, IsBoolean, IsEmail, IsNotEmpty, IsOptional, MaxLength, MinLength, ValidateNested, Matches, IsString } from 'class-validator';
|
|
2
2
|
import { CreateEmailAttachmentDto } from './create-email-attachment.dto';
|
|
3
3
|
import { Type } from 'class-transformer';
|
|
4
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
4
5
|
|
|
5
6
|
export class CreateEmailTemplateDto {
|
|
6
7
|
@IsNotEmpty()
|
|
8
|
+
@Matches(/[a-z]+(-[a-z]+)*/)
|
|
9
|
+
@IsString()
|
|
10
|
+
@ApiProperty()
|
|
7
11
|
name: string;
|
|
8
|
-
|
|
9
12
|
@IsNotEmpty()
|
|
13
|
+
@IsString()
|
|
14
|
+
@ApiProperty()
|
|
10
15
|
displayName: string;
|
|
11
|
-
|
|
12
16
|
@IsNotEmpty()
|
|
17
|
+
@IsString()
|
|
18
|
+
@ApiProperty()
|
|
13
19
|
body: string;
|
|
14
|
-
|
|
15
|
-
@IsNotEmpty()
|
|
16
|
-
@MaxLength(128)
|
|
17
|
-
subject: string;
|
|
18
|
-
|
|
19
20
|
@IsNotEmpty()
|
|
21
|
+
@IsString()
|
|
22
|
+
@ApiProperty()
|
|
23
|
+
subject: string = "{}";
|
|
24
|
+
@IsOptional()
|
|
25
|
+
@IsString()
|
|
26
|
+
@ApiProperty()
|
|
20
27
|
description: string;
|
|
21
|
-
|
|
28
|
+
@IsOptional()
|
|
22
29
|
@IsBoolean()
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
@ApiProperty()
|
|
31
|
+
active: boolean = true;
|
|
25
32
|
@IsOptional()
|
|
26
33
|
@IsArray()
|
|
27
34
|
@ValidateNested({ each: true })
|
|
28
35
|
@Type(() => CreateEmailAttachmentDto)
|
|
29
36
|
attachments: CreateEmailAttachmentDto[];
|
|
37
|
+
@IsOptional()
|
|
38
|
+
@IsString()
|
|
39
|
+
@ApiProperty()
|
|
40
|
+
type: string;
|
|
30
41
|
}
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
import { IsEmail, IsNotEmpty, IsOptional, MaxLength, MinLength } from 'class-validator';
|
|
1
|
+
import { IsEmail, IsNotEmpty, IsOptional, MaxLength, MinLength, IsString, Matches, IsBoolean } from 'class-validator';
|
|
2
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
3
|
|
|
3
4
|
export class CreateSmsTemplateDto {
|
|
4
5
|
@IsNotEmpty()
|
|
6
|
+
@Matches(/[a-z]+(-[a-z]+)*/)
|
|
7
|
+
@IsString()
|
|
8
|
+
@ApiProperty()
|
|
5
9
|
name: string;
|
|
6
|
-
|
|
7
10
|
@IsNotEmpty()
|
|
11
|
+
@IsString()
|
|
12
|
+
@ApiProperty()
|
|
8
13
|
displayName: string;
|
|
9
|
-
|
|
10
14
|
@IsOptional()
|
|
15
|
+
@IsString()
|
|
16
|
+
@ApiProperty()
|
|
11
17
|
body: string;
|
|
12
|
-
|
|
13
18
|
@IsOptional()
|
|
19
|
+
@IsString()
|
|
20
|
+
@ApiProperty()
|
|
14
21
|
smsProviderTemplateId: string;
|
|
15
|
-
|
|
16
|
-
@
|
|
22
|
+
@IsOptional()
|
|
23
|
+
@IsString()
|
|
24
|
+
@ApiProperty()
|
|
17
25
|
description: string;
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
@IsOptional()
|
|
27
|
+
@IsBoolean()
|
|
28
|
+
@ApiProperty()
|
|
29
|
+
active: boolean = true;
|
|
30
|
+
@IsOptional()
|
|
31
|
+
@IsString()
|
|
32
|
+
@ApiProperty()
|
|
33
|
+
type: string;
|
|
20
34
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsString } from 'class-validator';
|
|
3
|
+
import { Matches } from 'class-validator';
|
|
4
|
+
import { IsOptional } from 'class-validator';
|
|
5
|
+
import { IsNotEmpty } from 'class-validator';
|
|
6
|
+
export class UpdateEmailAttachmentDto {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@IsNotEmpty()
|
|
10
|
+
@IsOptional()
|
|
11
|
+
@Matches(/[a-z]+(-[a-z]+)*/)
|
|
12
|
+
@IsString()
|
|
13
|
+
@ApiProperty()
|
|
14
|
+
name: string;
|
|
15
|
+
|
|
16
|
+
@IsNotEmpty()
|
|
17
|
+
@IsOptional()
|
|
18
|
+
@IsString()
|
|
19
|
+
@ApiProperty()
|
|
20
|
+
displayName: string;
|
|
21
|
+
|
|
22
|
+
@IsOptional()
|
|
23
|
+
@IsString()
|
|
24
|
+
@ApiProperty()
|
|
25
|
+
relativePath: string;
|
|
26
|
+
|
|
27
|
+
@IsOptional()
|
|
28
|
+
@IsString()
|
|
29
|
+
@ApiProperty()
|
|
30
|
+
url: string;
|
|
31
|
+
|
|
32
|
+
@IsOptional()
|
|
33
|
+
@IsString()
|
|
34
|
+
@ApiProperty()
|
|
35
|
+
template: string;
|
|
36
|
+
}
|
|
@@ -1,4 +1,42 @@
|
|
|
1
|
-
import { PartialType } from '@nestjs/swagger';
|
|
1
|
+
import { PartialType, ApiProperty } from '@nestjs/swagger';
|
|
2
2
|
import { CreateEmailTemplateDto } from './create-email-template.dto';
|
|
3
|
+
import { IsString } from 'class-validator';
|
|
4
|
+
import { Matches } from 'class-validator';
|
|
5
|
+
import { IsOptional } from 'class-validator';
|
|
6
|
+
import { IsNotEmpty, IsBoolean } from 'class-validator';
|
|
3
7
|
|
|
4
|
-
export class UpdateEmailTemplateDto extends PartialType(CreateEmailTemplateDto) {
|
|
8
|
+
export class UpdateEmailTemplateDto extends PartialType(CreateEmailTemplateDto) {
|
|
9
|
+
@IsNotEmpty()
|
|
10
|
+
@IsOptional()
|
|
11
|
+
@Matches(/[a-z]+(-[a-z]+)*/)
|
|
12
|
+
@IsString()
|
|
13
|
+
@ApiProperty()
|
|
14
|
+
name: string;
|
|
15
|
+
@IsNotEmpty()
|
|
16
|
+
@IsOptional()
|
|
17
|
+
@IsString()
|
|
18
|
+
@ApiProperty()
|
|
19
|
+
displayName: string;
|
|
20
|
+
@IsNotEmpty()
|
|
21
|
+
@IsOptional()
|
|
22
|
+
@IsString()
|
|
23
|
+
@ApiProperty()
|
|
24
|
+
body: string;
|
|
25
|
+
@IsOptional()
|
|
26
|
+
@IsString()
|
|
27
|
+
@ApiProperty()
|
|
28
|
+
type: string;
|
|
29
|
+
@IsNotEmpty()
|
|
30
|
+
@IsOptional()
|
|
31
|
+
@IsString()
|
|
32
|
+
@ApiProperty()
|
|
33
|
+
subject: string;
|
|
34
|
+
@IsOptional()
|
|
35
|
+
@IsString()
|
|
36
|
+
@ApiProperty()
|
|
37
|
+
description: string;
|
|
38
|
+
@IsOptional()
|
|
39
|
+
@IsBoolean()
|
|
40
|
+
@ApiProperty()
|
|
41
|
+
active: boolean;
|
|
42
|
+
} { }
|
|
@@ -1,4 +1,44 @@
|
|
|
1
|
-
import { PartialType } from '@nestjs/swagger';
|
|
1
|
+
import { PartialType, ApiProperty } from '@nestjs/swagger';
|
|
2
2
|
import { CreateSmsTemplateDto } from './create-sms-template.dto';
|
|
3
|
+
import { IsString } from 'class-validator';
|
|
4
|
+
import { IsOptional, Matches, IsNotEmpty, IsBoolean } from 'class-validator';
|
|
3
5
|
|
|
4
|
-
export class UpdateSmsTemplateDto extends PartialType(CreateSmsTemplateDto) {
|
|
6
|
+
export class UpdateSmsTemplateDto extends PartialType(CreateSmsTemplateDto) {
|
|
7
|
+
@IsOptional()
|
|
8
|
+
@IsString()
|
|
9
|
+
@ApiProperty()
|
|
10
|
+
type: string;
|
|
11
|
+
|
|
12
|
+
@IsNotEmpty()
|
|
13
|
+
@IsOptional()
|
|
14
|
+
@Matches(/[a-z]+(-[a-z]+)*/)
|
|
15
|
+
@IsString()
|
|
16
|
+
@ApiProperty()
|
|
17
|
+
name: string;
|
|
18
|
+
|
|
19
|
+
@IsOptional()
|
|
20
|
+
@IsString()
|
|
21
|
+
@ApiProperty()
|
|
22
|
+
smsProviderTemplateId: string;
|
|
23
|
+
|
|
24
|
+
@IsNotEmpty()
|
|
25
|
+
@IsOptional()
|
|
26
|
+
@IsString()
|
|
27
|
+
@ApiProperty()
|
|
28
|
+
displayName: string;
|
|
29
|
+
|
|
30
|
+
@IsOptional()
|
|
31
|
+
@IsString()
|
|
32
|
+
@ApiProperty()
|
|
33
|
+
body: string;
|
|
34
|
+
|
|
35
|
+
@IsOptional()
|
|
36
|
+
@IsString()
|
|
37
|
+
@ApiProperty()
|
|
38
|
+
description: string;
|
|
39
|
+
|
|
40
|
+
@IsOptional()
|
|
41
|
+
@IsBoolean()
|
|
42
|
+
@ApiProperty()
|
|
43
|
+
active: boolean;
|
|
44
|
+
} { }
|
|
@@ -5,21 +5,17 @@ import { IndentLogger } from "@angular-devkit/core/src/logger";
|
|
|
5
5
|
|
|
6
6
|
@Entity("ss_email_attachment")
|
|
7
7
|
export class EmailAttachment extends CommonEntity {
|
|
8
|
-
@
|
|
8
|
+
@Index({ unique: true })
|
|
9
|
+
@Column({ name: "name", type: "varchar" })
|
|
9
10
|
name: string;
|
|
10
|
-
|
|
11
|
-
@Column()
|
|
11
|
+
@Column({ name: "display_name", type: "varchar" })
|
|
12
12
|
displayName: string;
|
|
13
|
-
|
|
14
|
-
@Column({ nullable: true })
|
|
13
|
+
@Column({ name: "relativePath", type: "varchar", nullable: true })
|
|
15
14
|
relativePath: string; // This is the path relative to the email service being used. For e.g if the attahchment is uploaded in the media manager of elastic email service
|
|
16
|
-
|
|
17
|
-
@Column({ nullable: true })
|
|
15
|
+
@Column({ name: "url", type: "varchar", nullable: true })
|
|
18
16
|
url: string;
|
|
19
|
-
|
|
20
|
-
@Column({ nullable: true })
|
|
17
|
+
@Column({ name: "template", type: "text", nullable: true })
|
|
21
18
|
template: string;
|
|
22
|
-
|
|
23
19
|
@Index()
|
|
24
20
|
@ManyToOne(() => EmailTemplate, (template) => template.attachments, { onDelete: 'CASCADE' })
|
|
25
21
|
@JoinColumn()
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity';
|
|
2
|
-
import { Column, Entity, OneToMany } from 'typeorm';
|
|
2
|
+
import { Column, Entity, OneToMany, Index } from 'typeorm';
|
|
3
3
|
import { EmailAttachment } from './email-attachment.entity';
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
@Entity("ss_email_template")
|
|
7
6
|
export class EmailTemplate extends CommonEntity {
|
|
8
|
-
@
|
|
7
|
+
@Index({ unique: true })
|
|
8
|
+
@Column({ name: "name", type: "varchar", unique: true })
|
|
9
9
|
name: string;
|
|
10
|
-
|
|
11
|
-
@Column()
|
|
10
|
+
@Column({ name: "display_name", type: "varchar" })
|
|
12
11
|
displayName: string;
|
|
13
|
-
|
|
14
|
-
@Column({ type: 'text' })
|
|
12
|
+
@Column({ name: "body", type: "varchar" })
|
|
15
13
|
body: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@Column({ type: 'text', nullable: true })
|
|
14
|
+
@Column({ name: "subject", type: "varchar", default: "{}" })
|
|
15
|
+
subject: string = "{}";
|
|
16
|
+
@Column({ name: "description", type: "text", nullable: true })
|
|
21
17
|
description: string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
active: boolean;
|
|
25
|
-
|
|
18
|
+
@Column({ name: "active", type: "boolean", nullable: true, default: true })
|
|
19
|
+
active: boolean = true;
|
|
26
20
|
@OneToMany(() => EmailAttachment, (attachment) => attachment.emailTemplate, { cascade: true })
|
|
27
21
|
attachments: EmailAttachment[];
|
|
22
|
+
@Column({ name: "type", type: "varchar", nullable: true })
|
|
23
|
+
type: string;
|
|
28
24
|
}
|