@tomei/media 0.7.3 → 0.7.6

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 (49) hide show
  1. package/.commitlintrc.json +22 -22
  2. package/.eslintrc.js +66 -66
  3. package/.gitlab-ci.yml +16 -16
  4. package/.husky/commit-msg +15 -15
  5. package/.husky/pre-commit +7 -7
  6. package/.prettierrc +4 -4
  7. package/.prettierrc copy +3 -3
  8. package/README.md +93 -93
  9. package/dist/common/common.service.js.map +1 -1
  10. package/dist/medias.d.ts +1 -1
  11. package/dist/medias.js +2 -2
  12. package/dist/medias.js.map +1 -1
  13. package/dist/medias.repository.js +2 -2
  14. package/dist/medias.repository.js.map +1 -1
  15. package/dist/tsconfig.tsbuildinfo +1 -1
  16. package/migration/0001-add-defaultyn-hiddenyn-to-media-table.js +36 -36
  17. package/migration/media-migration.js +82 -82
  18. package/nest-cli.json +18 -18
  19. package/package.json +77 -75
  20. package/sonar-project.properties +12 -12
  21. package/src/base/base.medias.ts +210 -210
  22. package/src/base/base.repository.abstract.ts +28 -28
  23. package/src/base/base.repository.interface.ts +9 -9
  24. package/src/common/common.module.ts +10 -10
  25. package/src/common/common.service.ts +107 -107
  26. package/src/common/dto/add-field-translation.dto.ts +23 -23
  27. package/src/common/dto/get-media.dto.ts +12 -12
  28. package/src/database.ts +16 -16
  29. package/src/dto/external-media.dto.ts +49 -49
  30. package/src/dto/internal-medias.dto.ts +64 -64
  31. package/src/entities/medias.entity.ts +125 -125
  32. package/src/enum/index.ts +3 -3
  33. package/src/enum/medias.enum.ts +5 -5
  34. package/src/helpers/error.ts +12 -12
  35. package/src/helpers/index.ts +3 -3
  36. package/src/index.ts +24 -24
  37. package/src/interfaces/base.medias-attr.interface.ts +21 -21
  38. package/src/interfaces/medias.repository.interface.ts +4 -4
  39. package/src/medias.repository.ts +55 -55
  40. package/src/medias.ts +724 -724
  41. package/src/pipe/append-id.pipe.ts +15 -15
  42. package/src/pipe/validate-enum.pipe.ts +31 -31
  43. package/src/pipe/validate-id.pipe.ts +18 -18
  44. package/src/pipe/validate-search.pipe.ts +44 -44
  45. package/src/responses/deleted.response.ts +6 -6
  46. package/src/responses/pagination.response.ts +10 -10
  47. package/tsconfig.build.json +4 -4
  48. package/tsconfig.json +29 -29
  49. package/tslint.json +18 -18
@@ -1,36 +1,36 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- async up(queryInterface, Sequelize) {
5
- const table = await queryInterface.describeTable('common_Media');
6
-
7
- if (!table.hasOwnProperty('DefaultYN')) {
8
- queryInterface.addColumn('common_Media', 'DefaultYN', {
9
- type: Sequelize.ENUM(['Y', 'N']),
10
- allowNull: true,
11
- defaultValue: 'N',
12
- });
13
- }
14
-
15
- if (!table.hasOwnProperty('HiddenYN')) {
16
- queryInterface.addColumn('common_Media', 'HiddenYN', {
17
- type: Sequelize.ENUM(['Y', 'N']),
18
- allowNull: true,
19
- defaultValue: 'N',
20
- });
21
- }
22
- },
23
-
24
- down(queryInterface) {
25
- return queryInterface.sequelize.transaction((t) => {
26
- return Promise.all([
27
- queryInterface.removeColumn('common_Media', 'DefaultYN', {
28
- transaction: t,
29
- }),
30
- queryInterface.removeColumn('common_Media', 'HiddenYN', {
31
- transaction: t,
32
- }),
33
- ]);
34
- });
35
- },
36
- };
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ async up(queryInterface, Sequelize) {
5
+ const table = await queryInterface.describeTable('common_Media');
6
+
7
+ if (!table.hasOwnProperty('DefaultYN')) {
8
+ queryInterface.addColumn('common_Media', 'DefaultYN', {
9
+ type: Sequelize.ENUM(['Y', 'N']),
10
+ allowNull: true,
11
+ defaultValue: 'N',
12
+ });
13
+ }
14
+
15
+ if (!table.hasOwnProperty('HiddenYN')) {
16
+ queryInterface.addColumn('common_Media', 'HiddenYN', {
17
+ type: Sequelize.ENUM(['Y', 'N']),
18
+ allowNull: true,
19
+ defaultValue: 'N',
20
+ });
21
+ }
22
+ },
23
+
24
+ down(queryInterface) {
25
+ return queryInterface.sequelize.transaction((t) => {
26
+ return Promise.all([
27
+ queryInterface.removeColumn('common_Media', 'DefaultYN', {
28
+ transaction: t,
29
+ }),
30
+ queryInterface.removeColumn('common_Media', 'HiddenYN', {
31
+ transaction: t,
32
+ }),
33
+ ]);
34
+ });
35
+ },
36
+ };
@@ -1,83 +1,83 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- async up(queryInterface, Sequelize) {
5
- await queryInterface.createTable('common_Media', {
6
- MediaId: {
7
- type: Sequelize.STRING(30),
8
- primaryKey: true,
9
- allowNull: false,
10
- },
11
- ObjectId: {
12
- type: Sequelize.STRING(30),
13
- allowNull: false,
14
- },
15
- ObjectType: {
16
- type: Sequelize.STRING(200),
17
- allowNull: false,
18
- },
19
- Title: {
20
- type: Sequelize.STRING(200),
21
- allowNull: false,
22
- },
23
- Description: {
24
- type: Sequelize.TEXT,
25
- allowNull: true,
26
- },
27
- Type: {
28
- type: Sequelize.ENUM(['Photo', 'Video', 'Document']),
29
- allowNull: false,
30
- },
31
- IsExternalYN: {
32
- type: Sequelize.ENUM(['Y', 'N']),
33
- allowNull: false,
34
- },
35
- ExternalSource: {
36
- type: Sequelize.STRING(200),
37
- allowNull: true,
38
- },
39
- IsEncryptedYN: {
40
- type: Sequelize.ENUM(['Y', 'N']),
41
- allowNull: false,
42
- },
43
- FileName: {
44
- type: Sequelize.STRING(200),
45
- allowNull: true,
46
- },
47
- FileExtension: {
48
- type: Sequelize.STRING(10),
49
- allowNull: true,
50
- },
51
- FilePath: {
52
- type: Sequelize.STRING(200),
53
- allowNull: true,
54
- },
55
- URL: {
56
- type: Sequelize.STRING(200),
57
- allowNull: true,
58
- },
59
- CreatedAt: {
60
- allowNull: false,
61
- defaultValue: new Date(),
62
- type: Sequelize.DATE,
63
- },
64
- CreatedById: {
65
- allowNull: false,
66
- type: Sequelize.STRING,
67
- },
68
- UpdatedAt: {
69
- allowNull: false,
70
- defaultValue: new Date(),
71
- type: Sequelize.DATE,
72
- },
73
- UpdatedById: {
74
- allowNull: false,
75
- type: Sequelize.STRING,
76
- },
77
- });
78
- },
79
-
80
- async down(queryInterface) {
81
- await queryInterface.dropTable('common_Media');
82
- },
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ async up(queryInterface, Sequelize) {
5
+ await queryInterface.createTable('common_Media', {
6
+ MediaId: {
7
+ type: Sequelize.STRING(30),
8
+ primaryKey: true,
9
+ allowNull: false,
10
+ },
11
+ ObjectId: {
12
+ type: Sequelize.STRING(30),
13
+ allowNull: false,
14
+ },
15
+ ObjectType: {
16
+ type: Sequelize.STRING(200),
17
+ allowNull: false,
18
+ },
19
+ Title: {
20
+ type: Sequelize.STRING(200),
21
+ allowNull: false,
22
+ },
23
+ Description: {
24
+ type: Sequelize.TEXT,
25
+ allowNull: true,
26
+ },
27
+ Type: {
28
+ type: Sequelize.ENUM(['Photo', 'Video', 'Document']),
29
+ allowNull: false,
30
+ },
31
+ IsExternalYN: {
32
+ type: Sequelize.ENUM(['Y', 'N']),
33
+ allowNull: false,
34
+ },
35
+ ExternalSource: {
36
+ type: Sequelize.STRING(200),
37
+ allowNull: true,
38
+ },
39
+ IsEncryptedYN: {
40
+ type: Sequelize.ENUM(['Y', 'N']),
41
+ allowNull: false,
42
+ },
43
+ FileName: {
44
+ type: Sequelize.STRING(200),
45
+ allowNull: true,
46
+ },
47
+ FileExtension: {
48
+ type: Sequelize.STRING(10),
49
+ allowNull: true,
50
+ },
51
+ FilePath: {
52
+ type: Sequelize.STRING(200),
53
+ allowNull: true,
54
+ },
55
+ URL: {
56
+ type: Sequelize.STRING(200),
57
+ allowNull: true,
58
+ },
59
+ CreatedAt: {
60
+ allowNull: false,
61
+ defaultValue: new Date(),
62
+ type: Sequelize.DATE,
63
+ },
64
+ CreatedById: {
65
+ allowNull: false,
66
+ type: Sequelize.STRING,
67
+ },
68
+ UpdatedAt: {
69
+ allowNull: false,
70
+ defaultValue: new Date(),
71
+ type: Sequelize.DATE,
72
+ },
73
+ UpdatedById: {
74
+ allowNull: false,
75
+ type: Sequelize.STRING,
76
+ },
77
+ });
78
+ },
79
+
80
+ async down(queryInterface) {
81
+ await queryInterface.dropTable('common_Media');
82
+ },
83
83
  };
package/nest-cli.json CHANGED
@@ -1,19 +1,19 @@
1
- {
2
- "language": "ts",
3
- "collection": "@nestjs/schematics",
4
- "sourceRoot": "src",
5
- "projects": {
6
- "media": {
7
- "type": "library",
8
- "root": "libs/media",
9
- "entryFile": "index",
10
- "sourceRoot": "libs/media/src",
11
- "compilerOptions": {
12
- "tsConfigPath": "libs/media/tsconfig.lib.json"
13
- }
14
- }
15
- },
16
- "compilerOptions": {
17
- "webpack": true
18
- }
1
+ {
2
+ "language": "ts",
3
+ "collection": "@nestjs/schematics",
4
+ "sourceRoot": "src",
5
+ "projects": {
6
+ "media": {
7
+ "type": "library",
8
+ "root": "libs/media",
9
+ "entryFile": "index",
10
+ "sourceRoot": "libs/media/src",
11
+ "compilerOptions": {
12
+ "tsConfigPath": "libs/media/tsconfig.lib.json"
13
+ }
14
+ }
15
+ },
16
+ "compilerOptions": {
17
+ "webpack": true
18
+ }
19
19
  }
package/package.json CHANGED
@@ -1,75 +1,77 @@
1
- {
2
- "name": "@tomei/media",
3
- "version": "0.7.3",
4
- "description": "NestJS package for media module",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "start:dev": "tsc -w",
8
- "build": "tsc",
9
- "prepare": "npm run build",
10
- "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"libs/**/*.ts\"",
11
- "lint": "tslint -p tsconfig.json -c tslint.json",
12
- "eslint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
13
- },
14
- "keywords": [
15
- "nestjs",
16
- "tomei",
17
- "media"
18
- ],
19
- "author": "Faiz Shahudin <faiz@tomei.com.my>",
20
- "license": "ISC",
21
- "repository": {
22
- "type": "git",
23
- "url": "https://gitlab.com/tomei-package/media.git"
24
- },
25
- "peerDependencies": {
26
- "@azure/storage-blob": "^12.11.0",
27
- "@nestjs/common": "^10.3.3",
28
- "@nestjs/config": "^3.2.0",
29
- "@nestjs/core": "^10.3.3",
30
- "@nestjs/platform-express": "^10.2.7",
31
- "@nestjs/sequelize": "^10.0.1",
32
- "@tomei/activity-history": "^0.2.15",
33
- "@tomei/config": "^0.3.11",
34
- "@tomei/general": "^0.14.1",
35
- "@tomei/mailer": "^0.5.14",
36
- "@tomei/sso": "^0.35.6",
37
- "@types/express": "^4.17.13",
38
- "axios": "^1.6.0",
39
- "class-transformer": "^0.5.1",
40
- "class-validator": "^0.14.0",
41
- "cuid": "^3.0.0",
42
- "multer": "^1.4.5-lts.1",
43
- "sequelize-typescript": "^2.1.3"
44
- },
45
- "devDependencies": {
46
- "@nestjs/swagger": "^7.4.0",
47
- "@types/multer": "^1.4.12",
48
- "@types/node": "^22.5.2",
49
- "@types/sequelize": "^4.28.20",
50
- "@typescript-eslint/eslint-plugin": "^5.33.0",
51
- "eslint": "^8.21.0",
52
- "eslint-config-prettier": "^8.5.0",
53
- "eslint-plugin-prettier": "^4.2.1",
54
- "husky": "^8.0.3",
55
- "lint-staged": "^11.1.2",
56
- "prettier": "^2.7.1",
57
- "ts-node": "^10.9.2",
58
- "tsc-watch": "^6.2.0",
59
- "tsconfig-paths": "^4.2.0",
60
- "tslint": "^6.1.3",
61
- "typescript": "^5.5.4"
62
- },
63
- "publishConfig": {
64
- "access": "public"
65
- },
66
- "lint-staged": {
67
- "*/**/*.{js,ts,tsx}": [
68
- "npm run lint",
69
- "npm run eslint",
70
- "npm run format",
71
- "npm run build",
72
- "git add ."
73
- ]
74
- }
75
- }
1
+ {
2
+ "name": "@tomei/media",
3
+ "version": "0.7.6",
4
+ "description": "NestJS package for media module",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "start:dev": "tsc -w",
8
+ "build": "tsc",
9
+ "prepare": "npm run build",
10
+ "format": "prettier --write \"src/**/*.ts\"",
11
+ "lint": "tslint -p tsconfig.json -c tslint.json",
12
+ "eslint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
13
+ },
14
+ "keywords": [
15
+ "nestjs",
16
+ "tomei",
17
+ "media"
18
+ ],
19
+ "author": "ITD Developer <itd+developers@tomei.com.my>",
20
+ "license": "ISC",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://gitlab.com/tomei-package/media.git"
24
+ },
25
+ "peerDependencies": {
26
+ "@azure/storage-blob": "^12.25.0",
27
+ "@nestjs/common": "^10.3.3",
28
+ "@nestjs/config": "^3.2.0",
29
+ "@nestjs/core": "^10.3.3",
30
+ "@nestjs/platform-express": "^10.2.7",
31
+ "@nestjs/sequelize": "^10.0.1",
32
+ "@nestjs/swagger": "^8.0.7",
33
+ "@tomei/activity-history": "^0.2.20",
34
+ "@tomei/config": "^0.3.18",
35
+ "@tomei/general": "^0.20.1",
36
+ "@tomei/mailer": "^0.5.18",
37
+ "@tomei/sso": "^0.51.2",
38
+ "axios": "^1.7.7",
39
+ "class-transformer": "^0.5.1",
40
+ "class-validator": "^0.14.1",
41
+ "cuid": "^3.0.0",
42
+ "multer": "^1.4.5-lts.1",
43
+ "sequelize": "^6.37.5",
44
+ "sequelize-typescript": "^2.1.6"
45
+ },
46
+ "devDependencies": {
47
+ "@commitlint/config-conventional": "^19.6.0",
48
+ "@types/express": "^5.0.0",
49
+ "@types/multer": "^1.4.12",
50
+ "@types/node": "^22.9.3",
51
+ "@types/sequelize": "^4.28.20",
52
+ "@typescript-eslint/eslint-plugin": "^8.15.0",
53
+ "eslint": "^9.15.0",
54
+ "eslint-config-prettier": "^9.1.0",
55
+ "eslint-plugin-prettier": "^5.2.1",
56
+ "husky": "^9.1.7",
57
+ "lint-staged": "^15.2.10",
58
+ "prettier": "^3.3.3",
59
+ "ts-node": "^10.9.2",
60
+ "tsc-watch": "^6.2.1",
61
+ "tsconfig-paths": "^4.2.0",
62
+ "tslint": "^6.1.3",
63
+ "typescript": "^5.7.2"
64
+ },
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "lint-staged": {
69
+ "*/**/*.{js,ts,tsx}": [
70
+ "npm run lint",
71
+ "npm run eslint",
72
+ "npm run format",
73
+ "npm run build",
74
+ "git add ."
75
+ ]
76
+ }
77
+ }
@@ -1,13 +1,13 @@
1
- sonar.projectKey=all-tomei-projects_media
2
- sonar.organization=all-tomei-projects
3
-
4
- # This is the name and version displayed in the SonarCloud UI.
5
- #sonar.projectName=Media
6
- #sonar.projectVersion=1.0
7
-
8
-
9
- # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
10
- #sonar.sources=.
11
-
12
- # Encoding of the source code. Default is default system encoding
1
+ sonar.projectKey=all-tomei-projects_media
2
+ sonar.organization=all-tomei-projects
3
+
4
+ # This is the name and version displayed in the SonarCloud UI.
5
+ #sonar.projectName=Media
6
+ #sonar.projectVersion=1.0
7
+
8
+
9
+ # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
10
+ #sonar.sources=.
11
+
12
+ # Encoding of the source code. Default is default system encoding
13
13
  #sonar.sourceEncoding=UTF-8