@foundrynorth/compass-schema 1.0.2 → 1.0.4

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/schema.js CHANGED
@@ -887,6 +887,7 @@ export const plans = pgTable("plans", {
887
887
  hubspotOwnerEmail: text("hubspot_owner_email"), // Company owner email (for internal display only)
888
888
  hubspotLastActivity: text("hubspot_last_activity"), // Last activity date from HubSpot
889
889
  hubspotUrl: text("hubspot_url"), // Direct link to company in HubSpot
890
+ lastHubspotSync: timestamp("last_hubspot_sync"), // When plan was last synced to HubSpot
890
891
  createdAt: timestamp("created_at").notNull().defaultNow(),
891
892
  createdBy: text("created_by"), // Email of user who created the plan
892
893
  // Ownership fields for permissions (from hardening patch v3)
@@ -1527,6 +1528,9 @@ export const partners = pgTable("partners", {
1527
1528
  // Metadata
1528
1529
  createdAt: timestamp("created_at").notNull().defaultNow(),
1529
1530
  createdBy: text("created_by"), // Super admin who created this partner
1531
+ slug: varchar("slug"),
1532
+ isActive: boolean("is_active"),
1533
+ settings: jsonb("settings"),
1530
1534
  updatedAt: timestamp("updated_at").notNull().defaultNow(),
1531
1535
  });
1532
1536
  export const insertPartnerSchema = createInsertSchema(partners).omit({
@@ -1932,6 +1936,12 @@ export const investmentOptimizationSettings = pgTable("investment_optimization_s
1932
1936
  .notNull()
1933
1937
  .default(1),
1934
1938
  useGoldAccents: integer("use_gold_accents").notNull().default(1),
1939
+ tierThresholds: jsonb("tier_thresholds"),
1940
+ productPolicies: jsonb("product_policies"),
1941
+ partnerId: varchar("partner_id"),
1942
+ version: integer("version"),
1943
+ enabled: integer("enabled"),
1944
+ createdAt: timestamp("created_at"),
1935
1945
  updatedAt: timestamp("updated_at").notNull().defaultNow(),
1936
1946
  updatedBy: text("updated_by"),
1937
1947
  });
@@ -1992,6 +2002,8 @@ export const rfpRequests = pgTable("rfp_requests", {
1992
2002
  partnerId: text("partner_id"), // Partner association if applicable
1993
2003
  // Extracted RFP Details
1994
2004
  metadata: jsonb("metadata").$type(),
2005
+ // Company
2006
+ companyName: text("company_name"),
1995
2007
  // Timestamps
1996
2008
  createdAt: timestamp("created_at").notNull().defaultNow(),
1997
2009
  updatedAt: timestamp("updated_at").notNull().defaultNow(),
@@ -3419,6 +3431,7 @@ export const stribProducts = pgTable("strib_products", {
3419
3431
  categoryId: uuid("category_id")
3420
3432
  .notNull()
3421
3433
  .references(() => stribProductCategories.id),
3434
+ familyId: integer("family_id"), // FK to product family (denormalized for query performance)
3422
3435
  code: varchar("code").notNull(), // e.g., 'AUDIENCE_DISPLAY', 'SUNDAY_MAIN_FP_COLOR'
3423
3436
  name: varchar("name").notNull(), // e.g., "Audience Display", "Sunday Main Full Page Color"
3424
3437
  sku: integer("sku"), // Naviga SKU from workbook
@@ -4231,6 +4244,8 @@ export const hubspotSyncErrors = pgTable("hubspot_sync_errors", {
4231
4244
  resolvedAt: timestamp("resolved_at", { withTimezone: true, mode: 'string' }),
4232
4245
  resolvedBy: text("resolved_by"),
4233
4246
  resolutionNotes: text("resolution_notes"),
4247
+ errorCode: text("error_code"),
4248
+ retryCount: integer("retry_count"),
4234
4249
  createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
4235
4250
  }, (table) => ({
4236
4251
  systemIdx: index("hubspot_sync_errors_system_idx").on(table.system),
@@ -4268,7 +4283,21 @@ export const mapsGridScans = pgTable("maps_grid_scans", {
4268
4283
  gridPoints: jsonb("grid_points").notNull(),
4269
4284
  results: jsonb().notNull(),
4270
4285
  locationCode: integer("location_code"),
4286
+ zoomLevel: integer("zoom_level"),
4287
+ uniquePlaceIds: jsonb("unique_place_ids"),
4288
+ justificationSummary: jsonb("justification_summary"),
4289
+ topBusinesses: jsonb("top_businesses"),
4290
+ targetPlaceId: varchar("target_place_id"),
4291
+ targetRanks: jsonb("target_ranks"),
4292
+ planId: varchar("plan_id"),
4293
+ radiusKm: doublePrecision("radius_km"),
4294
+ status: varchar("status"),
4295
+ errorMessage: text("error_message"),
4296
+ totalBusinesses: integer("total_businesses"),
4271
4297
  scannedAt: timestamp("scanned_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
4298
+ completedAt: timestamp("completed_at"),
4299
+ createdAt: timestamp("created_at"),
4300
+ updatedAt: timestamp("updated_at"),
4272
4301
  }, (table) => ({
4273
4302
  jobIdIdx: index("maps_grid_scans_job_id_idx").on(table.jobId),
4274
4303
  keywordIdx: index("maps_grid_scans_keyword_idx").on(table.keyword),
@@ -4336,9 +4365,24 @@ export const planAnnotations = pgTable("plan_annotations", {
4336
4365
  content: text().notNull(),
4337
4366
  metadata: jsonb(),
4338
4367
  createdBy: text("created_by").notNull(),
4368
+ shouldInfluenceFuture: boolean("should_influence_future"),
4369
+ targetPath: text("target_path"),
4370
+ originalValue: jsonb("original_value"),
4371
+ overrideValue: jsonb("override_value"),
4372
+ reasoning: text("reasoning"),
4373
+ reasoningCategory: varchar("reasoning_category"),
4374
+ similarityConditions: jsonb("similarity_conditions"),
4375
+ timesApplied: integer("times_applied"),
4376
+ timesAccepted: integer("times_accepted"),
4377
+ timesRejected: integer("times_rejected"),
4378
+ createdByUserId: text("created_by_user_id"),
4379
+ createdByUserName: text("created_by_user_name"),
4380
+ createdByUserEmail: text("created_by_user_email"),
4381
+ partnerId: varchar("partner_id"),
4339
4382
  createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
4340
4383
  updatedAt: timestamp("updated_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
4341
4384
  deletedAt: timestamp("deleted_at", { withTimezone: true, mode: 'string' }),
4385
+ archivedAt: timestamp("archived_at"),
4342
4386
  }, (table) => ({
4343
4387
  planIdIdx: index("plan_annotations_plan_id_idx").on(table.planId),
4344
4388
  targetIdx: index("plan_annotations_target_idx").on(table.targetType, table.targetId),
@@ -4381,6 +4425,9 @@ export const projectLocations = pgTable("project_locations", {
4381
4425
  lng: doublePrecision(),
4382
4426
  placeId: text("place_id"),
4383
4427
  isPrimary: integer("is_primary").default(0),
4428
+ website: varchar("website"),
4429
+ dmaCode: varchar("dma_code"),
4430
+ dmaName: varchar("dma_name"),
4384
4431
  metadata: jsonb(),
4385
4432
  createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
4386
4433
  updatedAt: timestamp("updated_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
@@ -4394,6 +4441,9 @@ export const projects = pgTable("projects", {
4394
4441
  status: text().notNull(),
4395
4442
  ownerId: text("owner_id").notNull(),
4396
4443
  partnerId: text("partner_id"),
4444
+ domain: varchar("domain"),
4445
+ category: varchar("category"),
4446
+ triggerRunId: varchar("trigger_run_id"),
4397
4447
  metadata: jsonb(),
4398
4448
  createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
4399
4449
  updatedAt: timestamp("updated_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
@@ -4419,6 +4469,17 @@ export const prospects = pgTable("prospects", {
4419
4469
  prospectWebsite: text("prospect_website"),
4420
4470
  prospectCategory: text("prospect_category"),
4421
4471
  prospectGeo: text("prospect_geo"),
4472
+ isChain: boolean("is_chain"),
4473
+ chainId: varchar("chain_id"),
4474
+ branchCount: integer("branch_count"),
4475
+ locations: jsonb("locations"),
4476
+ analysisStatus: varchar("analysis_status"),
4477
+ partnerId: varchar("partner_id"),
4478
+ url: text("url"),
4479
+ dmaCode: varchar("dma_code"),
4480
+ dmaName: varchar("dma_name"),
4481
+ analysisData: jsonb("analysis_data"),
4482
+ competitors: jsonb("competitors"),
4422
4483
  createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
4423
4484
  updatedAt: timestamp("updated_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
4424
4485
  }, (table) => ({
@@ -4439,6 +4500,11 @@ export const reports = pgTable("reports", {
4439
4500
  locationId: uuid("location_id"),
4440
4501
  competitorData: jsonb("competitor_data"),
4441
4502
  analysisData: jsonb("analysis_data"),
4503
+ seoData: jsonb("seo_data"),
4504
+ socialData: jsonb("social_data"),
4505
+ triggerRunId: varchar("trigger_run_id"),
4506
+ planData: jsonb("plan_data"),
4507
+ errorMessage: text("error_message"),
4442
4508
  createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
4443
4509
  updatedAt: timestamp("updated_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
4444
4510
  }, (table) => ({