@tomei/media 0.4.0 → 0.4.1

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 (111) 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/base/base.medias.d.ts +38 -38
  9. package/dist/base/base.medias.js +169 -169
  10. package/dist/base/base.repository.abstract.d.ts +12 -12
  11. package/dist/base/base.repository.abstract.js +21 -21
  12. package/dist/base/base.repository.interface.d.ts +9 -9
  13. package/dist/base/base.repository.interface.js +2 -2
  14. package/dist/base/index.d.ts +2 -0
  15. package/dist/base/index.js +6 -0
  16. package/dist/base/index.js.map +1 -0
  17. package/dist/common/common.module.d.ts +2 -2
  18. package/dist/common/common.module.js +22 -22
  19. package/dist/common/common.service.d.ts +13 -13
  20. package/dist/common/common.service.js +107 -107
  21. package/dist/common/common.service.spec.d.ts +0 -0
  22. package/dist/common/common.service.spec.js +5 -0
  23. package/dist/common/common.service.spec.js.map +1 -0
  24. package/dist/common/dto/add-field-translation.dto.d.ts +7 -7
  25. package/dist/common/dto/add-field-translation.dto.js +41 -41
  26. package/dist/common/dto/get-media.dto.d.ts +5 -5
  27. package/dist/common/dto/get-media.dto.js +28 -28
  28. package/dist/common/dto/get-media.dto.js.map +1 -1
  29. package/dist/dto/external-media.dto.d.ts +10 -10
  30. package/dist/dto/external-media.dto.js +69 -69
  31. package/dist/dto/internal-medias.dto.d.ts +12 -12
  32. package/dist/dto/internal-medias.dto.js +86 -86
  33. package/dist/dto/medias.dto.d.ts +12 -0
  34. package/dist/dto/medias.dto.js +88 -0
  35. package/dist/dto/medias.dto.js.map +1 -0
  36. package/dist/entities/index.d.ts +2 -0
  37. package/dist/entities/index.js +6 -0
  38. package/dist/entities/index.js.map +1 -0
  39. package/dist/entities/media.entity.d.ts +21 -0
  40. package/dist/entities/media.entity.js +152 -0
  41. package/dist/entities/media.entity.js.map +1 -0
  42. package/dist/entities/medias.entity.d.ts +21 -21
  43. package/dist/entities/medias.entity.js +151 -151
  44. package/dist/enum/index.d.ts +2 -2
  45. package/dist/enum/index.js +5 -5
  46. package/dist/enum/medias.enum.d.ts +5 -5
  47. package/dist/enum/medias.enum.js +9 -9
  48. package/dist/helpers/error.d.ts +1 -1
  49. package/dist/helpers/error.js +13 -13
  50. package/dist/helpers/index.d.ts +2 -2
  51. package/dist/helpers/index.js +5 -5
  52. package/dist/index.d.ts +11 -11
  53. package/dist/index.js +19 -19
  54. package/dist/interfaces/base.medias-attr.interface.d.ts +20 -20
  55. package/dist/interfaces/base.medias-attr.interface.js +2 -2
  56. package/dist/interfaces/commonService.interface.d.ts +17 -0
  57. package/dist/interfaces/commonService.interface.js +3 -0
  58. package/dist/interfaces/commonService.interface.js.map +1 -0
  59. package/dist/interfaces/index.d.ts +3 -0
  60. package/dist/interfaces/index.js +3 -0
  61. package/dist/interfaces/index.js.map +1 -0
  62. package/dist/interfaces/media.repository.interface.d.ts +10 -0
  63. package/dist/interfaces/media.repository.interface.js +3 -0
  64. package/dist/interfaces/media.repository.interface.js.map +1 -0
  65. package/dist/interfaces/medias-attr.interface.d.ts +22 -0
  66. package/dist/interfaces/medias-attr.interface.js +3 -0
  67. package/dist/interfaces/medias-attr.interface.js.map +1 -0
  68. package/dist/interfaces/medias.repository.interface.d.ts +3 -3
  69. package/dist/interfaces/medias.repository.interface.js +2 -2
  70. package/dist/medias.controller copy.d.ts +25 -0
  71. package/dist/medias.controller copy.js +225 -0
  72. package/dist/medias.controller copy.js.map +1 -0
  73. package/dist/medias.controller.d.ts +29 -25
  74. package/dist/medias.controller.js +119 -224
  75. package/dist/medias.controller.js.map +1 -1
  76. package/dist/medias.controller.old.d.ts +25 -0
  77. package/dist/medias.controller.old.js +225 -0
  78. package/dist/medias.controller.old.js.map +1 -0
  79. package/dist/medias.d.ts +62 -62
  80. package/dist/medias.js +507 -507
  81. package/dist/medias.module.d.ts +2 -2
  82. package/dist/medias.module.js +31 -34
  83. package/dist/medias.module.js.map +1 -1
  84. package/dist/medias.repository.d.ts +16 -16
  85. package/dist/medias.repository.js +46 -46
  86. package/dist/pipe/append-id.pipe.d.ts +6 -6
  87. package/dist/pipe/append-id.pipe.js +27 -27
  88. package/dist/pipe/validate-enum.pipe.d.ts +6 -6
  89. package/dist/pipe/validate-enum.pipe.js +33 -33
  90. package/dist/pipe/validate-id.pipe.d.ts +6 -6
  91. package/dist/pipe/validate-id.pipe.js +30 -30
  92. package/dist/pipe/validate-search.pipe.d.ts +7 -7
  93. package/dist/pipe/validate-search.pipe.js +45 -45
  94. package/dist/responses/deleted.response.d.ts +3 -3
  95. package/dist/responses/deleted.response.js +20 -20
  96. package/dist/responses/pagination.response.d.ts +5 -5
  97. package/dist/responses/pagination.response.js +25 -25
  98. package/dist/tsconfig.tsbuildinfo +1 -1
  99. package/migration/media-migration.js +82 -82
  100. package/package.json +72 -72
  101. package/src/base/base.medias.ts +209 -209
  102. package/src/common/common.module.ts +10 -10
  103. package/src/common/common.service.ts +109 -109
  104. package/src/common/dto/add-field-translation.dto.ts +23 -23
  105. package/src/common/dto/get-media.dto.ts +12 -12
  106. package/src/index.ts +22 -22
  107. package/src/medias.repository.ts +41 -41
  108. package/src/medias.ts +688 -688
  109. package/src/pipe/validate-search.pipe.ts +44 -44
  110. package/tsconfig.build.json +4 -4
  111. package/tslint.json +18 -18
@@ -1,44 +1,44 @@
1
- import {
2
- BadRequestException,
3
- Injectable,
4
- // Logger,
5
- PipeTransform,
6
- } from '@nestjs/common';
7
-
8
- @Injectable()
9
- export class ValidateSearchPipe implements PipeTransform {
10
- constructor(
11
- private model: any,
12
- private additionalAttributes: string[] = [],
13
- ) {}
14
-
15
- transform(value: string) {
16
- let search = {};
17
-
18
- if (value) {
19
- try {
20
- search = JSON.parse(value);
21
- } catch (err) {
22
- throw new BadRequestException('Bad value for search.');
23
- }
24
- const attributes: string[] = [
25
- ...this.additionalAttributes,
26
- ...Object.keys(this.model.tableAttributes),
27
- ];
28
- const searchAttributes: string[] = Object.keys(search);
29
- const invalidKeys = searchAttributes.filter(
30
- (attr) => !attributes.includes(attr),
31
- );
32
-
33
- if (invalidKeys.length > 0) {
34
- throw new BadRequestException(
35
- `${invalidKeys} ${
36
- invalidKeys.length > 1 ? 'are invalid keys' : 'is an invalid key'
37
- } for search query`,
38
- );
39
- }
40
- }
41
-
42
- return value;
43
- }
44
- }
1
+ import {
2
+ BadRequestException,
3
+ Injectable,
4
+ // Logger,
5
+ PipeTransform,
6
+ } from '@nestjs/common';
7
+
8
+ @Injectable()
9
+ export class ValidateSearchPipe implements PipeTransform {
10
+ constructor(
11
+ private model: any,
12
+ private additionalAttributes: string[] = [],
13
+ ) {}
14
+
15
+ transform(value: string) {
16
+ let search = {};
17
+
18
+ if (value) {
19
+ try {
20
+ search = JSON.parse(value);
21
+ } catch (err) {
22
+ throw new BadRequestException('Bad value for search.');
23
+ }
24
+ const attributes: string[] = [
25
+ ...this.additionalAttributes,
26
+ ...Object.keys(this.model.tableAttributes),
27
+ ];
28
+ const searchAttributes: string[] = Object.keys(search);
29
+ const invalidKeys = searchAttributes.filter(
30
+ (attr) => !attributes.includes(attr),
31
+ );
32
+
33
+ if (invalidKeys.length > 0) {
34
+ throw new BadRequestException(
35
+ `${invalidKeys} ${
36
+ invalidKeys.length > 1 ? 'are invalid keys' : 'is an invalid key'
37
+ } for search query`,
38
+ );
39
+ }
40
+ }
41
+
42
+ return value;
43
+ }
44
+ }
@@ -1,4 +1,4 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
4
- }
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
4
+ }
package/tslint.json CHANGED
@@ -1,18 +1,18 @@
1
- {
2
- "defaultSeverity": "error",
3
- "extends": ["tslint:recommended"],
4
- "jsRules": {
5
- "no-unused-expression": true
6
- },
7
- "rules": {
8
- "quotemark": [true, "single"],
9
- "member-access": [false],
10
- "ordered-imports": [false],
11
- "max-line-length": [true, 150],
12
- "member-ordering": [false],
13
- "interface-name": [false],
14
- "arrow-parens": false,
15
- "object-literal-sort-keys": false
16
- },
17
- "rulesDirectory": []
18
- }
1
+ {
2
+ "defaultSeverity": "error",
3
+ "extends": ["tslint:recommended"],
4
+ "jsRules": {
5
+ "no-unused-expression": true
6
+ },
7
+ "rules": {
8
+ "quotemark": [true, "single"],
9
+ "member-access": [false],
10
+ "ordered-imports": [false],
11
+ "max-line-length": [true, 150],
12
+ "member-ordering": [false],
13
+ "interface-name": [false],
14
+ "arrow-parens": false,
15
+ "object-literal-sort-keys": false
16
+ },
17
+ "rulesDirectory": []
18
+ }