@timardex/cluemart-server-shared 3.0.0 → 3.0.1

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.
@@ -356,9 +356,8 @@ var AdBookingModel = import_mongoose3.default.models.AdBooking || import_mongoos
356
356
  // src/mongoose/ad/AdMetrics.ts
357
357
  var import_cluemart_shared4 = require("@timardex/cluemart-shared");
358
358
  var import_mongoose4 = __toESM(require("mongoose"));
359
- var schema4 = new import_mongoose4.default.Schema(
359
+ var ResourceMetricsSchema = new import_mongoose4.default.Schema(
360
360
  {
361
- adId: { ref: "Ad", required: true, type: String },
362
361
  clicks: { default: 0, required: true, type: Number },
363
362
  date: {
364
363
  immutable: true,
@@ -383,9 +382,25 @@ var schema4 = new import_mongoose4.default.Schema(
383
382
  type: String
384
383
  }
385
384
  },
385
+ { _id: false }
386
+ );
387
+ var schema4 = new import_mongoose4.default.Schema(
388
+ {
389
+ adId: { ref: "Ad", required: true, type: String },
390
+ resource: { default: [], type: [ResourceMetricsSchema] }
391
+ },
386
392
  { timestamps: true }
387
393
  );
388
- schema4.index({ adId: 1, date: 1, placement: 1, platform: 1 }, { unique: true });
394
+ schema4.index({ adId: 1 }, { unique: true });
395
+ schema4.index(
396
+ {
397
+ adId: 1,
398
+ "resource.date": 1,
399
+ "resource.placement": 1,
400
+ "resource.platform": 1
401
+ },
402
+ { unique: true }
403
+ );
389
404
  var AdMetricsModel = import_mongoose4.default.models.AdMetrics || import_mongoose4.default.model("AdMetrics", schema4);
390
405
 
391
406
  // src/mongoose/BillingCatalog.ts