@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.
@@ -140,6 +140,27 @@ type SchemaAiImportedMarket = Omit<AiImportedMarket, "eventId" | "claimedByUserI
140
140
  duplicateHint?: string | null;
141
141
  /** Fields still missing before the market can be approved. */
142
142
  missingFields?: string[];
143
+ /**
144
+ * Set when an admin edits a queued candidate. The importer stops overwriting
145
+ * such a document's content on re-scrape (it only refreshes bookkeeping), so a
146
+ * reviewer's fix is never replaced by the source data; approval clears it.
147
+ */
148
+ reviewerEditedAt?: Date | null;
149
+ /**
150
+ * True while the published listing's city is unknown: approval fell back to
151
+ * the region because the document never carried one. The duplicate matcher
152
+ * treats such a listing as matching any city, which the publication key alone
153
+ * cannot express, so approvals of the same name + region are serialised.
154
+ * Rewritten by every approval (with the key), so a value left on an
155
+ * unpublished document is stale but self-correcting.
156
+ */
157
+ publicationCityUnknown?: boolean | null;
158
+ /**
159
+ * Normalized `region::name::city` key held only while the market is the
160
+ * published listing for that market. A unique partial index on it makes
161
+ * "one published listing per market" a durable constraint (see below).
162
+ */
163
+ publicationKey?: string | null;
143
164
  };
144
165
  declare const AiImportedMarketModel: mongoose__default.Model<SchemaAiImportedMarket, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaAiImportedMarket, {}, {}> & Omit<AiImportedMarket, "eventId" | "claimedByUserId" | "reviewedByUserId"> & {
145
166
  eventId?: mongoose__default.Types.ObjectId;
@@ -161,6 +182,27 @@ declare const AiImportedMarketModel: mongoose__default.Model<SchemaAiImportedMar
161
182
  duplicateHint?: string | null;
162
183
  /** Fields still missing before the market can be approved. */
163
184
  missingFields?: string[];
185
+ /**
186
+ * Set when an admin edits a queued candidate. The importer stops overwriting
187
+ * such a document's content on re-scrape (it only refreshes bookkeeping), so a
188
+ * reviewer's fix is never replaced by the source data; approval clears it.
189
+ */
190
+ reviewerEditedAt?: Date | null;
191
+ /**
192
+ * True while the published listing's city is unknown: approval fell back to
193
+ * the region because the document never carried one. The duplicate matcher
194
+ * treats such a listing as matching any city, which the publication key alone
195
+ * cannot express, so approvals of the same name + region are serialised.
196
+ * Rewritten by every approval (with the key), so a value left on an
197
+ * unpublished document is stale but self-correcting.
198
+ */
199
+ publicationCityUnknown?: boolean | null;
200
+ /**
201
+ * Normalized `region::name::city` key held only while the market is the
202
+ * published listing for that market. A unique partial index on it makes
203
+ * "one published listing per market" a durable constraint (see below).
204
+ */
205
+ publicationKey?: string | null;
164
206
  } & Required<{
165
207
  _id: string;
166
208
  }> & {
@@ -140,6 +140,27 @@ type SchemaAiImportedMarket = Omit<AiImportedMarket, "eventId" | "claimedByUserI
140
140
  duplicateHint?: string | null;
141
141
  /** Fields still missing before the market can be approved. */
142
142
  missingFields?: string[];
143
+ /**
144
+ * Set when an admin edits a queued candidate. The importer stops overwriting
145
+ * such a document's content on re-scrape (it only refreshes bookkeeping), so a
146
+ * reviewer's fix is never replaced by the source data; approval clears it.
147
+ */
148
+ reviewerEditedAt?: Date | null;
149
+ /**
150
+ * True while the published listing's city is unknown: approval fell back to
151
+ * the region because the document never carried one. The duplicate matcher
152
+ * treats such a listing as matching any city, which the publication key alone
153
+ * cannot express, so approvals of the same name + region are serialised.
154
+ * Rewritten by every approval (with the key), so a value left on an
155
+ * unpublished document is stale but self-correcting.
156
+ */
157
+ publicationCityUnknown?: boolean | null;
158
+ /**
159
+ * Normalized `region::name::city` key held only while the market is the
160
+ * published listing for that market. A unique partial index on it makes
161
+ * "one published listing per market" a durable constraint (see below).
162
+ */
163
+ publicationKey?: string | null;
143
164
  };
144
165
  declare const AiImportedMarketModel: mongoose__default.Model<SchemaAiImportedMarket, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaAiImportedMarket, {}, {}> & Omit<AiImportedMarket, "eventId" | "claimedByUserId" | "reviewedByUserId"> & {
145
166
  eventId?: mongoose__default.Types.ObjectId;
@@ -161,6 +182,27 @@ declare const AiImportedMarketModel: mongoose__default.Model<SchemaAiImportedMar
161
182
  duplicateHint?: string | null;
162
183
  /** Fields still missing before the market can be approved. */
163
184
  missingFields?: string[];
185
+ /**
186
+ * Set when an admin edits a queued candidate. The importer stops overwriting
187
+ * such a document's content on re-scrape (it only refreshes bookkeeping), so a
188
+ * reviewer's fix is never replaced by the source data; approval clears it.
189
+ */
190
+ reviewerEditedAt?: Date | null;
191
+ /**
192
+ * True while the published listing's city is unknown: approval fell back to
193
+ * the region because the document never carried one. The duplicate matcher
194
+ * treats such a listing as matching any city, which the publication key alone
195
+ * cannot express, so approvals of the same name + region are serialised.
196
+ * Rewritten by every approval (with the key), so a value left on an
197
+ * unpublished document is stale but self-correcting.
198
+ */
199
+ publicationCityUnknown?: boolean | null;
200
+ /**
201
+ * Normalized `region::name::city` key held only while the market is the
202
+ * published listing for that market. A unique partial index on it makes
203
+ * "one published listing per market" a durable constraint (see below).
204
+ */
205
+ publicationKey?: string | null;
164
206
  } & Required<{
165
207
  _id: string;
166
208
  }> & {
@@ -60,7 +60,7 @@ import {
60
60
  termsAgreementSchema,
61
61
  userLicenseSchema,
62
62
  vendorProductTypeSchema
63
- } from "../chunk-TSKI3WB2.mjs";
63
+ } from "../chunk-U5WL3CZR.mjs";
64
64
  export {
65
65
  AD_BILLING_CATALOG_COLLECTION_NAME,
66
66
  AI_IMPORT_RUN_LOCK_KEY,
@@ -1197,6 +1197,8 @@ var schema8 = new MongooseSchema7(
1197
1197
  missingFields: { required: false, type: [String] },
1198
1198
  name: { required: true, type: String },
1199
1199
  openingHours: { required: false, type: [String] },
1200
+ publicationCityUnknown: { default: false, required: false, type: Boolean },
1201
+ publicationKey: { required: false, type: String },
1200
1202
  rainOrShine: { required: true, type: Boolean },
1201
1203
  rating: { required: false, type: Number },
1202
1204
  region: { required: false, type: String },
@@ -1208,6 +1210,7 @@ var schema8 = new MongooseSchema7(
1208
1210
  required: false,
1209
1211
  type: import_mongoose11.default.Schema.Types.ObjectId
1210
1212
  },
1213
+ reviewerEditedAt: { default: null, required: false, type: Date },
1211
1214
  reviewStatus: {
1212
1215
  default: import_cluemart_shared10.EnumImportedMarketReviewStatus.PENDING,
1213
1216
  enum: Object.values(import_cluemart_shared10.EnumImportedMarketReviewStatus),
@@ -1244,6 +1247,16 @@ schema8.index({
1244
1247
  _id: 1
1245
1248
  });
1246
1249
  schema8.index({ region: 1, searchName: 1 });
1250
+ schema8.index(
1251
+ { publicationKey: 1 },
1252
+ {
1253
+ name: "ai_market_publication_key",
1254
+ partialFilterExpression: {
1255
+ publicationKey: { $exists: true, $type: "string" }
1256
+ },
1257
+ unique: true
1258
+ }
1259
+ );
1247
1260
  schema8.index({ slug: 1 });
1248
1261
  schema8.index({ reviewStatus: 1 });
1249
1262
  schema8.index({ description: "text", name: "text" });
@@ -2168,6 +2181,13 @@ var schema20 = new MongooseSchema21(
2168
2181
  {
2169
2182
  ...baseResourceFields,
2170
2183
  // Importing base resource fields from global.ts
2184
+ // Claim link of the AI-imported market this event was created from, the
2185
+ // counterpart of `googlePlaceId`. Written once by `createEvent`.
2186
+ aiImportedMarketSourceKey: {
2187
+ default: null,
2188
+ required: false,
2189
+ type: String
2190
+ },
2171
2191
  claimed: { default: true, required: false, type: Boolean },
2172
2192
  dateTime: { required: true, type: [dateTimeSchema] },
2173
2193
  eventInfoId: {