@duvdu-v1/duvdu 1.1.200 → 1.1.202

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,15 @@ 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,
40
+ ACL: 'public-read'
38
41
  }, (err, data) => {
39
42
  if (err)
40
43
  reject(err);
@@ -58,5 +61,63 @@ class Bucket {
58
61
  });
59
62
  });
60
63
  }
64
+ getContentType(filename) {
65
+ const ext = path_1.default.extname(filename).toLowerCase();
66
+ switch (ext) {
67
+ // Video Types
68
+ case '.mp4':
69
+ return 'video/mp4';
70
+ case '.webm':
71
+ return 'video/webm';
72
+ case '.ogg':
73
+ return 'video/ogg';
74
+ case '.avi':
75
+ return 'video/x-msvideo';
76
+ case '.mov':
77
+ return 'video/quicktime';
78
+ case '.wmv':
79
+ return 'video/x-ms-wmv';
80
+ case '.mkv':
81
+ return 'video/x-matroska';
82
+ case '.flv':
83
+ return 'video/x-flv';
84
+ // Audio Types
85
+ case '.mp3':
86
+ return 'audio/mpeg';
87
+ case '.wav':
88
+ return 'audio/wav';
89
+ case '.aac':
90
+ return 'audio/aac';
91
+ case '.flac':
92
+ return 'audio/flac';
93
+ case '.m4a':
94
+ return 'audio/x-m4a';
95
+ case '.wma':
96
+ return 'audio/x-ms-wma';
97
+ // Image Types
98
+ case '.jpg':
99
+ case '.jpeg':
100
+ return 'image/jpeg';
101
+ case '.png':
102
+ return 'image/png';
103
+ case '.gif':
104
+ return 'image/gif';
105
+ case '.bmp':
106
+ return 'image/bmp';
107
+ case '.webp':
108
+ return 'image/webp';
109
+ case '.svg':
110
+ return 'image/svg+xml';
111
+ case '.tiff':
112
+ case '.tif':
113
+ return 'image/tiff';
114
+ // PDF and other document types
115
+ case '.pdf':
116
+ return 'application/pdf';
117
+ // Default fallback
118
+ default:
119
+ return 'application/octet-stream'; // Fallback for unknown types
120
+ }
121
+ }
61
122
  }
62
123
  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.202",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [