@tomei/media 0.6.9 → 0.6.11

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 (66) 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.js +2 -0
  9. package/dist/base/base.medias.js.map +1 -1
  10. package/dist/medias.d.ts +6 -6
  11. package/dist/medias.js +26 -16
  12. package/dist/medias.js.map +1 -1
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/migration/0001-add-defaultyn-hiddenyn-to-media-table.js +36 -36
  15. package/migration/media-migration.js +82 -82
  16. package/package.json +77 -77
  17. package/src/base/base.medias.ts +2 -0
  18. package/src/common/common.module.ts +10 -10
  19. package/src/common/common.service.ts +107 -107
  20. package/src/common/dto/add-field-translation.dto.ts +23 -23
  21. package/src/common/dto/get-media.dto.ts +12 -12
  22. package/src/database.ts +16 -16
  23. package/src/entities/medias.entity.ts +125 -125
  24. package/src/medias.ts +26 -35
  25. package/src/pipe/validate-search.pipe.ts +44 -44
  26. package/tsconfig.build.json +4 -4
  27. package/tslint.json +18 -18
  28. package/dist/base/index.d.ts +0 -2
  29. package/dist/base/index.js +0 -6
  30. package/dist/base/index.js.map +0 -1
  31. package/dist/common/common.service.spec.d.ts +0 -0
  32. package/dist/common/common.service.spec.js +0 -5
  33. package/dist/common/common.service.spec.js.map +0 -1
  34. package/dist/dto/medias.dto.d.ts +0 -12
  35. package/dist/dto/medias.dto.js +0 -88
  36. package/dist/dto/medias.dto.js.map +0 -1
  37. package/dist/entities/index.d.ts +0 -2
  38. package/dist/entities/index.js +0 -6
  39. package/dist/entities/index.js.map +0 -1
  40. package/dist/entities/media.entity.d.ts +0 -21
  41. package/dist/entities/media.entity.js +0 -152
  42. package/dist/entities/media.entity.js.map +0 -1
  43. package/dist/interfaces/commonService.interface.d.ts +0 -17
  44. package/dist/interfaces/commonService.interface.js +0 -3
  45. package/dist/interfaces/commonService.interface.js.map +0 -1
  46. package/dist/interfaces/index.d.ts +0 -3
  47. package/dist/interfaces/index.js +0 -3
  48. package/dist/interfaces/index.js.map +0 -1
  49. package/dist/interfaces/media.repository.interface.d.ts +0 -10
  50. package/dist/interfaces/media.repository.interface.js +0 -3
  51. package/dist/interfaces/media.repository.interface.js.map +0 -1
  52. package/dist/interfaces/medias-attr.interface.d.ts +0 -22
  53. package/dist/interfaces/medias-attr.interface.js +0 -3
  54. package/dist/interfaces/medias-attr.interface.js.map +0 -1
  55. package/dist/medias.controller copy.d.ts +0 -25
  56. package/dist/medias.controller copy.js +0 -225
  57. package/dist/medias.controller copy.js.map +0 -1
  58. package/dist/medias.controller.d.ts +0 -29
  59. package/dist/medias.controller.js +0 -120
  60. package/dist/medias.controller.js.map +0 -1
  61. package/dist/medias.controller.old.d.ts +0 -25
  62. package/dist/medias.controller.old.js +0 -225
  63. package/dist/medias.controller.old.js.map +0 -1
  64. package/dist/medias.module.d.ts +0 -2
  65. package/dist/medias.module.js +0 -32
  66. package/dist/medias.module.js.map +0 -1
@@ -1,22 +1,22 @@
1
- {
2
- "extends": [
3
- "@commitlint/config-conventional"
4
- ],
5
- "rules": {
6
- "header-max-length": [ 2, "always", 120 ],
7
- "type-enum": [
8
- 2,
9
- "always",
10
- [
11
- "breaking",
12
- "feat",
13
- "fix",
14
- "refactor",
15
- "config",
16
- "test",
17
- "docs",
18
- "chore"
19
- ]
20
- ]
21
- }
22
- }
1
+ {
2
+ "extends": [
3
+ "@commitlint/config-conventional"
4
+ ],
5
+ "rules": {
6
+ "header-max-length": [ 2, "always", 120 ],
7
+ "type-enum": [
8
+ 2,
9
+ "always",
10
+ [
11
+ "breaking",
12
+ "feat",
13
+ "fix",
14
+ "refactor",
15
+ "config",
16
+ "test",
17
+ "docs",
18
+ "chore"
19
+ ]
20
+ ]
21
+ }
22
+ }
package/.eslintrc.js CHANGED
@@ -1,66 +1,66 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- parserOptions: {
4
- project: 'tsconfig.json',
5
- sourceType: 'module',
6
- },
7
- plugins: ['@typescript-eslint/eslint-plugin'],
8
- extends: [
9
- 'plugin:@typescript-eslint/recommended',
10
- 'plugin:prettier/recommended',
11
- ],
12
- root: true,
13
- env: {
14
- node: true,
15
- jest: true,
16
- },
17
- ignorePatterns: ['.eslintrc.js', 'db/config.js'],
18
- rules: {
19
- "no-unused-vars": "off",
20
- "@typescript-eslint/no-unused-vars": ["error"],
21
- '@typescript-eslint/interface-name-prefix': 'off',
22
- '@typescript-eslint/explicit-function-return-type': 'off',
23
- '@typescript-eslint/explicit-module-boundary-types': 'off',
24
- '@typescript-eslint/no-explicit-any': 'off',
25
- '@typescript-eslint/naming-convention': [
26
- "error",
27
- {
28
- "selector": ["variable", "function"],
29
- "format": ["camelCase"],
30
- "leadingUnderscore": "forbid",
31
- "trailingUnderscore": "forbid",
32
- },
33
- {
34
- "selector": ["class"],
35
- "format": ["PascalCase"],
36
- "leadingUnderscore": "forbid",
37
- "trailingUnderscore": "forbid",
38
- },
39
- {
40
- "selector": "variable",
41
- "types": ["boolean"],
42
- "format": ["PascalCase"],
43
- "leadingUnderscore": "forbid",
44
- "trailingUnderscore": "forbid",
45
- "prefix": ["is", "should", "has", "can", "did", "will"]
46
- },
47
- {
48
- "selector": "interface",
49
- "format": ["PascalCase"],
50
- "leadingUnderscore": "forbid",
51
- "trailingUnderscore": "forbid",
52
- "custom": {
53
- "regex": "^I[A-Z]",
54
- "match": true
55
- }
56
- },
57
- {
58
- "selector": "variable",
59
- "modifiers": ["const"],
60
- "format": ["camelCase","UPPER_CASE", "PascalCase"],
61
- "leadingUnderscore": "forbid",
62
- "trailingUnderscore": "forbid",
63
- }
64
- ]
65
- },
66
- };
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ parserOptions: {
4
+ project: 'tsconfig.json',
5
+ sourceType: 'module',
6
+ },
7
+ plugins: ['@typescript-eslint/eslint-plugin'],
8
+ extends: [
9
+ 'plugin:@typescript-eslint/recommended',
10
+ 'plugin:prettier/recommended',
11
+ ],
12
+ root: true,
13
+ env: {
14
+ node: true,
15
+ jest: true,
16
+ },
17
+ ignorePatterns: ['.eslintrc.js', 'db/config.js'],
18
+ rules: {
19
+ "no-unused-vars": "off",
20
+ "@typescript-eslint/no-unused-vars": ["error"],
21
+ '@typescript-eslint/interface-name-prefix': 'off',
22
+ '@typescript-eslint/explicit-function-return-type': 'off',
23
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
24
+ '@typescript-eslint/no-explicit-any': 'off',
25
+ '@typescript-eslint/naming-convention': [
26
+ "error",
27
+ {
28
+ "selector": ["variable", "function"],
29
+ "format": ["camelCase"],
30
+ "leadingUnderscore": "forbid",
31
+ "trailingUnderscore": "forbid",
32
+ },
33
+ {
34
+ "selector": ["class"],
35
+ "format": ["PascalCase"],
36
+ "leadingUnderscore": "forbid",
37
+ "trailingUnderscore": "forbid",
38
+ },
39
+ {
40
+ "selector": "variable",
41
+ "types": ["boolean"],
42
+ "format": ["PascalCase"],
43
+ "leadingUnderscore": "forbid",
44
+ "trailingUnderscore": "forbid",
45
+ "prefix": ["is", "should", "has", "can", "did", "will"]
46
+ },
47
+ {
48
+ "selector": "interface",
49
+ "format": ["PascalCase"],
50
+ "leadingUnderscore": "forbid",
51
+ "trailingUnderscore": "forbid",
52
+ "custom": {
53
+ "regex": "^I[A-Z]",
54
+ "match": true
55
+ }
56
+ },
57
+ {
58
+ "selector": "variable",
59
+ "modifiers": ["const"],
60
+ "format": ["camelCase","UPPER_CASE", "PascalCase"],
61
+ "leadingUnderscore": "forbid",
62
+ "trailingUnderscore": "forbid",
63
+ }
64
+ ]
65
+ },
66
+ };
package/.husky/commit-msg CHANGED
@@ -1,4 +1,4 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npx commitlint --edit $1
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npx commitlint --edit $1
package/.husky/pre-commit CHANGED
@@ -1,4 +1,4 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npx lint-staged
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npx lint-staged
package/.prettierrc CHANGED
@@ -1,4 +1,4 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "all"
4
- }
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all"
4
+ }
@@ -1,4 +1,4 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "all"
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all"
4
4
  }
package/README.md CHANGED
@@ -1,93 +1,93 @@
1
- # Media
2
-
3
- Package for Media in Tomei
4
-
5
- ## Getting started
6
-
7
- To make it easy for you to get started with GitLab, here's a list of recommended next steps.
8
-
9
- Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
10
-
11
- ## Add your files
12
-
13
- - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
14
- - [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
15
-
16
- ```
17
- cd existing_repo
18
- git remote add origin https://gitlab.com/tomei-package/media.git
19
- git branch -M main
20
- git push -uf origin main
21
- ```
22
-
23
- ## Integrate with your tools
24
-
25
- - [ ] [Set up project integrations](https://gitlab.com/tomei-package/media/-/settings/integrations)
26
-
27
- ## Collaborate with your team
28
-
29
- - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
30
- - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
31
- - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
32
- - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
33
- - [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
34
-
35
- ## Test and Deploy
36
-
37
- Use the built-in continuous integration in GitLab.
38
-
39
- - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
40
- - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
41
- - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
42
- - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
43
- - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
44
-
45
- ***
46
-
47
- # Editing this README
48
-
49
- When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
50
-
51
- ## Suggestions for a good README
52
- Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
53
-
54
- ## Name
55
- Choose a self-explaining name for your project.
56
-
57
- ## Description
58
- Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
59
-
60
- ## Badges
61
- On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
62
-
63
- ## Visuals
64
- Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
65
-
66
- ## Installation
67
- Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
68
-
69
- ## Usage
70
- Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
71
-
72
- ## Support
73
- Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
74
-
75
- ## Roadmap
76
- If you have ideas for releases in the future, it is a good idea to list them in the README.
77
-
78
- ## Contributing
79
- State if you are open to contributions and what your requirements are for accepting them.
80
-
81
- For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
82
-
83
- You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
84
-
85
- ## Authors and acknowledgment
86
- Show your appreciation to those who have contributed to the project.
87
-
88
- ## License
89
- For open source projects, say how it is licensed.
90
-
91
- ## Project status
92
- If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
93
- Test
1
+ # Media
2
+
3
+ Package for Media in Tomei
4
+
5
+ ## Getting started
6
+
7
+ To make it easy for you to get started with GitLab, here's a list of recommended next steps.
8
+
9
+ Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
10
+
11
+ ## Add your files
12
+
13
+ - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
14
+ - [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
15
+
16
+ ```
17
+ cd existing_repo
18
+ git remote add origin https://gitlab.com/tomei-package/media.git
19
+ git branch -M main
20
+ git push -uf origin main
21
+ ```
22
+
23
+ ## Integrate with your tools
24
+
25
+ - [ ] [Set up project integrations](https://gitlab.com/tomei-package/media/-/settings/integrations)
26
+
27
+ ## Collaborate with your team
28
+
29
+ - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
30
+ - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
31
+ - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
32
+ - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
33
+ - [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
34
+
35
+ ## Test and Deploy
36
+
37
+ Use the built-in continuous integration in GitLab.
38
+
39
+ - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
40
+ - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
41
+ - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
42
+ - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
43
+ - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
44
+
45
+ ***
46
+
47
+ # Editing this README
48
+
49
+ When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
50
+
51
+ ## Suggestions for a good README
52
+ Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
53
+
54
+ ## Name
55
+ Choose a self-explaining name for your project.
56
+
57
+ ## Description
58
+ Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
59
+
60
+ ## Badges
61
+ On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
62
+
63
+ ## Visuals
64
+ Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
65
+
66
+ ## Installation
67
+ Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
68
+
69
+ ## Usage
70
+ Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
71
+
72
+ ## Support
73
+ Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
74
+
75
+ ## Roadmap
76
+ If you have ideas for releases in the future, it is a good idea to list them in the README.
77
+
78
+ ## Contributing
79
+ State if you are open to contributions and what your requirements are for accepting them.
80
+
81
+ For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
82
+
83
+ You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
84
+
85
+ ## Authors and acknowledgment
86
+ Show your appreciation to those who have contributed to the project.
87
+
88
+ ## License
89
+ For open source projects, say how it is licensed.
90
+
91
+ ## Project status
92
+ If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
93
+ Test
@@ -95,6 +95,7 @@ class BaseMedias {
95
95
  where: {
96
96
  MediaId: this.MediaId,
97
97
  },
98
+ options,
98
99
  });
99
100
  if (!media) {
100
101
  throw new common_1.BadRequestException('Media not found.');
@@ -129,6 +130,7 @@ class BaseMedias {
129
130
  where: {
130
131
  MediaId: this.MediaId,
131
132
  },
133
+ options,
132
134
  });
133
135
  const data = Object.assign({}, media.get({ plain: true }));
134
136
  if (!media) {
@@ -1 +1 @@
1
- {"version":3,"file":"base.medias.js","sourceRoot":"","sources":["../../src/base/base.medias.ts"],"names":[],"mappings":";;;AACA,6BAA6B;AAC7B,2CAAqD;AAGrD,4DAAwD;AAExD,MAAsB,UAAU;IAsB9B,YAAsB,KAAuB;QAC3C,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAClB;IACH,CAAC;IAED,IAAI,CAAC,KAAsB;QACzB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACtD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QACvC,IAAI,CAAC,cAAc,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AAC;SACb;IACH,CAAC;;AAvMH,gCAwMC;AApLgB,2BAAgB,GAAG,IAAI,oCAAgB,EAAE,CAAC"}
package/dist/medias.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- /// <reference types="multer" />
2
1
  /// <reference types="node" />
2
+ /// <reference types="multer" />
3
3
  import { BlobServiceClient } from '@azure/storage-blob';
4
4
  import { CommonService } from './common/common.service';
5
5
  import { BaseMedias } from './base/base.medias';
@@ -21,7 +21,7 @@ export declare class Medias extends BaseMedias {
21
21
  private static _Repo;
22
22
  constructor(commonService: CommonService, media?: IBaseMediasAttr);
23
23
  createMedias(isExternalMedias: boolean, stream?: Express.Multer.File, dbTransaction?: any): Promise<MediasModel>;
24
- updateMedias(isExternalMedias: boolean, stream?: Express.Multer.File): Promise<any>;
24
+ updateMedias(isExternalMedias: boolean, stream?: Express.Multer.File, dbTransaction?: any): Promise<any>;
25
25
  private IsStorageTypeAzure;
26
26
  private updateInternalMedia;
27
27
  private createInternalMedias;
@@ -39,7 +39,7 @@ export declare class Medias extends BaseMedias {
39
39
  private getFileFromLocal;
40
40
  encrypt(fileBuffer: Buffer): Promise<MediaFile>;
41
41
  decrypt(file: MediaFile): Promise<MediaFile>;
42
- delete(): Promise<any>;
42
+ delete(dbTransaction?: any): Promise<any>;
43
43
  postInternal(fileStream: Express.Multer.File, createMediaDto: InternalMediaDto, userId: string, dbTransaction?: any): Promise<MediasModel>;
44
44
  postExternal(createMediaDto: ExternalMediaDto, userId: string): Promise<IBaseMediasAttr>;
45
45
  getAll(rows: number, page: number, search: string): Promise<{
@@ -55,8 +55,8 @@ export declare class Medias extends BaseMedias {
55
55
  'Content-Length': number;
56
56
  };
57
57
  }>;
58
- remove(id: string, userId: string): Promise<any>;
59
- putExternal(id: string, updatedMediaDto: ExternalMediaDto, userId: string): Promise<any>;
60
- putInternal(fileStream: Express.Multer.File, id: string, updatedMediaDto: InternalMediaDto, userId: string): Promise<any>;
58
+ remove(id: string, userId: string, dbTransaction?: any): Promise<any>;
59
+ putExternal(id: string, updatedMediaDto: ExternalMediaDto, userId: string, dbTransaction?: any): Promise<any>;
60
+ putInternal(fileStream: Express.Multer.File, id: string, updatedMediaDto: InternalMediaDto, userId: string, dbTransaction?: any): Promise<any>;
61
61
  }
62
62
  export {};
package/dist/medias.js CHANGED
@@ -62,7 +62,6 @@ class Medias extends base_medias_1.BaseMedias {
62
62
  activity.EntityValueBefore = JSON.stringify({});
63
63
  activity.EntityValueAfter = JSON.stringify(Object.assign({}, media.get({ plain: true })));
64
64
  await activity.create(loginUser, dbTransaction);
65
- await dbTransaction.commit();
66
65
  }
67
66
  return media;
68
67
  }
@@ -70,12 +69,15 @@ class Medias extends base_medias_1.BaseMedias {
70
69
  throw error;
71
70
  }
72
71
  }
73
- async updateMedias(isExternalMedias, stream) {
72
+ async updateMedias(isExternalMedias, stream, dbTransaction) {
74
73
  try {
75
74
  const oldMedia = await super.findOne({
76
75
  where: { MediaId: this.MediaId },
76
+ transaction: dbTransaction,
77
+ });
78
+ const media = await super.update({
79
+ transaction: dbTransaction,
77
80
  });
78
- const media = await super.update();
79
81
  if (!isExternalMedias) {
80
82
  await this.updateInternalMedia(stream, oldMedia);
81
83
  }
@@ -92,7 +94,6 @@ class Medias extends base_medias_1.BaseMedias {
92
94
  activity.EntityValueBefore = JSON.stringify(Object.assign({}, oldMedia.get({ plain: true })));
93
95
  activity.EntityValueAfter = JSON.stringify(Object.assign({}, media.get({ plain: true })));
94
96
  await activity.create(loginUser, dbTransaction);
95
- await dbTransaction.commit();
96
97
  }
97
98
  return media;
98
99
  }
@@ -365,9 +366,11 @@ class Medias extends base_medias_1.BaseMedias {
365
366
  throw error;
366
367
  }
367
368
  }
368
- async delete() {
369
+ async delete(dbTransaction) {
369
370
  try {
370
- const data = await super.delete();
371
+ const data = await super.delete({
372
+ transaction: dbTransaction,
373
+ });
371
374
  if (this.IsExternalYN === 'N') {
372
375
  if (this.IsStorageTypeAzure()) {
373
376
  await this.deleteUploadedFileFromAzure(this.URL, this.FileName, this.FileExtension, this.IsEncryptedYN);
@@ -378,7 +381,6 @@ class Medias extends base_medias_1.BaseMedias {
378
381
  }
379
382
  const sessionService = await sso_1.SessionService.init();
380
383
  const loginUser = await sso_1.LoginUser.init(sessionService, this.UpdatedById);
381
- const dbTransaction = await activity_history_1.ActivityHistoryDB.getConnection().transaction();
382
384
  const activity = new activity_history_1.Activity();
383
385
  activity.ActivityId = cuid();
384
386
  activity.Action = activity_history_1.ActionEnum.DELETE;
@@ -388,7 +390,6 @@ class Medias extends base_medias_1.BaseMedias {
388
390
  activity.EntityValueBefore = JSON.stringify(data);
389
391
  activity.EntityValueAfter = JSON.stringify({});
390
392
  await activity.create(loginUser, dbTransaction);
391
- await dbTransaction.commit();
392
393
  return { message: 'Media has been deleted.' };
393
394
  }
394
395
  catch (error) {
@@ -476,9 +477,12 @@ class Medias extends base_medias_1.BaseMedias {
476
477
  throw error;
477
478
  }
478
479
  }
479
- async remove(id, userId) {
480
+ async remove(id, userId, dbTransaction) {
480
481
  try {
481
- const media = await this.findOne({ where: { MediaId: id } });
482
+ const media = await this.findOne({
483
+ where: { MediaId: id },
484
+ transaction: dbTransaction,
485
+ });
482
486
  if (!media) {
483
487
  throw new common_1.NotFoundException(`Media not found with id ${id}`);
484
488
  }
@@ -490,29 +494,35 @@ class Medias extends base_medias_1.BaseMedias {
490
494
  throw error;
491
495
  }
492
496
  }
493
- async putExternal(id, updatedMediaDto, userId) {
497
+ async putExternal(id, updatedMediaDto, userId, dbTransaction) {
494
498
  try {
495
- const media = await this.findOne({ where: { MediaId: id } });
499
+ const media = await this.findOne({
500
+ where: { MediaId: id },
501
+ transaction: dbTransaction,
502
+ });
496
503
  if (!media) {
497
504
  throw new common_1.NotFoundException(`Media not found with id ${id}`);
498
505
  }
499
506
  const mediaAttr = Object.assign(Object.assign(Object.assign({}, media.get({ plain: true })), updatedMediaDto), { UpdatedAt: new Date(), UpdatedById: userId });
500
507
  this.init(mediaAttr);
501
- return await this.updateMedias(true);
508
+ return await this.updateMedias(true, null, dbTransaction);
502
509
  }
503
510
  catch (error) {
504
511
  throw error;
505
512
  }
506
513
  }
507
- async putInternal(fileStream, id, updatedMediaDto, userId) {
514
+ async putInternal(fileStream, id, updatedMediaDto, userId, dbTransaction) {
508
515
  try {
509
- const media = await this.findOne({ where: { MediaId: id } });
516
+ const media = await this.findOne({
517
+ where: { MediaId: id },
518
+ transaction: dbTransaction,
519
+ });
510
520
  if (!media) {
511
521
  throw new common_1.NotFoundException(`Media not found with id ${id}`);
512
522
  }
513
523
  const mediaAttr = Object.assign(Object.assign(Object.assign({}, media.get({ plain: true })), updatedMediaDto), { UpdatedAt: new Date(), UpdatedById: userId });
514
524
  this.init(mediaAttr);
515
- return await this.updateMedias(false, fileStream);
525
+ return await this.updateMedias(false, fileStream, dbTransaction);
516
526
  }
517
527
  catch (error) {
518
528
  throw error;