@duvdu-v1/duvdu 1.1.199 → 1.1.201

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.
@@ -35,4 +35,5 @@ exports.CopyRights = (0, mongoose_1.model)(model_names_1.MODELS.copyrights, new
35
35
  collection: model_names_1.MODELS.copyrights,
36
36
  })
37
37
  .index({ createdAt: 1, updatedAt: -1 })
38
- .index({ searchKeywords: 'text' }));
38
+ .index({ searchKeywords: 'text' })
39
+ .index({ location: '2dsphere' }));
@@ -12,7 +12,11 @@ var InviteStatus;
12
12
  exports.ProjectCycle = (0, mongoose_1.model)(model_names_1.MODELS.portfolioPost, new mongoose_1.Schema({
13
13
  user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
14
14
  category: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.category },
15
- subCategory: { ar: { type: String, default: null }, en: { type: String, default: null }, _id: String },
15
+ subCategory: {
16
+ ar: { type: String, default: null },
17
+ en: { type: String, default: null },
18
+ _id: String,
19
+ },
16
20
  tags: [{ ar: { type: String, default: null }, en: { type: String, default: null } }],
17
21
  cover: { type: String, default: null },
18
22
  audioCover: { type: String, default: null },
@@ -53,4 +57,4 @@ exports.ProjectCycle = (0, mongoose_1.model)(model_names_1.MODELS.portfolioPost,
53
57
  },
54
58
  minBudget: { type: Number, default: null },
55
59
  maxBudget: { type: Number, default: null },
56
- }, { timestamps: true, collection: model_names_1.MODELS.portfolioPost }));
60
+ }, { timestamps: true, collection: model_names_1.MODELS.portfolioPost }).index({ location: '2dsphere' }));
@@ -40,4 +40,6 @@ exports.Rentals = (0, mongoose_1.model)('rentals', new mongoose_1.Schema({
40
40
  rate: { ratersCounter: Number, totalRates: Number },
41
41
  minBudget: { type: Number, default: null },
42
42
  maxBudget: { type: Number, default: null },
43
- }, { collection: 'rentals', timestamps: true }).index({ createdAt: 1, updatedAt: -1 }));
43
+ }, { collection: 'rentals', timestamps: true })
44
+ .index({ createdAt: 1, updatedAt: -1 })
45
+ .index({ location: '2dsphere' }));
@@ -5,4 +5,5 @@ export declare class Bucket {
5
5
  constructor();
6
6
  saveBucketFiles(folder: string, ...files: Express.Multer.File[]): Promise<void>;
7
7
  removeBucketFiles(...filePaths: string[]): Promise<void>;
8
+ private getContentType;
8
9
  }
@@ -29,11 +29,14 @@ class Bucket {
29
29
  return __awaiter(this, void 0, void 0, function* () {
30
30
  for (const file of files) {
31
31
  const fileStream = fs_1.default.createReadStream(path_1.default.resolve(`media/${folder}/${file.filename}`));
32
+ const contentType = this.getContentType(file.filename);
32
33
  yield new Promise((resolve, reject) => {
33
34
  this.s3.putObject({
34
35
  Bucket: this.bucketName,
35
36
  Key: `${folder}/${file.filename}`,
36
37
  Body: fileStream,
38
+ ContentDisposition: 'inline',
39
+ ContentType: contentType,
37
40
  }, (err, data) => {
38
41
  if (err)
39
42
  reject(err);
@@ -57,5 +60,63 @@ class Bucket {
57
60
  });
58
61
  });
59
62
  }
63
+ getContentType(filename) {
64
+ const ext = path_1.default.extname(filename).toLowerCase();
65
+ switch (ext) {
66
+ // Video Types
67
+ case '.mp4':
68
+ return 'video/mp4';
69
+ case '.webm':
70
+ return 'video/webm';
71
+ case '.ogg':
72
+ return 'video/ogg';
73
+ case '.avi':
74
+ return 'video/x-msvideo';
75
+ case '.mov':
76
+ return 'video/quicktime';
77
+ case '.wmv':
78
+ return 'video/x-ms-wmv';
79
+ case '.mkv':
80
+ return 'video/x-matroska';
81
+ case '.flv':
82
+ return 'video/x-flv';
83
+ // Audio Types
84
+ case '.mp3':
85
+ return 'audio/mpeg';
86
+ case '.wav':
87
+ return 'audio/wav';
88
+ case '.aac':
89
+ return 'audio/aac';
90
+ case '.flac':
91
+ return 'audio/flac';
92
+ case '.m4a':
93
+ return 'audio/x-m4a';
94
+ case '.wma':
95
+ return 'audio/x-ms-wma';
96
+ // Image Types
97
+ case '.jpg':
98
+ case '.jpeg':
99
+ return 'image/jpeg';
100
+ case '.png':
101
+ return 'image/png';
102
+ case '.gif':
103
+ return 'image/gif';
104
+ case '.bmp':
105
+ return 'image/bmp';
106
+ case '.webp':
107
+ return 'image/webp';
108
+ case '.svg':
109
+ return 'image/svg+xml';
110
+ case '.tiff':
111
+ case '.tif':
112
+ return 'image/tiff';
113
+ // PDF and other document types
114
+ case '.pdf':
115
+ return 'application/pdf';
116
+ // Default fallback
117
+ default:
118
+ return 'application/octet-stream'; // Fallback for unknown types
119
+ }
120
+ }
60
121
  }
61
122
  exports.Bucket = Bucket;
package/package.json CHANGED
@@ -1,56 +1,56 @@
1
- {
2
- "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.199",
4
- "main": "./build/index.js",
5
- "types": "./build/index.d.ts",
6
- "files": [
7
- "build/**/*"
8
- ],
9
- "scripts": {
10
- "clean": "rimraf ./build",
11
- "build": "npm run clean && tsc",
12
- "fix:build": "mv ./build/common/src/* ./build && rm -rf ./build/auth ./build/common",
13
- "pub": "git add . && git commit -m \"updates\" && npm version patch && npm run build && npm publish",
14
- "lint": "eslint .",
15
- "lint:fix": "eslint --fix .",
16
- "format": "prettier --write ."
17
- },
18
- "keywords": [],
19
- "author": "motemed khaled",
20
- "license": "ISC",
21
- "dependencies": {
22
- "@types/express": "^4.17.21",
23
- "@types/express-session": "^1.18.0",
24
- "@types/jsonwebtoken": "^9.0.5",
25
- "@types/multer": "^1.4.11",
26
- "@types/node": "^20.11.0",
27
- "@typescript-eslint/eslint-plugin": "^6.19.0",
28
- "@typescript-eslint/parser": "^6.19.0",
29
- "aws-sdk": "^2.1595.0",
30
- "connect-redis": "^7.1.1",
31
- "express": "^4.18.2",
32
- "express-async-errors": "^3.1.1",
33
- "express-session": "^1.18.0",
34
- "express-validator": "^7.0.1",
35
- "jsonwebtoken": "^9.0.2",
36
- "mongoose": "^8.0.4",
37
- "multer": "^1.4.5-lts.1",
38
- "node-nats-streaming": "^0.3.2",
39
- "redis": "^4.6.13",
40
- "rimraf": "^5.0.5",
41
- "typescript": "^5.3.3",
42
- "uuid": "^9.0.1",
43
- "winston": "^3.13.0",
44
- "winston-daily-rotate-file": "^5.0.0"
45
- },
46
- "devDependencies": {
47
- "@types/uuid": "^9.0.8",
48
- "del-cli": "^5.1.0",
49
- "eslint": "^8.56.0",
50
- "eslint-config-prettier": "^9.1.0",
51
- "eslint-plugin-import": "^2.29.1",
52
- "eslint-plugin-prettier": "^5.1.3",
53
- "prettier": "^3.2.4"
54
- },
55
- "description": ""
56
- }
1
+ {
2
+ "name": "@duvdu-v1/duvdu",
3
+ "version": "1.1.201",
4
+ "main": "./build/index.js",
5
+ "types": "./build/index.d.ts",
6
+ "files": [
7
+ "build/**/*"
8
+ ],
9
+ "scripts": {
10
+ "clean": "rimraf ./build",
11
+ "build": "npm run clean && tsc",
12
+ "fix:build": "mv ./build/common/src/* ./build && rm -rf ./build/auth ./build/common",
13
+ "pub": "git add . && git commit -m \"updates\" && npm version patch && npm run build && npm publish",
14
+ "lint": "eslint .",
15
+ "lint:fix": "eslint --fix .",
16
+ "format": "prettier --write ."
17
+ },
18
+ "keywords": [],
19
+ "author": "motemed khaled",
20
+ "license": "ISC",
21
+ "dependencies": {
22
+ "@types/express": "^4.17.21",
23
+ "@types/express-session": "^1.18.0",
24
+ "@types/jsonwebtoken": "^9.0.5",
25
+ "@types/multer": "^1.4.11",
26
+ "@types/node": "^20.11.0",
27
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
28
+ "@typescript-eslint/parser": "^6.19.0",
29
+ "aws-sdk": "^2.1595.0",
30
+ "connect-redis": "^7.1.1",
31
+ "express": "^4.18.2",
32
+ "express-async-errors": "^3.1.1",
33
+ "express-session": "^1.18.0",
34
+ "express-validator": "^7.0.1",
35
+ "jsonwebtoken": "^9.0.2",
36
+ "mongoose": "^8.0.4",
37
+ "multer": "^1.4.5-lts.1",
38
+ "node-nats-streaming": "^0.3.2",
39
+ "redis": "^4.6.13",
40
+ "rimraf": "^5.0.5",
41
+ "typescript": "^5.3.3",
42
+ "uuid": "^9.0.1",
43
+ "winston": "^3.13.0",
44
+ "winston-daily-rotate-file": "^5.0.0"
45
+ },
46
+ "devDependencies": {
47
+ "@types/uuid": "^9.0.8",
48
+ "del-cli": "^5.1.0",
49
+ "eslint": "^8.56.0",
50
+ "eslint-config-prettier": "^9.1.0",
51
+ "eslint-plugin-import": "^2.29.1",
52
+ "eslint-plugin-prettier": "^5.1.3",
53
+ "prettier": "^3.2.4"
54
+ },
55
+ "description": ""
56
+ }