@infuro/cms-core 1.0.33 → 1.0.35

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.
Files changed (164) hide show
  1. package/README.md +22 -6
  2. package/dist/OrderTrackPage-W3J6WIG2.js +426 -0
  3. package/dist/OrderTrackPage-Z6FCJQYY.cjs +428 -0
  4. package/dist/admin.cjs +34072 -20487
  5. package/dist/admin.d.cts +191 -9
  6. package/dist/admin.d.ts +191 -9
  7. package/dist/admin.js +33913 -20423
  8. package/dist/api.cjs +123 -16508
  9. package/dist/api.d.cts +633 -3
  10. package/dist/api.d.ts +633 -3
  11. package/dist/api.js +14 -16519
  12. package/dist/auth.cjs +196 -955
  13. package/dist/auth.d.cts +201 -42
  14. package/dist/auth.d.ts +201 -42
  15. package/dist/auth.js +4 -888
  16. package/dist/chunk-2XE4X74C.js +29602 -0
  17. package/dist/chunk-3DZRIZOD.cjs +52 -0
  18. package/dist/chunk-3KPNTQBV.cjs +620 -0
  19. package/dist/chunk-46GKADYE.cjs +84 -0
  20. package/dist/chunk-4TRPKBKO.js +589 -0
  21. package/dist/chunk-5ELSW2UP.js +150 -0
  22. package/dist/chunk-6KPQWRFW.js +171 -0
  23. package/dist/chunk-7NMT3GBR.cjs +29 -0
  24. package/dist/chunk-7YIBMQDR.cjs +86 -0
  25. package/dist/chunk-BGJAV67S.cjs +29710 -0
  26. package/dist/chunk-CNTSLED2.cjs +559 -0
  27. package/dist/chunk-CRFV5WJK.js +16 -0
  28. package/dist/chunk-D5FBNKQM.cjs +104 -0
  29. package/dist/chunk-EF2JBPDM.js +114 -0
  30. package/dist/chunk-EQPITOP6.js +543 -0
  31. package/dist/chunk-GO7PPYNU.js +76 -0
  32. package/dist/chunk-HF3L2GIT.cjs +194 -0
  33. package/dist/chunk-J7XHLOLO.js +830 -0
  34. package/dist/chunk-JBRR5UYL.js +87 -0
  35. package/dist/chunk-JC6DLWTE.js +21 -0
  36. package/dist/chunk-JHF4YYRC.cjs +188 -0
  37. package/dist/chunk-JXF23MPG.js +25 -0
  38. package/dist/chunk-MQBT33IV.js +48 -0
  39. package/dist/chunk-N44BJZ4C.cjs +123 -0
  40. package/dist/chunk-OOTLNH63.cjs +18 -0
  41. package/dist/chunk-PAMVINEX.cjs +577 -0
  42. package/dist/chunk-PNOKNSG2.cjs +222 -0
  43. package/dist/chunk-QM733NUK.js +186 -0
  44. package/dist/chunk-R73BKDRO.cjs +90 -0
  45. package/dist/chunk-SHUYVCID.js +4 -0
  46. package/dist/chunk-SYBOCAWB.js +97 -0
  47. package/dist/chunk-TDV6EJHV.js +192 -0
  48. package/dist/chunk-TFUOHI37.cjs +839 -0
  49. package/dist/chunk-TIAEXJLI.cjs +182 -0
  50. package/dist/chunk-UPLVMVRX.cjs +23 -0
  51. package/dist/chunk-USNT2KNT.cjs +6 -0
  52. package/dist/chunk-WEMDMVHQ.js +216 -0
  53. package/dist/chunk-XDSNZUW7.js +564 -0
  54. package/dist/chunk-XQ3QUHWR.cjs +83 -0
  55. package/dist/chunk-XW5ATPRW.cjs +155 -0
  56. package/dist/chunk-ZQ4X6OAU.js +82 -0
  57. package/dist/chunk-ZSVCP6N3.js +83 -0
  58. package/dist/cli.cjs +142 -84
  59. package/dist/cli.js +101 -27
  60. package/dist/email-FKR4FXFI.js +5 -0
  61. package/dist/email-KVKVPNCL.cjs +58 -0
  62. package/dist/email-queue-CGZBVVAS.js +2 -0
  63. package/dist/email-queue-TPZWLTIV.cjs +23 -0
  64. package/dist/erp-config-enabled-CUMQ6N2V.cjs +11 -0
  65. package/dist/erp-config-enabled-T37X7T34.js +2 -0
  66. package/dist/erp-order-invoice-3YISSOWW.js +3 -0
  67. package/dist/erp-order-invoice-ZR5F2KTA.cjs +12 -0
  68. package/dist/event-order-defaults-6E543227.js +2 -0
  69. package/dist/event-order-defaults-DUGDVGJI.cjs +39 -0
  70. package/dist/event-order-notifications-5GSAOYVS.cjs +27 -0
  71. package/dist/event-order-notifications-IIIF23D5.js +10 -0
  72. package/dist/hooks.cjs +259 -132
  73. package/dist/hooks.d.cts +42 -1
  74. package/dist/hooks.d.ts +42 -1
  75. package/dist/hooks.js +234 -91
  76. package/dist/index.cjs +3884 -21070
  77. package/dist/index.d.cts +2255 -749
  78. package/dist/index.d.ts +2255 -749
  79. package/dist/index.js +1925 -19891
  80. package/dist/interpolate-WAKPN56R.cjs +11 -0
  81. package/dist/interpolate-WDUWDF3I.js +2 -0
  82. package/dist/layout-36UFTHC5.cjs +11 -0
  83. package/dist/layout-AOBN26XG.js +2 -0
  84. package/dist/migrations/1778660000004-CreateCustomerAndCustomerContacts.ts +99 -0
  85. package/dist/migrations/1778660000005-AddCustomerIdToVendorCustomers.ts +39 -0
  86. package/dist/migrations/1778660000006-UpdateVendorCustomersContactNullable.ts +36 -0
  87. package/dist/migrations/1778660000007-VendorOwnerCustomerContactsPermission.ts +39 -0
  88. package/dist/migrations/1779300000000-VendorOwnerContactsPermission.ts +39 -0
  89. package/dist/migrations/1779400000000-AddCustomerContactIdToOrders.ts +33 -0
  90. package/dist/migrations/1779400000000-ConvertStatusToEnum.ts +142 -0
  91. package/dist/migrations/1779400000000-SeedDefaultCurrencies.ts +33 -0
  92. package/dist/migrations/1779500000000-VendorRolesAndPermissions.ts +102 -0
  93. package/dist/migrations/1779600000000-VendorRegistrationProfile.ts +52 -0
  94. package/dist/migrations/1779700000000-CollectionIsCatalog.ts +22 -0
  95. package/dist/migrations/1779710000000-CollectionPlatformCatalog.ts +60 -0
  96. package/dist/migrations/1779720000000-ProductCategoryPlatformCatalog.ts +157 -0
  97. package/dist/migrations/1779800000000-EventsAndEventProducts.ts +173 -0
  98. package/dist/migrations/1779810000000-BackfillVendorRoleEventsPermissions.ts +38 -0
  99. package/dist/migrations/1779820000000-FixProductsCategoryForeignKey.ts +70 -0
  100. package/dist/migrations/1779830000000-ProductTitleColumn.ts +32 -0
  101. package/dist/migrations/1779840000000-EventAboutAndVisibilityFields.ts +34 -0
  102. package/dist/migrations/1779850000000-EventCityCountrySplit.ts +43 -0
  103. package/dist/migrations/1779860000000-CreateCombos.ts +140 -0
  104. package/dist/migrations/1780100000000-OrderAttendeesEventId.ts +55 -0
  105. package/dist/migrations/1780110000000-EventContactFormId.ts +49 -0
  106. package/dist/migrations/1780130000000-ProductVariants.ts +54 -0
  107. package/dist/migrations/1780140000000-EventManagementEnhancements.ts +44 -0
  108. package/dist/migrations/1780160000000-EventRegistrationGstProductContactForm.ts +79 -0
  109. package/dist/migrations/1780170000000-ComboCurrencyPrices.ts +20 -0
  110. package/dist/migrations/1781110000000-VendorOwnerCombosPermission.ts +38 -0
  111. package/dist/migrations/1781120000000-RefundPoliciesAndRequests.ts +225 -0
  112. package/dist/migrations/1781130000000-CreateAttendees.ts +44 -0
  113. package/dist/migrations/1781140000000-EventOrderNotifications.ts +29 -0
  114. package/dist/migrations/1781150000000-EventNamedLists.ts +28 -0
  115. package/dist/migrations/1781160000000-RefundPolicyEventTiers.ts +27 -0
  116. package/dist/migrations/1781170000000-EventRefundPolicy.ts +42 -0
  117. package/dist/migrations/1781180000000-RemoveCartItemsUniqueConstraint.ts +15 -0
  118. package/dist/migrations/1781190000000-RenameProductTaxesToProductConfig.ts +84 -0
  119. package/dist/migrations/1781200000000-VendorOwnerProductConfigPermissions.ts +51 -0
  120. package/dist/migrations/1781210000000-VendorRoleProductConfigPermissions.ts +46 -0
  121. package/dist/migrations/helpers/vendor-role-seed.ts +243 -0
  122. package/dist/paid-order-erp-3USEG6WL.js +3 -0
  123. package/dist/paid-order-erp-FSQ3GSXE.cjs +12 -0
  124. package/dist/pg-boss-service-4XF2TQ2E.js +2 -0
  125. package/dist/pg-boss-service-L6MTF4EQ.cjs +15 -0
  126. package/dist/razorpay-KLO2KNCB.js +49 -0
  127. package/dist/razorpay-U23LGY72.cjs +56 -0
  128. package/dist/rbac-debug-db-D7ME7QUY.cjs +35 -0
  129. package/dist/rbac-debug-db-MTCTVNNM.js +33 -0
  130. package/dist/sms-defaults-2NL24H57.js +2 -0
  131. package/dist/sms-defaults-KCOPKQBA.cjs +19 -0
  132. package/dist/stripe-4FD27QVJ.js +51 -0
  133. package/dist/stripe-VU6OEG2D.cjs +57 -0
  134. package/dist/theme.cjs +31 -59
  135. package/dist/theme.d.cts +78 -3
  136. package/dist/theme.d.ts +78 -3
  137. package/dist/theme.js +23 -20
  138. package/dist/vendor-invite-status-77O7ZQ3U.cjs +19 -0
  139. package/dist/vendor-invite-status-PWJ3DE76.js +2 -0
  140. package/dist/whatsapp-queue-3DXA4MXU.js +2 -0
  141. package/dist/whatsapp-queue-KG65MXD5.cjs +15 -0
  142. package/package.json +147 -141
  143. package/dist/admin.cjs.map +0 -1
  144. package/dist/admin.js.map +0 -1
  145. package/dist/api.cjs.map +0 -1
  146. package/dist/api.js.map +0 -1
  147. package/dist/auth.cjs.map +0 -1
  148. package/dist/auth.js.map +0 -1
  149. package/dist/cli.cjs.map +0 -1
  150. package/dist/cli.js.map +0 -1
  151. package/dist/config-DJ5CmQvS.d.cts +0 -8
  152. package/dist/config-DJ5CmQvS.d.ts +0 -8
  153. package/dist/hooks.cjs.map +0 -1
  154. package/dist/hooks.js.map +0 -1
  155. package/dist/index-DWd5Gjc4.d.ts +0 -582
  156. package/dist/index-rZTnpK7y.d.cts +0 -582
  157. package/dist/index.cjs.map +0 -1
  158. package/dist/index.js.map +0 -1
  159. package/dist/theme.cjs.map +0 -1
  160. package/dist/theme.js.map +0 -1
  161. package/dist/types-DCVaXlPV.d.cts +0 -78
  162. package/dist/types-DCVaXlPV.d.ts +0 -78
  163. package/dist/vendor-scope-DTYhJk_I.d.cts +0 -129
  164. package/dist/vendor-scope-DTYhJk_I.d.ts +0 -129
@@ -0,0 +1,140 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class CreateCombos1779860000000
4
+ implements MigrationInterface
5
+ {
6
+ name = 'CreateCombos1779860000000';
7
+
8
+ public async up(queryRunner: QueryRunner): Promise<void> {
9
+ await queryRunner.query(`
10
+ DO $$ BEGIN
11
+ CREATE TYPE "combos_status_enum"
12
+ AS ENUM ('active', 'inactive', 'draft');
13
+ EXCEPTION
14
+ WHEN duplicate_object THEN NULL;
15
+ END $$;
16
+ `);
17
+
18
+ await queryRunner.query(`
19
+ DO $$ BEGIN
20
+ CREATE TYPE "combo_items_type_enum"
21
+ AS ENUM ('fixed', 'addons');
22
+ EXCEPTION
23
+ WHEN duplicate_object THEN NULL;
24
+ END $$;
25
+ `);
26
+
27
+ await queryRunner.query(`
28
+ CREATE TABLE IF NOT EXISTS "combos" (
29
+ "id" SERIAL NOT NULL,
30
+ "name" character varying NOT NULL,
31
+ "desc" text,
32
+ "eventId" integer NOT NULL,
33
+ "price" decimal(12,2) NOT NULL DEFAULT 0,
34
+ "minSelectableItems" integer NOT NULL DEFAULT 1,
35
+ "maxSelectableItems" integer NOT NULL DEFAULT 1,
36
+ "status" "combos_status_enum" NOT NULL DEFAULT 'active',
37
+ "startsAt" TIMESTAMP,
38
+ "endsAt" TIMESTAMP,
39
+ "metadata" jsonb,
40
+ "createdAt" TIMESTAMP NOT NULL DEFAULT now(),
41
+ "updatedAt" TIMESTAMP NOT NULL DEFAULT now(),
42
+ "deletedAt" TIMESTAMP,
43
+ "deleted" boolean NOT NULL DEFAULT false,
44
+ "createdBy" integer,
45
+ "updatedBy" integer,
46
+ "deletedBy" integer,
47
+ CONSTRAINT "PK_combos" PRIMARY KEY ("id")
48
+ )
49
+ `);
50
+
51
+ await queryRunner.query(`
52
+ DO $$ BEGIN
53
+ IF NOT EXISTS (
54
+ SELECT 1
55
+ FROM pg_constraint
56
+ WHERE conname = 'FK_combos_event'
57
+ ) THEN
58
+ ALTER TABLE "combos"
59
+ ADD CONSTRAINT "FK_combos_event"
60
+ FOREIGN KEY ("eventId")
61
+ REFERENCES "events"("id")
62
+ ON DELETE CASCADE
63
+ ON UPDATE NO ACTION;
64
+ END IF;
65
+ END $$;
66
+ `);
67
+
68
+ await queryRunner.query(`
69
+ CREATE TABLE IF NOT EXISTS "combo_items" (
70
+ "id" SERIAL NOT NULL,
71
+ "comboId" integer NOT NULL,
72
+ "productId" integer NOT NULL,
73
+ "type" "combo_items_type_enum" NOT NULL DEFAULT 'fixed',
74
+ CONSTRAINT "PK_combo_items" PRIMARY KEY ("id")
75
+ )
76
+ `);
77
+
78
+ await queryRunner.query(`
79
+ DO $$ BEGIN
80
+ IF NOT EXISTS (
81
+ SELECT 1
82
+ FROM pg_constraint
83
+ WHERE conname = 'FK_combo_items_combo'
84
+ ) THEN
85
+ ALTER TABLE "combo_items"
86
+ ADD CONSTRAINT "FK_combo_items_combo"
87
+ FOREIGN KEY ("comboId")
88
+ REFERENCES "combos"("id")
89
+ ON DELETE CASCADE
90
+ ON UPDATE NO ACTION;
91
+ END IF;
92
+ END $$;
93
+ `);
94
+
95
+ await queryRunner.query(`
96
+ DO $$ BEGIN
97
+ IF NOT EXISTS (
98
+ SELECT 1
99
+ FROM pg_constraint
100
+ WHERE conname = 'FK_combo_items_product'
101
+ ) THEN
102
+ ALTER TABLE "combo_items"
103
+ ADD CONSTRAINT "FK_combo_items_product"
104
+ FOREIGN KEY ("productId")
105
+ REFERENCES "products"("id")
106
+ ON DELETE CASCADE
107
+ ON UPDATE NO ACTION;
108
+ END IF;
109
+ END $$;
110
+ `);
111
+
112
+ await queryRunner.query(`
113
+ CREATE INDEX IF NOT EXISTS "IDX_combo_items_combo"
114
+ ON "combo_items" ("comboId")
115
+ `);
116
+
117
+ await queryRunner.query(`
118
+ CREATE INDEX IF NOT EXISTS "IDX_combo_items_product"
119
+ ON "combo_items" ("productId")
120
+ `);
121
+ }
122
+
123
+ public async down(queryRunner: QueryRunner): Promise<void> {
124
+ await queryRunner.query(`
125
+ DROP TABLE IF EXISTS "combo_items"
126
+ `);
127
+
128
+ await queryRunner.query(`
129
+ DROP TABLE IF EXISTS "combos"
130
+ `);
131
+
132
+ await queryRunner.query(`
133
+ DROP TYPE IF EXISTS "combo_items_type_enum"
134
+ `);
135
+
136
+ await queryRunner.query(`
137
+ DROP TYPE IF EXISTS "combos_status_enum"
138
+ `);
139
+ }
140
+ }
@@ -0,0 +1,55 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ /**
4
+ * Store CMS event id on each order_attendees pass (from event_products at sync time).
5
+ */
6
+ export class OrderAttendeesEventId1780100000000 implements MigrationInterface {
7
+ name = 'OrderAttendeesEventId1780100000000';
8
+
9
+ public async up(queryRunner: QueryRunner): Promise<void> {
10
+ const exists = await queryRunner.hasTable('order_attendees');
11
+ if (!exists) return;
12
+
13
+ const table = await queryRunner.getTable('order_attendees');
14
+ if (!table?.findColumnByName('eventId')) {
15
+ await queryRunner.query(`ALTER TABLE "order_attendees" ADD COLUMN "eventId" integer;`);
16
+ await queryRunner.query(
17
+ `CREATE INDEX IF NOT EXISTS "IDX_order_attendees_eventId" ON "order_attendees" ("eventId");`,
18
+ );
19
+ }
20
+
21
+ const hasEventProducts = await queryRunner.hasTable('event_products');
22
+ if (!hasEventProducts) return;
23
+
24
+ await queryRunner.query(`
25
+ UPDATE "order_attendees" oa
26
+ SET "eventId" = sub."eventId"
27
+ FROM (
28
+ SELECT DISTINCT ON (oa2.id)
29
+ oa2.id AS pass_id,
30
+ ep."eventId" AS "eventId"
31
+ FROM "order_attendees" oa2
32
+ INNER JOIN event_products ep
33
+ ON ep."productId" = (oa2."productId")::integer
34
+ AND ep."isActive" = true
35
+ WHERE oa2."eventId" IS NULL
36
+ AND oa2."productId" ~ '^[0-9]+$'
37
+ ORDER BY oa2.id, ep."eventId" ASC
38
+ ) sub
39
+ WHERE oa.id = sub.pass_id
40
+ AND oa."eventId" IS NULL;
41
+ `);
42
+ }
43
+
44
+ public async down(queryRunner: QueryRunner): Promise<void> {
45
+ const exists = await queryRunner.hasTable('order_attendees');
46
+ if (!exists) return;
47
+
48
+ await queryRunner.query(`DROP INDEX IF EXISTS "IDX_order_attendees_eventId";`);
49
+
50
+ const table = await queryRunner.getTable('order_attendees');
51
+ if (table?.findColumnByName('eventId')) {
52
+ await queryRunner.query(`ALTER TABLE "order_attendees" DROP COLUMN "eventId";`);
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,49 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ /**
4
+ * Link events to a CMS contact/attendee form for registration checkout.
5
+ */
6
+ export class EventContactFormId1780110000000 implements MigrationInterface {
7
+ name = 'EventContactFormId1780110000000';
8
+
9
+ public async up(queryRunner: QueryRunner): Promise<void> {
10
+ const hasEvents = await queryRunner.hasTable('events');
11
+ if (!hasEvents) return;
12
+
13
+ const table = await queryRunner.getTable('events');
14
+ if (!table?.findColumnByName('contactFormId')) {
15
+ await queryRunner.query(`ALTER TABLE "events" ADD COLUMN "contactFormId" integer;`);
16
+ }
17
+
18
+ const hasForms = await queryRunner.hasTable('forms');
19
+ if (!hasForms) return;
20
+
21
+ await queryRunner.query(`
22
+ DO $$ BEGIN
23
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'FK_events_contactForm') THEN
24
+ ALTER TABLE "events"
25
+ ADD CONSTRAINT "FK_events_contactForm"
26
+ FOREIGN KEY ("contactFormId") REFERENCES "forms"("id")
27
+ ON DELETE SET NULL ON UPDATE NO ACTION;
28
+ END IF;
29
+ END $$;
30
+ `);
31
+
32
+ await queryRunner.query(`
33
+ CREATE INDEX IF NOT EXISTS "IDX_events_contactFormId" ON "events" ("contactFormId");
34
+ `);
35
+ }
36
+
37
+ public async down(queryRunner: QueryRunner): Promise<void> {
38
+ const hasEvents = await queryRunner.hasTable('events');
39
+ if (!hasEvents) return;
40
+
41
+ await queryRunner.query(`DROP INDEX IF EXISTS "IDX_events_contactFormId";`);
42
+ await queryRunner.query(`ALTER TABLE "events" DROP CONSTRAINT IF EXISTS "FK_events_contactForm";`);
43
+
44
+ const table = await queryRunner.getTable('events');
45
+ if (table?.findColumnByName('contactFormId')) {
46
+ await queryRunner.query(`ALTER TABLE "events" DROP COLUMN "contactFormId";`);
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,54 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class ProductVariants1780130000000 implements MigrationInterface {
4
+ name = 'ProductVariants1780130000000';
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ const hasProducts = await queryRunner.hasTable('products');
8
+ if (!hasProducts) return;
9
+
10
+ const exists = await queryRunner.hasTable('product_variants');
11
+ if (!exists) {
12
+ await queryRunner.query(`
13
+ CREATE TABLE "product_variants" (
14
+ "id" SERIAL NOT NULL,
15
+ "productId" integer NOT NULL,
16
+ "sku" character varying,
17
+ "price" numeric(12,2),
18
+ "compareAtPrice" numeric(12,2),
19
+ "inventory" integer NOT NULL DEFAULT 0,
20
+ "status" character varying NOT NULL DEFAULT 'draft',
21
+ "attributes" jsonb,
22
+ "imageUrls" jsonb,
23
+ "createdAt" TIMESTAMP NOT NULL DEFAULT now(),
24
+ "updatedAt" TIMESTAMP NOT NULL DEFAULT now(),
25
+ CONSTRAINT "PK_product_variants" PRIMARY KEY ("id")
26
+ )
27
+ `);
28
+ }
29
+
30
+ await queryRunner.query(`
31
+ DO $$ BEGIN
32
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'FK_product_variants_product') THEN
33
+ ALTER TABLE "product_variants"
34
+ ADD CONSTRAINT "FK_product_variants_product"
35
+ FOREIGN KEY ("productId") REFERENCES "products"("id")
36
+ ON DELETE CASCADE ON UPDATE NO ACTION;
37
+ END IF;
38
+ END $$;
39
+ `);
40
+
41
+ await queryRunner.query(`
42
+ CREATE INDEX IF NOT EXISTS "IDX_product_variants_productId" ON "product_variants" ("productId");
43
+ `);
44
+ }
45
+
46
+ public async down(queryRunner: QueryRunner): Promise<void> {
47
+ const exists = await queryRunner.hasTable('product_variants');
48
+ if (!exists) return;
49
+
50
+ await queryRunner.query(`DROP INDEX IF EXISTS "IDX_product_variants_productId";`);
51
+ await queryRunner.query(`ALTER TABLE "product_variants" DROP CONSTRAINT IF EXISTS "FK_product_variants_product";`);
52
+ await queryRunner.query(`DROP TABLE "product_variants";`);
53
+ }
54
+ }
@@ -0,0 +1,44 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class EventManagementEnhancements1780140000000 implements MigrationInterface {
4
+ name = 'EventManagementEnhancements1780140000000';
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ if (await queryRunner.hasTable('events')) {
8
+ const events = await queryRunner.getTable('events');
9
+ if (!events?.findColumnByName('socialMediaLinks')) {
10
+ await queryRunner.query(`ALTER TABLE "events" ADD COLUMN "socialMediaLinks" jsonb;`);
11
+ }
12
+ if (!events?.findColumnByName('timezone')) {
13
+ await queryRunner.query(`ALTER TABLE "events" ADD COLUMN "timezone" character varying;`);
14
+ }
15
+ }
16
+
17
+ if (await queryRunner.hasTable('products')) {
18
+ const products = await queryRunner.getTable('products');
19
+ if (!products?.findColumnByName('currencyPrices')) {
20
+ await queryRunner.query(`ALTER TABLE "products" ADD COLUMN "currencyPrices" jsonb;`);
21
+ }
22
+ }
23
+
24
+ if (await queryRunner.hasTable('product_variants')) {
25
+ const variants = await queryRunner.getTable('product_variants');
26
+ if (!variants?.findColumnByName('currencyPrices')) {
27
+ await queryRunner.query(`ALTER TABLE "product_variants" ADD COLUMN "currencyPrices" jsonb;`);
28
+ }
29
+ }
30
+ }
31
+
32
+ public async down(queryRunner: QueryRunner): Promise<void> {
33
+ if (await queryRunner.hasTable('events')) {
34
+ await queryRunner.query(`ALTER TABLE "events" DROP COLUMN IF EXISTS "socialMediaLinks";`);
35
+ await queryRunner.query(`ALTER TABLE "events" DROP COLUMN IF EXISTS "timezone";`);
36
+ }
37
+ if (await queryRunner.hasTable('products')) {
38
+ await queryRunner.query(`ALTER TABLE "products" DROP COLUMN IF EXISTS "currencyPrices";`);
39
+ }
40
+ if (await queryRunner.hasTable('product_variants')) {
41
+ await queryRunner.query(`ALTER TABLE "product_variants" DROP COLUMN IF EXISTS "currencyPrices";`);
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,79 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class EventRegistrationGstProductContactForm1780160000000 implements MigrationInterface {
4
+ name = 'EventRegistrationGstProductContactForm1780160000000';
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ if (await queryRunner.hasTable('events')) {
8
+ const events = await queryRunner.getTable('events');
9
+ if (!events?.findColumnByName('registrationOpensAt')) {
10
+ await queryRunner.query(`ALTER TABLE "events" ADD COLUMN "registrationOpensAt" TIMESTAMP;`);
11
+ }
12
+ if (!events?.findColumnByName('registrationClosesAt')) {
13
+ await queryRunner.query(`ALTER TABLE "events" ADD COLUMN "registrationClosesAt" TIMESTAMP;`);
14
+ }
15
+ if (!events?.findColumnByName('taxId')) {
16
+ await queryRunner.query(`ALTER TABLE "events" ADD COLUMN "taxId" integer;`);
17
+ }
18
+ if (!events?.findColumnByName('taxRate')) {
19
+ await queryRunner.query(
20
+ `ALTER TABLE "events" ADD COLUMN "taxRate" numeric(5,2);`
21
+ );
22
+ }
23
+ }
24
+
25
+ if (await queryRunner.hasTable('taxes') && (await queryRunner.hasTable('events'))) {
26
+ await queryRunner.query(`
27
+ DO $$ BEGIN
28
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'FK_events_tax') THEN
29
+ ALTER TABLE "events"
30
+ ADD CONSTRAINT "FK_events_tax"
31
+ FOREIGN KEY ("taxId") REFERENCES "taxes"("id")
32
+ ON DELETE SET NULL ON UPDATE NO ACTION;
33
+ END IF;
34
+ END $$;
35
+ `);
36
+ await queryRunner.query(`CREATE INDEX IF NOT EXISTS "IDX_events_taxId" ON "events" ("taxId");`);
37
+ }
38
+
39
+ if (await queryRunner.hasTable('products')) {
40
+ const products = await queryRunner.getTable('products');
41
+ if (!products?.findColumnByName('contactFormId')) {
42
+ await queryRunner.query(`ALTER TABLE "products" ADD COLUMN "contactFormId" integer;`);
43
+ }
44
+ }
45
+
46
+ if (await queryRunner.hasTable('forms') && (await queryRunner.hasTable('products'))) {
47
+ await queryRunner.query(`
48
+ DO $$ BEGIN
49
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'FK_products_contactForm') THEN
50
+ ALTER TABLE "products"
51
+ ADD CONSTRAINT "FK_products_contactForm"
52
+ FOREIGN KEY ("contactFormId") REFERENCES "forms"("id")
53
+ ON DELETE SET NULL ON UPDATE NO ACTION;
54
+ END IF;
55
+ END $$;
56
+ `);
57
+ await queryRunner.query(
58
+ `CREATE INDEX IF NOT EXISTS "IDX_products_contactFormId" ON "products" ("contactFormId");`
59
+ );
60
+ }
61
+ }
62
+
63
+ public async down(queryRunner: QueryRunner): Promise<void> {
64
+ if (await queryRunner.hasTable('products')) {
65
+ await queryRunner.query(`DROP INDEX IF EXISTS "IDX_products_contactFormId";`);
66
+ await queryRunner.query(`ALTER TABLE "products" DROP CONSTRAINT IF EXISTS "FK_products_contactForm";`);
67
+ await queryRunner.query(`ALTER TABLE "products" DROP COLUMN IF EXISTS "contactFormId";`);
68
+ }
69
+
70
+ if (await queryRunner.hasTable('events')) {
71
+ await queryRunner.query(`DROP INDEX IF EXISTS "IDX_events_taxId";`);
72
+ await queryRunner.query(`ALTER TABLE "events" DROP CONSTRAINT IF EXISTS "FK_events_tax";`);
73
+ await queryRunner.query(`ALTER TABLE "events" DROP COLUMN IF EXISTS "taxRate";`);
74
+ await queryRunner.query(`ALTER TABLE "events" DROP COLUMN IF EXISTS "taxId";`);
75
+ await queryRunner.query(`ALTER TABLE "events" DROP COLUMN IF EXISTS "registrationClosesAt";`);
76
+ await queryRunner.query(`ALTER TABLE "events" DROP COLUMN IF EXISTS "registrationOpensAt";`);
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,20 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class ComboCurrencyPrices1780170000000 implements MigrationInterface {
4
+ name = 'ComboCurrencyPrices1780170000000';
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ if (await queryRunner.hasTable('combos')) {
8
+ const table = await queryRunner.getTable('combos');
9
+ if (!table?.findColumnByName('currencyPrices')) {
10
+ await queryRunner.query(`ALTER TABLE "combos" ADD COLUMN "currencyPrices" jsonb;`);
11
+ }
12
+ }
13
+ }
14
+
15
+ public async down(queryRunner: QueryRunner): Promise<void> {
16
+ if (await queryRunner.hasTable('combos')) {
17
+ await queryRunner.query(`ALTER TABLE "combos" DROP COLUMN IF EXISTS "currencyPrices";`);
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,38 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class VendorOwnerCombosPermission1781110000000
4
+ implements MigrationInterface
5
+ {
6
+ name = 'VendorOwnerCombosPermission1781110000000';
7
+
8
+ public async up(queryRunner: QueryRunner): Promise<void> {
9
+ await queryRunner.query(`
10
+ INSERT INTO "permissions"
11
+ ("groupId", "entity", "canCreate", "canRead", "canUpdate", "canDelete")
12
+ SELECT
13
+ g.id,
14
+ 'combos',
15
+ true,
16
+ true,
17
+ true,
18
+ false
19
+ FROM "user_groups" g
20
+ WHERE g.name = 'Vendor Owner'
21
+ AND g.deleted = false
22
+ ON CONFLICT ("groupId", "entity") DO UPDATE SET
23
+ "canCreate" = true,
24
+ "canRead" = true,
25
+ "canUpdate" = true
26
+ `);
27
+ }
28
+
29
+ public async down(queryRunner: QueryRunner): Promise<void> {
30
+ await queryRunner.query(`
31
+ DELETE FROM "permissions" p
32
+ USING "user_groups" g
33
+ WHERE p."groupId" = g.id
34
+ AND g.name = 'Vendor Owner'
35
+ AND p.entity = 'combos'
36
+ `);
37
+ }
38
+ }