@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.
- package/build/models/copyrights.model.d.ts +2 -2
- package/build/models/copyrights.model.js +5 -4
- package/build/models/portfolio-post.model.d.ts +2 -2
- package/build/models/portfolio-post.model.js +10 -3
- package/build/models/rental.model.d.ts +2 -2
- package/build/models/rental.model.js +7 -2
- package/build/utils/bucket.d.ts +1 -0
- package/build/utils/bucket.js +60 -0
- package/package.json +1 -1
|
@@ -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
|
-
|
|
29
|
-
|
|
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' }));
|
|
@@ -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: {
|
|
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: {
|
|
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' }));
|
|
@@ -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: {
|
|
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 })
|
|
43
|
+
}, { collection: 'rentals', timestamps: true })
|
|
44
|
+
.index({ createdAt: 1, updatedAt: -1 })
|
|
45
|
+
.index({ location: '2dsphere' }));
|
package/build/utils/bucket.d.ts
CHANGED
package/build/utils/bucket.js
CHANGED
|
@@ -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;
|