@duvdu-v1/duvdu 1.1.200 → 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.
@@ -36,8 +36,8 @@ export interface IcopyRights {
36
36
  };
37
37
  address: string;
38
38
  location: {
39
- lat: number;
40
- lng: number;
39
+ type: 'Point';
40
+ coordinates: [number, number];
41
41
  };
42
42
  searchKeywords: string[];
43
43
  showOnHome: boolean;
@@ -22,11 +22,11 @@ exports.CopyRights = (0, mongoose_1.model)(model_names_1.MODELS.copyrights, new
22
22
  subCategory: {
23
23
  ar: String,
24
24
  en: String,
25
- _id: String
25
+ _id: String,
26
26
  },
27
27
  location: {
28
- lat: { type: Number, default: null },
29
- lng: { type: Number, default: null },
28
+ type: { type: String, default: 'Point' },
29
+ coordinates: { type: [Number], default: [31.2357, 30.0444] },
30
30
  },
31
31
  minBudget: { type: Number, default: null },
32
32
  maxBudget: { type: Number, default: null },
@@ -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' }));
@@ -59,8 +59,8 @@ export interface IprojectCycle {
59
59
  inviteStatus: InviteStatus;
60
60
  }[];
61
61
  location: {
62
- lat: number;
63
- lng: number;
62
+ type: 'Point';
63
+ coordinates: [number, number];
64
64
  };
65
65
  address: string;
66
66
  searchKeyWords: string[];
@@ -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 },
@@ -29,7 +33,10 @@ exports.ProjectCycle = (0, mongoose_1.model)(model_names_1.MODELS.portfolioPost,
29
33
  inviteStatus: { type: String, enum: InviteStatus, default: InviteStatus.pending },
30
34
  },
31
35
  ],
32
- location: { lat: { type: Number, default: 0 }, lng: { type: Number, default: 0 } },
36
+ location: {
37
+ type: { type: String, default: 'Point' },
38
+ coordinates: { type: [Number], default: [31.2357, 30.0444] },
39
+ },
33
40
  address: { type: String, default: null },
34
41
  searchKeyWords: [String],
35
42
  showOnHome: { type: Boolean, default: true },
@@ -50,4 +57,4 @@ exports.ProjectCycle = (0, mongoose_1.model)(model_names_1.MODELS.portfolioPost,
50
57
  },
51
58
  minBudget: { type: Number, default: null },
52
59
  maxBudget: { type: Number, default: null },
53
- }, { timestamps: true, collection: model_names_1.MODELS.portfolioPost }));
60
+ }, { timestamps: true, collection: model_names_1.MODELS.portfolioPost }).index({ location: '2dsphere' }));
@@ -52,8 +52,8 @@ export interface Irental {
52
52
  email: string;
53
53
  description: string;
54
54
  location: {
55
- lat: number;
56
- lng: number;
55
+ type: 'Point';
56
+ coordinates: [number, number];
57
57
  };
58
58
  address: string;
59
59
  searchKeywords: string[];
@@ -22,7 +22,10 @@ exports.Rentals = (0, mongoose_1.model)('rentals', new mongoose_1.Schema({
22
22
  phoneNumber: String,
23
23
  email: String,
24
24
  description: String,
25
- location: { lat: Number, lng: Number },
25
+ location: {
26
+ type: { type: String, default: 'Point' },
27
+ coordinates: { type: [Number], default: [31.2357, 30.0444] },
28
+ },
26
29
  address: String,
27
30
  searchKeywords: [String],
28
31
  insurance: { type: Number, default: null },
@@ -37,4 +40,6 @@ exports.Rentals = (0, mongoose_1.model)('rentals', new mongoose_1.Schema({
37
40
  rate: { ratersCounter: Number, totalRates: Number },
38
41
  minBudget: { type: Number, default: null },
39
42
  maxBudget: { type: Number, default: null },
40
- }, { 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,12 +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,
37
38
  ContentDisposition: 'inline',
39
+ ContentType: contentType,
38
40
  }, (err, data) => {
39
41
  if (err)
40
42
  reject(err);
@@ -58,5 +60,63 @@ class Bucket {
58
60
  });
59
61
  });
60
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
+ }
61
121
  }
62
122
  exports.Bucket = Bucket;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.200",
3
+ "version": "1.1.201",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [