@tomei/media 0.4.7 → 0.4.8

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 (81) hide show
  1. package/.commitlintrc.json +22 -22
  2. package/.eslintrc.js +66 -66
  3. package/.husky/commit-msg +4 -4
  4. package/.husky/pre-commit +4 -4
  5. package/.prettierrc +4 -4
  6. package/.prettierrc copy +3 -3
  7. package/README.md +93 -93
  8. package/dist/common/common.module.js.map +1 -1
  9. package/dist/common/common.service.js.map +1 -1
  10. package/dist/common/dto/add-field-translation.dto.js.map +1 -1
  11. package/dist/common/dto/get-media.dto.js.map +1 -1
  12. package/dist/dto/external-media.dto.js.map +1 -1
  13. package/dist/dto/internal-medias.dto.js.map +1 -1
  14. package/dist/entities/medias.entity.d.ts +2 -0
  15. package/dist/entities/medias.entity.js +8 -0
  16. package/dist/entities/medias.entity.js.map +1 -1
  17. package/dist/interfaces/medias.repository.interface.d.ts +1 -1
  18. package/dist/medias.d.ts +1 -1
  19. package/dist/medias.js +41 -38
  20. package/dist/medias.js.map +1 -1
  21. package/dist/medias.repository.js.map +1 -1
  22. package/dist/pipe/append-id.pipe.js.map +1 -1
  23. package/dist/pipe/validate-id.pipe.js.map +1 -1
  24. package/dist/pipe/validate-search.pipe.js.map +1 -1
  25. package/dist/responses/deleted.response.js.map +1 -1
  26. package/dist/responses/pagination.response.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/migration/0001-add-defaultyn-hiddenyn-to-media-table.js +43 -0
  29. package/migration/media-migration.js +82 -82
  30. package/package.json +74 -72
  31. package/src/base/base.medias.ts +209 -209
  32. package/src/common/common.module.ts +10 -10
  33. package/src/common/common.service.ts +107 -107
  34. package/src/common/dto/add-field-translation.dto.ts +23 -23
  35. package/src/common/dto/get-media.dto.ts +12 -12
  36. package/src/entities/medias.entity.ts +125 -124
  37. package/src/index.ts +22 -22
  38. package/src/medias.repository.ts +41 -41
  39. package/src/medias.ts +763 -701
  40. package/src/pipe/validate-search.pipe.ts +44 -44
  41. package/tsconfig.build.json +4 -4
  42. package/tslint.json +18 -18
  43. package/dist/base/index.d.ts +0 -2
  44. package/dist/base/index.js +0 -6
  45. package/dist/base/index.js.map +0 -1
  46. package/dist/common/common.service.spec.d.ts +0 -0
  47. package/dist/common/common.service.spec.js +0 -5
  48. package/dist/common/common.service.spec.js.map +0 -1
  49. package/dist/dto/medias.dto.d.ts +0 -12
  50. package/dist/dto/medias.dto.js +0 -88
  51. package/dist/dto/medias.dto.js.map +0 -1
  52. package/dist/entities/index.d.ts +0 -2
  53. package/dist/entities/index.js +0 -6
  54. package/dist/entities/index.js.map +0 -1
  55. package/dist/entities/media.entity.d.ts +0 -21
  56. package/dist/entities/media.entity.js +0 -152
  57. package/dist/entities/media.entity.js.map +0 -1
  58. package/dist/interfaces/commonService.interface.d.ts +0 -17
  59. package/dist/interfaces/commonService.interface.js +0 -3
  60. package/dist/interfaces/commonService.interface.js.map +0 -1
  61. package/dist/interfaces/index.d.ts +0 -3
  62. package/dist/interfaces/index.js +0 -3
  63. package/dist/interfaces/index.js.map +0 -1
  64. package/dist/interfaces/media.repository.interface.d.ts +0 -10
  65. package/dist/interfaces/media.repository.interface.js +0 -3
  66. package/dist/interfaces/media.repository.interface.js.map +0 -1
  67. package/dist/interfaces/medias-attr.interface.d.ts +0 -22
  68. package/dist/interfaces/medias-attr.interface.js +0 -3
  69. package/dist/interfaces/medias-attr.interface.js.map +0 -1
  70. package/dist/medias.controller copy.d.ts +0 -25
  71. package/dist/medias.controller copy.js +0 -225
  72. package/dist/medias.controller copy.js.map +0 -1
  73. package/dist/medias.controller.d.ts +0 -29
  74. package/dist/medias.controller.js +0 -120
  75. package/dist/medias.controller.js.map +0 -1
  76. package/dist/medias.controller.old.d.ts +0 -25
  77. package/dist/medias.controller.old.js +0 -225
  78. package/dist/medias.controller.old.js.map +0 -1
  79. package/dist/medias.module.d.ts +0 -2
  80. package/dist/medias.module.js +0 -32
  81. package/dist/medias.module.js.map +0 -1
@@ -1,23 +1,23 @@
1
- import { IsNotEmpty, IsString } from 'class-validator';
2
-
3
- export class AddFieldTranslationDto {
4
- @IsNotEmpty()
5
- @IsString()
6
- ObjectTable: string;
7
-
8
- @IsNotEmpty()
9
- @IsString()
10
- ObjectField: string;
11
-
12
- @IsNotEmpty()
13
- @IsString()
14
- ObjectId: string;
15
-
16
- @IsNotEmpty()
17
- @IsString()
18
- LanguageCode: string;
19
-
20
- @IsNotEmpty()
21
- @IsString()
22
- Translation: string;
23
- }
1
+ import { IsNotEmpty, IsString } from 'class-validator';
2
+
3
+ export class AddFieldTranslationDto {
4
+ @IsNotEmpty()
5
+ @IsString()
6
+ ObjectTable: string;
7
+
8
+ @IsNotEmpty()
9
+ @IsString()
10
+ ObjectField: string;
11
+
12
+ @IsNotEmpty()
13
+ @IsString()
14
+ ObjectId: string;
15
+
16
+ @IsNotEmpty()
17
+ @IsString()
18
+ LanguageCode: string;
19
+
20
+ @IsNotEmpty()
21
+ @IsString()
22
+ Translation: string;
23
+ }
@@ -1,12 +1,12 @@
1
- import { IsString } from 'class-validator';
2
-
3
- export class GetMediaDto {
4
- @IsString()
5
- ObjectID?: string;
6
-
7
- @IsString()
8
- ObjectType?: string;
9
-
10
- @IsString()
11
- Title?: string;
12
- }
1
+ import { IsString } from 'class-validator';
2
+
3
+ export class GetMediaDto {
4
+ @IsString()
5
+ ObjectID?: string;
6
+
7
+ @IsString()
8
+ ObjectType?: string;
9
+
10
+ @IsString()
11
+ Title?: string;
12
+ }
@@ -1,124 +1,125 @@
1
- import { ApiProperty } from '@nestjs/swagger';
2
- import {
3
- Column,
4
- Model,
5
- Table,
6
- DataType,
7
- } from 'sequelize-typescript';
8
- import { MediaType } from '../enum';
9
-
10
- @Table({ tableName: 'common_Media', createdAt: false, updatedAt: false })
11
- export class MediasModel extends Model {
12
- @Column({
13
- primaryKey: true,
14
- allowNull: false,
15
- })
16
- @ApiProperty({ type: String, description: 'MediaID' })
17
- MediaId: string;
18
-
19
- @Column({
20
- allowNull: false,
21
- })
22
- @ApiProperty({ type: String, description: 'ObjectID' })
23
- ObjectId: string;
24
-
25
- @Column({
26
- allowNull: false,
27
- })
28
- @ApiProperty({ type: String, description: 'ObjectType' })
29
- ObjectType: string;
30
-
31
- @Column({
32
- allowNull: true,
33
- })
34
- @ApiProperty({ type: String, description: 'title of the media' })
35
- Title: string;
36
-
37
- @Column({
38
- allowNull: true,
39
- })
40
- @ApiProperty({ type: String, description: 'Description of the media' })
41
- Description: string;
42
-
43
- @Column({
44
- allowNull: false,
45
- })
46
- @ApiProperty({
47
- type: String,
48
- description: 'Enum either Photo, Video, Document',
49
- })
50
- Type: MediaType;
51
-
52
- @Column({
53
- allowNull: false,
54
- })
55
- @ApiProperty({ type: String, description: 'isExternal either Y, N' })
56
- IsExternalYN: string;
57
-
58
- @Column({
59
- allowNull: true,
60
- })
61
- @ApiProperty({ type: String, description: 'External surce for the file' })
62
- ExternalSource: string;
63
-
64
- @Column({
65
- allowNull: false,
66
- })
67
- @ApiProperty({ type: String, description: 'isExternal either Y, N' })
68
- IsEncryptedYN: string;
69
-
70
- @Column({
71
- allowNull: true,
72
- })
73
- @ApiProperty({ type: String, description: 'file name without extension' })
74
- FileName: string;
75
-
76
- @Column({
77
- allowNull: true,
78
- })
79
- @ApiProperty({ type: String, description: 'extention of file in jpg etc' })
80
- FileExtension: string;
81
-
82
- @Column({
83
- allowNull: true,
84
- })
85
- @ApiProperty({
86
- type: String,
87
- description: 'location on the media in term of path',
88
- })
89
- FilePath: string;
90
-
91
- @Column({
92
- allowNull: true,
93
- })
94
- @ApiProperty({ type: String, description: 'URl of the media' })
95
- URL: string;
96
-
97
- @ApiProperty({
98
- example: new Date(),
99
- description: 'Timestamp for data creation.',
100
- })
101
- @Column({ type: DataType.DATE, allowNull: false })
102
- CreatedAt: Date;
103
-
104
- @ApiProperty({
105
- example: '138140891dd211b288d34bc7b4312a49',
106
- description: 'The CreatedById for Media.',
107
- })
108
- @Column({ allowNull: false })
109
- CreatedById: string;
110
-
111
- @ApiProperty({
112
- example: new Date(),
113
- description: 'Timestamp for latest data modification',
114
- })
115
- @Column({ type: DataType.DATE, allowNull: true })
116
- UpdatedAt: Date;
117
-
118
- @ApiProperty({
119
- example: '138140891dd211b288d34bc7b4312a49',
120
- description: 'The UpdatedById for Media.',
121
- })
122
- @Column({ allowNull: false })
123
- UpdatedById: string;
124
- }
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { Column, Model, Table, DataType } from 'sequelize-typescript';
3
+ import { MediaType } from '../enum';
4
+
5
+ @Table({ tableName: 'common_Media', createdAt: false, updatedAt: false })
6
+ export class MediasModel extends Model {
7
+ @Column({
8
+ primaryKey: true,
9
+ allowNull: false,
10
+ })
11
+ @ApiProperty({ type: String, description: 'MediaID' })
12
+ MediaId: string;
13
+
14
+ @Column({
15
+ allowNull: false,
16
+ })
17
+ @ApiProperty({ type: String, description: 'ObjectID' })
18
+ ObjectId: string;
19
+
20
+ @Column({
21
+ allowNull: false,
22
+ })
23
+ @ApiProperty({ type: String, description: 'ObjectType' })
24
+ ObjectType: string;
25
+
26
+ @Column({
27
+ allowNull: true,
28
+ })
29
+ @ApiProperty({ type: String, description: 'title of the media' })
30
+ Title: string;
31
+
32
+ @Column({
33
+ allowNull: true,
34
+ })
35
+ @ApiProperty({ type: String, description: 'Description of the media' })
36
+ Description: string;
37
+
38
+ @Column({
39
+ allowNull: false,
40
+ })
41
+ @ApiProperty({
42
+ type: String,
43
+ description: 'Enum either Photo, Video, Document',
44
+ })
45
+ Type: MediaType;
46
+
47
+ @Column({
48
+ allowNull: false,
49
+ })
50
+ @ApiProperty({ type: String, description: 'isExternal either Y, N' })
51
+ IsExternalYN: string;
52
+
53
+ @Column({
54
+ allowNull: true,
55
+ })
56
+ @ApiProperty({ type: String, description: 'External surce for the file' })
57
+ ExternalSource: string;
58
+
59
+ @Column({
60
+ allowNull: false,
61
+ })
62
+ @ApiProperty({ type: String, description: 'isExternal either Y, N' })
63
+ IsEncryptedYN: string;
64
+
65
+ @Column({
66
+ allowNull: true,
67
+ })
68
+ @ApiProperty({ type: String, description: 'file name without extension' })
69
+ FileName: string;
70
+
71
+ @Column({
72
+ allowNull: true,
73
+ })
74
+ @ApiProperty({ type: String, description: 'extention of file in jpg etc' })
75
+ FileExtension: string;
76
+
77
+ @Column({
78
+ allowNull: true,
79
+ })
80
+ @ApiProperty({
81
+ type: String,
82
+ description: 'location on the media in term of path',
83
+ })
84
+ FilePath: string;
85
+
86
+ @Column({
87
+ allowNull: true,
88
+ })
89
+ @ApiProperty({ type: String, description: 'URl of the media' })
90
+ URL: string;
91
+
92
+ @ApiProperty({
93
+ example: new Date(),
94
+ description: 'Timestamp for data creation.',
95
+ })
96
+ @Column({ type: DataType.DATE, allowNull: false })
97
+ CreatedAt: Date;
98
+
99
+ @ApiProperty({
100
+ example: '138140891dd211b288d34bc7b4312a49',
101
+ description: 'The CreatedById for Media.',
102
+ })
103
+ @Column({ allowNull: false })
104
+ CreatedById: string;
105
+
106
+ @ApiProperty({
107
+ example: new Date(),
108
+ description: 'Timestamp for latest data modification',
109
+ })
110
+ @Column({ type: DataType.DATE, allowNull: true })
111
+ UpdatedAt: Date;
112
+
113
+ @ApiProperty({
114
+ example: '138140891dd211b288d34bc7b4312a49',
115
+ description: 'The UpdatedById for Media.',
116
+ })
117
+ @Column({ allowNull: false })
118
+ UpdatedById: string;
119
+
120
+ @Column({ allowNull: true })
121
+ HiddenYN: string;
122
+
123
+ @Column({ allowNull: true })
124
+ DefaultYN: string;
125
+ }
package/src/index.ts CHANGED
@@ -1,23 +1,23 @@
1
- import { MediasRepository } from "./medias.repository";
2
- import { MediasModel } from "./entities/medias.entity";
3
- import { Medias } from "./medias";
4
- import { CommonModule } from "./common/common.module";
5
- import { CommonService } from "./common/common.service";
6
- import { ExternalMediaDto } from "./dto/external-media.dto";
7
- import { InternalMediaDto } from "./dto/internal-medias.dto";
8
- import { MediaType } from "./enum";
9
- import { IBaseMediasAttr } from "./interfaces/base.medias-attr.interface";
10
- import { IMediasRepository } from "./interfaces/medias.repository.interface";
11
-
12
- export {
13
- MediasRepository,
14
- MediasModel,
15
- Medias,
16
- CommonModule,
17
- CommonService,
18
- ExternalMediaDto,
19
- InternalMediaDto,
20
- MediaType,
21
- IBaseMediasAttr,
22
- IMediasRepository,
1
+ import { MediasRepository } from "./medias.repository";
2
+ import { MediasModel } from "./entities/medias.entity";
3
+ import { Medias } from "./medias";
4
+ import { CommonModule } from "./common/common.module";
5
+ import { CommonService } from "./common/common.service";
6
+ import { ExternalMediaDto } from "./dto/external-media.dto";
7
+ import { InternalMediaDto } from "./dto/internal-medias.dto";
8
+ import { MediaType } from "./enum";
9
+ import { IBaseMediasAttr } from "./interfaces/base.medias-attr.interface";
10
+ import { IMediasRepository } from "./interfaces/medias.repository.interface";
11
+
12
+ export {
13
+ MediasRepository,
14
+ MediasModel,
15
+ Medias,
16
+ CommonModule,
17
+ CommonService,
18
+ ExternalMediaDto,
19
+ InternalMediaDto,
20
+ MediaType,
21
+ IBaseMediasAttr,
22
+ IMediasRepository,
23
23
  }
@@ -1,41 +1,41 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { InjectModel } from '@nestjs/sequelize';
3
- import { BaseRepository } from './base/base.repository.abstract';
4
- import { MediasModel } from './entities/medias.entity';
5
- import { IBaseMediasAttr } from './interfaces/base.medias-attr.interface';
6
- import { IMediasRepository } from './interfaces/medias.repository.interface';
7
-
8
- @Injectable()
9
- export class MediasRepository
10
- extends BaseRepository<MediasModel>
11
- implements IMediasRepository
12
- {
13
- constructor(
14
- @InjectModel(MediasModel)
15
- private readonly mediasModel: typeof MediasModel,
16
- ) {
17
- super(mediasModel);
18
- }
19
-
20
- create(data: IBaseMediasAttr, options?: any): Promise<MediasModel> | any {
21
- return this.mediasModel.create({ ...data }, options);
22
- }
23
-
24
- findAll(options: any): Promise<MediasModel[]> {
25
- return this.mediasModel.findAll(options);
26
- }
27
-
28
- findAllWithPagination(
29
- options: any,
30
- ): Promise<{ count: number; rows: MediasModel[] }> {
31
- return this.mediasModel.findAndCountAll(options);
32
- }
33
-
34
- findOne(options: any): Promise<MediasModel> {
35
- return this.mediasModel.findOne(options);
36
- }
37
-
38
- update(data: IBaseMediasAttr, options?: any): any {
39
- return this.mediasModel.update({ ...data }, options);
40
- }
41
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/sequelize';
3
+ import { BaseRepository } from './base/base.repository.abstract';
4
+ import { MediasModel } from './entities/medias.entity';
5
+ import { IBaseMediasAttr } from './interfaces/base.medias-attr.interface';
6
+ import { IMediasRepository } from './interfaces/medias.repository.interface';
7
+
8
+ @Injectable()
9
+ export class MediasRepository
10
+ extends BaseRepository<MediasModel>
11
+ implements IMediasRepository
12
+ {
13
+ constructor(
14
+ @InjectModel(MediasModel)
15
+ private readonly mediasModel: typeof MediasModel,
16
+ ) {
17
+ super(mediasModel);
18
+ }
19
+
20
+ create(data: IBaseMediasAttr, options?: any): Promise<MediasModel> | any {
21
+ return this.mediasModel.create({ ...data }, options);
22
+ }
23
+
24
+ findAll(options: any): Promise<MediasModel[]> {
25
+ return this.mediasModel.findAll(options);
26
+ }
27
+
28
+ findAllWithPagination(
29
+ options: any,
30
+ ): Promise<{ count: number; rows: MediasModel[] }> {
31
+ return this.mediasModel.findAndCountAll(options);
32
+ }
33
+
34
+ findOne(options: any): Promise<MediasModel> {
35
+ return this.mediasModel.findOne(options);
36
+ }
37
+
38
+ update(data: IBaseMediasAttr, options?: any): any {
39
+ return this.mediasModel.update({ ...data }, options);
40
+ }
41
+ }