@open-mercato/core 0.6.2-develop.3406.1.2b403f40da → 0.6.2-develop.3446.1.bd060c6017
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/.turbo/turbo-build.log +1 -1
- package/dist/generated/entities/entity_index_row/index.js +2 -0
- package/dist/generated/entities/entity_index_row/index.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +1 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/queue-runner.js +58 -0
- package/dist/helpers/integration/queue-runner.js.map +7 -0
- package/dist/helpers/integration/queue.js +67 -0
- package/dist/helpers/integration/queue.js.map +7 -0
- package/dist/helpers/integration/salesUi.js +33 -15
- package/dist/helpers/integration/salesUi.js.map +2 -2
- package/dist/modules/customers/ai-agents.js +5 -2
- package/dist/modules/customers/ai-agents.js.map +2 -2
- package/dist/modules/customers/ai-tools/deals-pack.js +52 -8
- package/dist/modules/customers/ai-tools/deals-pack.js.map +2 -2
- package/dist/modules/customers/ai-tools/types.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/route.js +10 -1
- package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
- package/dist/modules/query_index/data/entities.js +13 -1
- package/dist/modules/query_index/data/entities.js.map +2 -2
- package/dist/modules/query_index/migrations/Migration20260518162054_query_index.js +43 -0
- package/dist/modules/query_index/migrations/Migration20260518162054_query_index.js.map +7 -0
- package/generated/entities/entity_index_row/index.ts +1 -0
- package/generated/entity-fields-registry.ts +1 -0
- package/package.json +8 -8
- package/src/helpers/integration/queue-runner.ts +72 -0
- package/src/helpers/integration/queue.ts +70 -0
- package/src/helpers/integration/salesUi.ts +38 -23
- package/src/modules/attachments/i18n/de.json +13 -0
- package/src/modules/attachments/i18n/en.json +13 -0
- package/src/modules/attachments/i18n/es.json +13 -0
- package/src/modules/attachments/i18n/pl.json +13 -0
- package/src/modules/customers/ai-agents.ts +4 -1
- package/src/modules/customers/ai-tools/deals-pack.ts +68 -10
- package/src/modules/customers/ai-tools/types.ts +6 -0
- package/src/modules/customers/api/people/[id]/route.ts +10 -1
- package/src/modules/query_index/data/entities.ts +12 -0
- package/src/modules/query_index/migrations/.snapshot-open-mercato.json +792 -343
- package/src/modules/query_index/migrations/Migration20260518162054_query_index.ts +43 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
|
|
3
|
+
export class Migration20260518162054_query_index extends Migration {
|
|
4
|
+
|
|
5
|
+
override up(): void | Promise<void> {
|
|
6
|
+
this.addSql(`alter table "entity_indexes" add column if not exists "organization_id_coalesced" uuid generated always as (coalesce("organization_id", '00000000-0000-0000-0000-000000000000'::uuid)) stored not null;`);
|
|
7
|
+
this.addSql(`
|
|
8
|
+
delete from "entity_indexes" loser
|
|
9
|
+
using (
|
|
10
|
+
select "id"
|
|
11
|
+
from (
|
|
12
|
+
select
|
|
13
|
+
"id",
|
|
14
|
+
row_number() over (
|
|
15
|
+
partition by "entity_type", "entity_id", "organization_id_coalesced"
|
|
16
|
+
order by ("deleted_at" is null) desc, "updated_at" desc, "id" desc
|
|
17
|
+
) as row_number
|
|
18
|
+
from "entity_indexes"
|
|
19
|
+
) ranked
|
|
20
|
+
where ranked.row_number > 1
|
|
21
|
+
) duplicates
|
|
22
|
+
where loser."id" = duplicates."id";
|
|
23
|
+
`);
|
|
24
|
+
this.addSql(`
|
|
25
|
+
do $$
|
|
26
|
+
begin
|
|
27
|
+
if not exists (
|
|
28
|
+
select 1
|
|
29
|
+
from pg_constraint
|
|
30
|
+
where conname = 'entity_indexes_type_entity_org_coalesced_unique'
|
|
31
|
+
) then
|
|
32
|
+
alter table "entity_indexes" add constraint "entity_indexes_type_entity_org_coalesced_unique" unique ("entity_type", "entity_id", "organization_id_coalesced");
|
|
33
|
+
end if;
|
|
34
|
+
end $$;
|
|
35
|
+
`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override down(): void | Promise<void> {
|
|
39
|
+
this.addSql(`alter table "entity_indexes" drop constraint if exists "entity_indexes_type_entity_org_coalesced_unique";`);
|
|
40
|
+
this.addSql(`alter table "entity_indexes" drop column "organization_id_coalesced";`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|