@open-mercato/core 0.6.6-develop.6535.1.5cf43724de → 0.6.6-develop.6536.1.799f7f795b

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.
@@ -1,6 +1,11 @@
1
1
  import type { EntityManager } from '@mikro-orm/postgresql'
2
2
  import * as semver from 'semver'
3
3
  import type { AppContainer } from '@open-mercato/shared/lib/di/container'
4
+ import { createLogger } from '@open-mercato/shared/lib/logger'
5
+ import type { QueryEngine } from '@open-mercato/shared/lib/query/types'
6
+ import { reconcileAttachmentOrganizations } from '@open-mercato/core/modules/attachments/lib/reconcileOrganization'
7
+
8
+ const logger = createLogger('configs').child({ component: 'upgrade-actions' })
4
9
 
5
10
  export type UpgradeActionContext = {
6
11
  tenantId: string
@@ -38,6 +43,25 @@ export function compareVersions(a: string, b: string): number {
38
43
  }
39
44
 
40
45
  export const upgradeActions: UpgradeActionDefinition[] = [
46
+ {
47
+ id: 'attachments.reconcile-organization',
48
+ version: '0.6.6',
49
+ messageKey: 'configs.upgrades.attachmentsOrgReconcile.message',
50
+ ctaKey: 'configs.upgrades.attachmentsOrgReconcile.cta',
51
+ successKey: 'configs.upgrades.attachmentsOrgReconcile.success',
52
+ loadingKey: 'configs.upgrades.attachmentsOrgReconcile.loading',
53
+ async run({ container, em, tenantId }) {
54
+ const queryEngine = container.resolve('queryEngine') as QueryEngine
55
+ const report = await reconcileAttachmentOrganizations({ em, queryEngine, tenantId })
56
+ logger.info('attachments organization reconcile completed', {
57
+ tenantId,
58
+ scanned: report.scanned,
59
+ updated: report.updated,
60
+ unresolved: report.unresolved,
61
+ skippedVirtual: report.skippedVirtual,
62
+ })
63
+ },
64
+ },
41
65
  {
42
66
  id: 'customers.seed-interaction-statuses',
43
67
  version: '0.6.5',