@duvdu-v1/duvdu 1.1.38 → 1.1.39

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.
@@ -48,4 +48,11 @@ const categorySchema = new mongoose_1.default.Schema({
48
48
  },
49
49
  },
50
50
  });
51
+ categorySchema.set('toJSON', {
52
+ transform: function (doc, ret) {
53
+ if (ret.image)
54
+ ret.image = process.env.BUCKET_HOST + '/' + ret.image;
55
+ return ret;
56
+ }
57
+ });
51
58
  exports.Categories = mongoose_1.default.model(model_names_1.MODELS.category, categorySchema);
@@ -49,3 +49,12 @@ exports.Message = (0, mongoose_1.model)(model_names_1.MODELS.messages, new mongo
49
49
  }
50
50
  }
51
51
  }));
52
+ exports.Message.schema.set('toJSON', {
53
+ transform: function (doc, ret) {
54
+ var _a;
55
+ if ((_a = ret.media) === null || _a === void 0 ? void 0 : _a.url) {
56
+ ret.media.url = process.env.BUCKET_HOST + '/' + ret.media.url;
57
+ }
58
+ return ret;
59
+ }
60
+ });
@@ -47,3 +47,14 @@ exports.PortfolioPosts = (0, mongoose_1.model)(model_names_1.MODELS.portfolioPos
47
47
  })
48
48
  .index({ createdAt: 1, updatedAt: -1 })
49
49
  .index({ title: 'text', desc: 'text', tools: 'text', searchKeywords: 'text' }));
50
+ exports.PortfolioPosts.schema.set('toJSON', {
51
+ transform: function (doc, ret) {
52
+ if (ret.cover) {
53
+ ret.cover = process.env.BUCKET_HOST + '/' + ret.cover;
54
+ }
55
+ if (ret.attachments) {
56
+ ret.attachments = ret.attachments.map((el) => process.env.BUCKET_HOST + '/' + el);
57
+ }
58
+ return ret;
59
+ }
60
+ });
@@ -82,3 +82,14 @@ exports.studioBooking = (0, mongoose_1.model)(model_names_1.MODELS.studioBooking
82
82
  },
83
83
  },
84
84
  }));
85
+ exports.studioBooking.schema.set('toJSON', {
86
+ transform: function (doc, ret) {
87
+ if (ret.cover) {
88
+ ret.cover = process.env.BUCKET_HOST + '/' + ret.cover;
89
+ }
90
+ if (ret.attachments) {
91
+ ret.attachments = ret.attachments.map((el) => process.env.BUCKET_HOST + '/' + el);
92
+ }
93
+ return ret;
94
+ }
95
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.38",
3
+ "version": "1.1.39",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [