@timardex/cluemart-server-shared 4.0.8 → 4.1.0

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/dist/index.d.mts CHANGED
@@ -528,6 +528,27 @@ type SchemaAiImportedMarket = Omit<AiImportedMarket, "eventId" | "claimedByUserI
528
528
  duplicateHint?: string | null;
529
529
  /** Fields still missing before the market can be approved. */
530
530
  missingFields?: string[];
531
+ /**
532
+ * Set when an admin edits a queued candidate. The importer stops overwriting
533
+ * such a document's content on re-scrape (it only refreshes bookkeeping), so a
534
+ * reviewer's fix is never replaced by the source data; approval clears it.
535
+ */
536
+ reviewerEditedAt?: Date | null;
537
+ /**
538
+ * True while the published listing's city is unknown: approval fell back to
539
+ * the region because the document never carried one. The duplicate matcher
540
+ * treats such a listing as matching any city, which the publication key alone
541
+ * cannot express, so approvals of the same name + region are serialised.
542
+ * Rewritten by every approval (with the key), so a value left on an
543
+ * unpublished document is stale but self-correcting.
544
+ */
545
+ publicationCityUnknown?: boolean | null;
546
+ /**
547
+ * Normalized `region::name::city` key held only while the market is the
548
+ * published listing for that market. A unique partial index on it makes
549
+ * "one published listing per market" a durable constraint (see below).
550
+ */
551
+ publicationKey?: string | null;
531
552
  };
532
553
  declare const AiImportedMarketModel: mongoose__default.Model<SchemaAiImportedMarket, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaAiImportedMarket, {}, {}> & Omit<AiImportedMarket, "eventId" | "claimedByUserId" | "reviewedByUserId"> & {
533
554
  eventId?: mongoose__default.Types.ObjectId;
@@ -549,6 +570,27 @@ declare const AiImportedMarketModel: mongoose__default.Model<SchemaAiImportedMar
549
570
  duplicateHint?: string | null;
550
571
  /** Fields still missing before the market can be approved. */
551
572
  missingFields?: string[];
573
+ /**
574
+ * Set when an admin edits a queued candidate. The importer stops overwriting
575
+ * such a document's content on re-scrape (it only refreshes bookkeeping), so a
576
+ * reviewer's fix is never replaced by the source data; approval clears it.
577
+ */
578
+ reviewerEditedAt?: Date | null;
579
+ /**
580
+ * True while the published listing's city is unknown: approval fell back to
581
+ * the region because the document never carried one. The duplicate matcher
582
+ * treats such a listing as matching any city, which the publication key alone
583
+ * cannot express, so approvals of the same name + region are serialised.
584
+ * Rewritten by every approval (with the key), so a value left on an
585
+ * unpublished document is stale but self-correcting.
586
+ */
587
+ publicationCityUnknown?: boolean | null;
588
+ /**
589
+ * Normalized `region::name::city` key held only while the market is the
590
+ * published listing for that market. A unique partial index on it makes
591
+ * "one published listing per market" a durable constraint (see below).
592
+ */
593
+ publicationKey?: string | null;
552
594
  } & Required<{
553
595
  _id: string;
554
596
  }> & {
package/dist/index.d.ts CHANGED
@@ -528,6 +528,27 @@ type SchemaAiImportedMarket = Omit<AiImportedMarket, "eventId" | "claimedByUserI
528
528
  duplicateHint?: string | null;
529
529
  /** Fields still missing before the market can be approved. */
530
530
  missingFields?: string[];
531
+ /**
532
+ * Set when an admin edits a queued candidate. The importer stops overwriting
533
+ * such a document's content on re-scrape (it only refreshes bookkeeping), so a
534
+ * reviewer's fix is never replaced by the source data; approval clears it.
535
+ */
536
+ reviewerEditedAt?: Date | null;
537
+ /**
538
+ * True while the published listing's city is unknown: approval fell back to
539
+ * the region because the document never carried one. The duplicate matcher
540
+ * treats such a listing as matching any city, which the publication key alone
541
+ * cannot express, so approvals of the same name + region are serialised.
542
+ * Rewritten by every approval (with the key), so a value left on an
543
+ * unpublished document is stale but self-correcting.
544
+ */
545
+ publicationCityUnknown?: boolean | null;
546
+ /**
547
+ * Normalized `region::name::city` key held only while the market is the
548
+ * published listing for that market. A unique partial index on it makes
549
+ * "one published listing per market" a durable constraint (see below).
550
+ */
551
+ publicationKey?: string | null;
531
552
  };
532
553
  declare const AiImportedMarketModel: mongoose__default.Model<SchemaAiImportedMarket, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaAiImportedMarket, {}, {}> & Omit<AiImportedMarket, "eventId" | "claimedByUserId" | "reviewedByUserId"> & {
533
554
  eventId?: mongoose__default.Types.ObjectId;
@@ -549,6 +570,27 @@ declare const AiImportedMarketModel: mongoose__default.Model<SchemaAiImportedMar
549
570
  duplicateHint?: string | null;
550
571
  /** Fields still missing before the market can be approved. */
551
572
  missingFields?: string[];
573
+ /**
574
+ * Set when an admin edits a queued candidate. The importer stops overwriting
575
+ * such a document's content on re-scrape (it only refreshes bookkeeping), so a
576
+ * reviewer's fix is never replaced by the source data; approval clears it.
577
+ */
578
+ reviewerEditedAt?: Date | null;
579
+ /**
580
+ * True while the published listing's city is unknown: approval fell back to
581
+ * the region because the document never carried one. The duplicate matcher
582
+ * treats such a listing as matching any city, which the publication key alone
583
+ * cannot express, so approvals of the same name + region are serialised.
584
+ * Rewritten by every approval (with the key), so a value left on an
585
+ * unpublished document is stale but self-correcting.
586
+ */
587
+ publicationCityUnknown?: boolean | null;
588
+ /**
589
+ * Normalized `region::name::city` key held only while the market is the
590
+ * published listing for that market. A unique partial index on it makes
591
+ * "one published listing per market" a durable constraint (see below).
592
+ */
593
+ publicationKey?: string | null;
552
594
  } & Required<{
553
595
  _id: string;
554
596
  }> & {
package/dist/index.mjs CHANGED
@@ -1153,6 +1153,8 @@ var schema8 = new MongooseSchema7(
1153
1153
  missingFields: { required: false, type: [String] },
1154
1154
  name: { required: true, type: String },
1155
1155
  openingHours: { required: false, type: [String] },
1156
+ publicationCityUnknown: { default: false, required: false, type: Boolean },
1157
+ publicationKey: { required: false, type: String },
1156
1158
  rainOrShine: { required: true, type: Boolean },
1157
1159
  rating: { required: false, type: Number },
1158
1160
  region: { required: false, type: String },
@@ -1164,6 +1166,7 @@ var schema8 = new MongooseSchema7(
1164
1166
  required: false,
1165
1167
  type: mongoose11.Schema.Types.ObjectId
1166
1168
  },
1169
+ reviewerEditedAt: { default: null, required: false, type: Date },
1167
1170
  reviewStatus: {
1168
1171
  default: EnumImportedMarketReviewStatus.PENDING,
1169
1172
  enum: Object.values(EnumImportedMarketReviewStatus),
@@ -1200,6 +1203,16 @@ schema8.index({
1200
1203
  _id: 1
1201
1204
  });
1202
1205
  schema8.index({ region: 1, searchName: 1 });
1206
+ schema8.index(
1207
+ { publicationKey: 1 },
1208
+ {
1209
+ name: "ai_market_publication_key",
1210
+ partialFilterExpression: {
1211
+ publicationKey: { $exists: true, $type: "string" }
1212
+ },
1213
+ unique: true
1214
+ }
1215
+ );
1203
1216
  schema8.index({ slug: 1 });
1204
1217
  schema8.index({ reviewStatus: 1 });
1205
1218
  schema8.index({ description: "text", name: "text" });
@@ -2159,6 +2172,13 @@ var schema20 = new MongooseSchema21(
2159
2172
  {
2160
2173
  ...baseResourceFields,
2161
2174
  // Importing base resource fields from global.ts
2175
+ // Claim link of the AI-imported market this event was created from, the
2176
+ // counterpart of `googlePlaceId`. Written once by `createEvent`.
2177
+ aiImportedMarketSourceKey: {
2178
+ default: null,
2179
+ required: false,
2180
+ type: String
2181
+ },
2162
2182
  claimed: { default: true, required: false, type: Boolean },
2163
2183
  dateTime: { required: true, type: [dateTimeSchema] },
2164
2184
  eventInfoId: {