@infuro/cms-core 1.0.34 → 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 (158) hide show
  1. package/README.md +13 -0
  2. package/dist/OrderTrackPage-W3J6WIG2.js +426 -0
  3. package/dist/OrderTrackPage-Z6FCJQYY.cjs +428 -0
  4. package/dist/admin.cjs +34329 -20923
  5. package/dist/admin.d.cts +186 -9
  6. package/dist/admin.d.ts +186 -9
  7. package/dist/admin.js +34140 -20829
  8. package/dist/api.cjs +120 -17515
  9. package/dist/api.d.cts +633 -3
  10. package/dist/api.d.ts +633 -3
  11. package/dist/api.js +14 -17528
  12. package/dist/auth.cjs +192 -1034
  13. package/dist/auth.d.cts +194 -51
  14. package/dist/auth.d.ts +194 -51
  15. package/dist/auth.js +4 -966
  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 +103 -84
  59. package/dist/cli.js +62 -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 -22307
  77. package/dist/index.d.cts +2203 -772
  78. package/dist/index.d.ts +2203 -772
  79. package/dist/index.js +2871 -22064
  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/1779400000000-ConvertStatusToEnum.ts +142 -0
  85. package/dist/migrations/1779400000000-SeedDefaultCurrencies.ts +33 -0
  86. package/dist/migrations/1779500000000-VendorRolesAndPermissions.ts +102 -0
  87. package/dist/migrations/1779600000000-VendorRegistrationProfile.ts +52 -0
  88. package/dist/migrations/1779700000000-CollectionIsCatalog.ts +22 -0
  89. package/dist/migrations/1779710000000-CollectionPlatformCatalog.ts +60 -0
  90. package/dist/migrations/1779720000000-ProductCategoryPlatformCatalog.ts +157 -0
  91. package/dist/migrations/1779800000000-EventsAndEventProducts.ts +173 -0
  92. package/dist/migrations/1779810000000-BackfillVendorRoleEventsPermissions.ts +38 -0
  93. package/dist/migrations/1779820000000-FixProductsCategoryForeignKey.ts +70 -0
  94. package/dist/migrations/1779830000000-ProductTitleColumn.ts +32 -0
  95. package/dist/migrations/1779840000000-EventAboutAndVisibilityFields.ts +34 -0
  96. package/dist/migrations/1779850000000-EventCityCountrySplit.ts +43 -0
  97. package/dist/migrations/1779860000000-CreateCombos.ts +140 -0
  98. package/dist/migrations/1780100000000-OrderAttendeesEventId.ts +55 -0
  99. package/dist/migrations/1780110000000-EventContactFormId.ts +49 -0
  100. package/dist/migrations/1780130000000-ProductVariants.ts +54 -0
  101. package/dist/migrations/1780140000000-EventManagementEnhancements.ts +44 -0
  102. package/dist/migrations/1780160000000-EventRegistrationGstProductContactForm.ts +79 -0
  103. package/dist/migrations/1780170000000-ComboCurrencyPrices.ts +20 -0
  104. package/dist/migrations/1781110000000-VendorOwnerCombosPermission.ts +38 -0
  105. package/dist/migrations/1781120000000-RefundPoliciesAndRequests.ts +225 -0
  106. package/dist/migrations/1781130000000-CreateAttendees.ts +44 -0
  107. package/dist/migrations/1781140000000-EventOrderNotifications.ts +29 -0
  108. package/dist/migrations/1781150000000-EventNamedLists.ts +28 -0
  109. package/dist/migrations/1781160000000-RefundPolicyEventTiers.ts +27 -0
  110. package/dist/migrations/1781170000000-EventRefundPolicy.ts +42 -0
  111. package/dist/migrations/1781180000000-RemoveCartItemsUniqueConstraint.ts +15 -0
  112. package/dist/migrations/1781190000000-RenameProductTaxesToProductConfig.ts +84 -0
  113. package/dist/migrations/1781200000000-VendorOwnerProductConfigPermissions.ts +51 -0
  114. package/dist/migrations/1781210000000-VendorRoleProductConfigPermissions.ts +46 -0
  115. package/dist/migrations/helpers/vendor-role-seed.ts +243 -0
  116. package/dist/paid-order-erp-3USEG6WL.js +3 -0
  117. package/dist/paid-order-erp-FSQ3GSXE.cjs +12 -0
  118. package/dist/pg-boss-service-4XF2TQ2E.js +2 -0
  119. package/dist/pg-boss-service-L6MTF4EQ.cjs +15 -0
  120. package/dist/razorpay-KLO2KNCB.js +49 -0
  121. package/dist/razorpay-U23LGY72.cjs +56 -0
  122. package/dist/rbac-debug-db-D7ME7QUY.cjs +35 -0
  123. package/dist/rbac-debug-db-MTCTVNNM.js +33 -0
  124. package/dist/sms-defaults-2NL24H57.js +2 -0
  125. package/dist/sms-defaults-KCOPKQBA.cjs +19 -0
  126. package/dist/stripe-4FD27QVJ.js +51 -0
  127. package/dist/stripe-VU6OEG2D.cjs +57 -0
  128. package/dist/theme.cjs +31 -59
  129. package/dist/theme.d.cts +78 -3
  130. package/dist/theme.d.ts +78 -3
  131. package/dist/theme.js +23 -20
  132. package/dist/vendor-invite-status-77O7ZQ3U.cjs +19 -0
  133. package/dist/vendor-invite-status-PWJ3DE76.js +2 -0
  134. package/dist/whatsapp-queue-3DXA4MXU.js +2 -0
  135. package/dist/whatsapp-queue-KG65MXD5.cjs +15 -0
  136. package/package.json +147 -142
  137. package/dist/admin.cjs.map +0 -1
  138. package/dist/admin.js.map +0 -1
  139. package/dist/api.cjs.map +0 -1
  140. package/dist/api.js.map +0 -1
  141. package/dist/auth.cjs.map +0 -1
  142. package/dist/auth.js.map +0 -1
  143. package/dist/cli.cjs.map +0 -1
  144. package/dist/cli.js.map +0 -1
  145. package/dist/config-DJ5CmQvS.d.cts +0 -8
  146. package/dist/config-DJ5CmQvS.d.ts +0 -8
  147. package/dist/hooks.cjs.map +0 -1
  148. package/dist/hooks.js.map +0 -1
  149. package/dist/index-Bf5GO8fu.d.cts +0 -583
  150. package/dist/index-DOiJuMQA.d.ts +0 -583
  151. package/dist/index.cjs.map +0 -1
  152. package/dist/index.js.map +0 -1
  153. package/dist/theme.cjs.map +0 -1
  154. package/dist/theme.js.map +0 -1
  155. package/dist/types-DCVaXlPV.d.cts +0 -78
  156. package/dist/types-DCVaXlPV.d.ts +0 -78
  157. package/dist/vendor-scope-DTYhJk_I.d.cts +0 -129
  158. package/dist/vendor-scope-DTYhJk_I.d.ts +0 -129
@@ -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
+ }
@@ -0,0 +1,225 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class RefundPoliciesAndRequests1781120000000
4
+ implements MigrationInterface
5
+ {
6
+ name = 'RefundPoliciesAndRequests1781120000000';
7
+
8
+ public async up(queryRunner: QueryRunner): Promise<void> {
9
+ // =========================
10
+ // ENUMS
11
+ // =========================
12
+
13
+ await queryRunner.query(`
14
+ DO $$ BEGIN
15
+ CREATE TYPE "refund_policies_status_enum"
16
+ AS ENUM ('active', 'inactive');
17
+ EXCEPTION
18
+ WHEN duplicate_object THEN NULL;
19
+ END $$;
20
+ `);
21
+
22
+ await queryRunner.query(`
23
+ DO $$ BEGIN
24
+ CREATE TYPE "refund_policies_type_enum"
25
+ AS ENUM ('percentage');
26
+ EXCEPTION
27
+ WHEN duplicate_object THEN NULL;
28
+ END $$;
29
+ `);
30
+
31
+ await queryRunner.query(`
32
+ DO $$ BEGIN
33
+ CREATE TYPE "refund_requests_method_enum"
34
+ AS ENUM ('card', 'upi', 'net_banking');
35
+ EXCEPTION
36
+ WHEN duplicate_object THEN NULL;
37
+ END $$;
38
+ `);
39
+
40
+ await queryRunner.query(`
41
+ DO $$ BEGIN
42
+ CREATE TYPE "refund_requests_status_enum"
43
+ AS ENUM ('requested', 'approved', 'rejected', 'refunded');
44
+ EXCEPTION
45
+ WHEN duplicate_object THEN NULL;
46
+ END $$;
47
+ `);
48
+
49
+ // =========================
50
+ // REFUND POLICIES
51
+ // =========================
52
+
53
+ await queryRunner.query(`
54
+ CREATE TABLE IF NOT EXISTS "refund_policies" (
55
+ "id" SERIAL NOT NULL,
56
+ "name" character varying NOT NULL,
57
+ "desc" text,
58
+ "vendorId" integer NOT NULL,
59
+ "refundWindowDays" integer NOT NULL DEFAULT 0,
60
+ "status" "refund_policies_status_enum" NOT NULL DEFAULT 'active',
61
+ "type" "refund_policies_type_enum" NOT NULL DEFAULT 'percentage',
62
+ "value" decimal(10,2) NOT NULL DEFAULT 0,
63
+ CONSTRAINT "PK_refund_policies" PRIMARY KEY ("id")
64
+ )
65
+ `);
66
+
67
+ await queryRunner.query(`
68
+ DO $$ BEGIN
69
+ IF NOT EXISTS (
70
+ SELECT 1
71
+ FROM pg_constraint
72
+ WHERE conname = 'FK_refund_policies_vendor'
73
+ ) THEN
74
+ ALTER TABLE "refund_policies"
75
+ ADD CONSTRAINT "FK_refund_policies_vendor"
76
+ FOREIGN KEY ("vendorId")
77
+ REFERENCES "vendors"("id")
78
+ ON DELETE CASCADE
79
+ ON UPDATE NO ACTION;
80
+ END IF;
81
+ END $$;
82
+ `);
83
+
84
+ // =========================
85
+ // REFUND REQUESTS
86
+ // =========================
87
+
88
+ await queryRunner.query(`
89
+ CREATE TABLE IF NOT EXISTS "refund_requests" (
90
+ "id" SERIAL NOT NULL,
91
+ "refundPolicyId" integer NOT NULL,
92
+ "orderId" integer NOT NULL,
93
+ "customerId" integer NOT NULL,
94
+ "reason" text,
95
+ "refundMethod" "refund_requests_method_enum" NOT NULL,
96
+ "status" "refund_requests_status_enum" NOT NULL DEFAULT 'requested',
97
+ "expectedRefundAmount" decimal(10,2) NOT NULL DEFAULT 0,
98
+ "approvedRefundAmount" decimal(10,2),
99
+ CONSTRAINT "PK_refund_requests" PRIMARY KEY ("id")
100
+ )
101
+ `);
102
+
103
+ await queryRunner.query(`
104
+ DO $$ BEGIN
105
+ IF NOT EXISTS (
106
+ SELECT 1
107
+ FROM pg_constraint
108
+ WHERE conname = 'FK_refund_requests_policy'
109
+ ) THEN
110
+ ALTER TABLE "refund_requests"
111
+ ADD CONSTRAINT "FK_refund_requests_policy"
112
+ FOREIGN KEY ("refundPolicyId")
113
+ REFERENCES "refund_policies"("id")
114
+ ON DELETE CASCADE
115
+ ON UPDATE NO ACTION;
116
+ END IF;
117
+ END $$;
118
+ `);
119
+
120
+ await queryRunner.query(`
121
+ DO $$ BEGIN
122
+ IF NOT EXISTS (
123
+ SELECT 1
124
+ FROM pg_constraint
125
+ WHERE conname = 'FK_refund_requests_order'
126
+ ) THEN
127
+ ALTER TABLE "refund_requests"
128
+ ADD CONSTRAINT "FK_refund_requests_order"
129
+ FOREIGN KEY ("orderId")
130
+ REFERENCES "orders"("id")
131
+ ON DELETE CASCADE
132
+ ON UPDATE NO ACTION;
133
+ END IF;
134
+ END $$;
135
+ `);
136
+
137
+ await queryRunner.query(`
138
+ DO $$ BEGIN
139
+ IF NOT EXISTS (
140
+ SELECT 1
141
+ FROM pg_constraint
142
+ WHERE conname = 'FK_refund_requests_customer'
143
+ ) THEN
144
+ ALTER TABLE "refund_requests"
145
+ ADD CONSTRAINT "FK_refund_requests_customer"
146
+ FOREIGN KEY ("customerId")
147
+ REFERENCES "customer"("id")
148
+ ON DELETE CASCADE
149
+ ON UPDATE NO ACTION;
150
+ END IF;
151
+ END $$;
152
+ `);
153
+
154
+ // =========================
155
+ // ORDER ITEMS -> vendorId
156
+ // =========================
157
+
158
+ await queryRunner.query(`
159
+ ALTER TABLE "order_items"
160
+ ADD COLUMN IF NOT EXISTS "vendorId" integer
161
+ `);
162
+
163
+ await queryRunner.query(`
164
+ DO $$ BEGIN
165
+ IF NOT EXISTS (
166
+ SELECT 1
167
+ FROM pg_constraint
168
+ WHERE conname = 'FK_order_items_vendor'
169
+ ) THEN
170
+ ALTER TABLE "order_items"
171
+ ADD CONSTRAINT "FK_order_items_vendor"
172
+ FOREIGN KEY ("vendorId")
173
+ REFERENCES "vendors"("id")
174
+ ON DELETE SET NULL
175
+ ON UPDATE NO ACTION;
176
+ END IF;
177
+ END $$;
178
+ `);
179
+
180
+ await queryRunner.query(`
181
+ CREATE INDEX IF NOT EXISTS "IDX_order_items_vendor"
182
+ ON "order_items" ("vendorId")
183
+ `);
184
+ }
185
+
186
+ public async down(queryRunner: QueryRunner): Promise<void> {
187
+ await queryRunner.query(`
188
+ DROP INDEX IF EXISTS "IDX_order_items_vendor"
189
+ `);
190
+
191
+ await queryRunner.query(`
192
+ ALTER TABLE "order_items"
193
+ DROP CONSTRAINT IF EXISTS "FK_order_items_vendor"
194
+ `);
195
+
196
+ await queryRunner.query(`
197
+ ALTER TABLE "order_items"
198
+ DROP COLUMN IF EXISTS "vendorId"
199
+ `);
200
+
201
+ await queryRunner.query(`
202
+ DROP TABLE IF EXISTS "refund_requests"
203
+ `);
204
+
205
+ await queryRunner.query(`
206
+ DROP TABLE IF EXISTS "refund_policies"
207
+ `);
208
+
209
+ await queryRunner.query(`
210
+ DROP TYPE IF EXISTS "refund_requests_status_enum"
211
+ `);
212
+
213
+ await queryRunner.query(`
214
+ DROP TYPE IF EXISTS "refund_requests_method_enum"
215
+ `);
216
+
217
+ await queryRunner.query(`
218
+ DROP TYPE IF EXISTS "refund_policies_type_enum"
219
+ `);
220
+
221
+ await queryRunner.query(`
222
+ DROP TYPE IF EXISTS "refund_policies_status_enum"
223
+ `);
224
+ }
225
+ }
@@ -0,0 +1,44 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ /**
4
+ * Event / registration attendees linked optionally to CMS contacts.
5
+ */
6
+ export class CreateAttendees1781130000000 implements MigrationInterface {
7
+ name = 'CreateAttendees1781130000000';
8
+
9
+ public async up(queryRunner: QueryRunner): Promise<void> {
10
+ await queryRunner.query(`
11
+ CREATE TABLE IF NOT EXISTS "attendees" (
12
+ "id" SERIAL NOT NULL,
13
+ "displayName" character varying NOT NULL,
14
+ "email" character varying NOT NULL,
15
+ "contactId" integer,
16
+ CONSTRAINT "PK_attendees" PRIMARY KEY ("id")
17
+ )
18
+ `);
19
+
20
+ await queryRunner.query(`
21
+ DO $$ BEGIN
22
+ ALTER TABLE "attendees"
23
+ ADD CONSTRAINT "FK_attendees_contact"
24
+ FOREIGN KEY ("contactId") REFERENCES "contacts"("id") ON DELETE SET NULL ON UPDATE NO ACTION;
25
+ EXCEPTION WHEN duplicate_object THEN NULL; END $$
26
+ `);
27
+
28
+ await queryRunner.query(`
29
+ CREATE INDEX IF NOT EXISTS "IDX_attendees_contactId"
30
+ ON "attendees" ("contactId")
31
+ `);
32
+
33
+ await queryRunner.query(`
34
+ CREATE INDEX IF NOT EXISTS "IDX_attendees_email"
35
+ ON "attendees" ("email")
36
+ `);
37
+ }
38
+
39
+ public async down(queryRunner: QueryRunner): Promise<void> {
40
+ await queryRunner.query(`DROP INDEX IF EXISTS "IDX_attendees_email"`);
41
+ await queryRunner.query(`DROP INDEX IF EXISTS "IDX_attendees_contactId"`);
42
+ await queryRunner.query(`DROP TABLE IF EXISTS "attendees"`);
43
+ }
44
+ }
@@ -0,0 +1,29 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class EventOrderNotifications1781140000000 implements MigrationInterface {
4
+ name = 'EventOrderNotifications1781140000000';
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ if (!(await queryRunner.hasTable('events'))) return;
8
+
9
+ const table = await queryRunner.getTable('events');
10
+ if (!table?.findColumnByName('orderNotificationsEnabled')) {
11
+ await queryRunner.query(
12
+ `ALTER TABLE "events" ADD COLUMN "orderNotificationsEnabled" boolean NOT NULL DEFAULT false`,
13
+ );
14
+ }
15
+ if (!table?.findColumnByName('orderNotificationChannels')) {
16
+ await queryRunner.query(`ALTER TABLE "events" ADD COLUMN "orderNotificationChannels" jsonb;`);
17
+ }
18
+ if (!table?.findColumnByName('orderNotificationTemplates')) {
19
+ await queryRunner.query(`ALTER TABLE "events" ADD COLUMN "orderNotificationTemplates" jsonb;`);
20
+ }
21
+ }
22
+
23
+ public async down(queryRunner: QueryRunner): Promise<void> {
24
+ if (!(await queryRunner.hasTable('events'))) return;
25
+ await queryRunner.query(`ALTER TABLE "events" DROP COLUMN IF EXISTS "orderNotificationTemplates"`);
26
+ await queryRunner.query(`ALTER TABLE "events" DROP COLUMN IF EXISTS "orderNotificationChannels"`);
27
+ await queryRunner.query(`ALTER TABLE "events" DROP COLUMN IF EXISTS "orderNotificationsEnabled"`);
28
+ }
29
+ }
@@ -0,0 +1,28 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ /** Agenda, workshops, exhibitors, partners, and speaker rows on events (name + image URL). */
4
+ export class EventNamedLists1781150000000 implements MigrationInterface {
5
+ name = 'EventNamedLists1781150000000';
6
+
7
+ public async up(queryRunner: QueryRunner): Promise<void> {
8
+ await queryRunner.query(`
9
+ ALTER TABLE "events"
10
+ ADD COLUMN IF NOT EXISTS "agenda" jsonb,
11
+ ADD COLUMN IF NOT EXISTS "workshops" jsonb,
12
+ ADD COLUMN IF NOT EXISTS "exhibitors" jsonb,
13
+ ADD COLUMN IF NOT EXISTS "partners" jsonb,
14
+ ADD COLUMN IF NOT EXISTS "speakers" jsonb
15
+ `);
16
+ }
17
+
18
+ public async down(queryRunner: QueryRunner): Promise<void> {
19
+ await queryRunner.query(`
20
+ ALTER TABLE "events"
21
+ DROP COLUMN IF EXISTS "speakers",
22
+ DROP COLUMN IF EXISTS "partners",
23
+ DROP COLUMN IF EXISTS "exhibitors",
24
+ DROP COLUMN IF EXISTS "workshops",
25
+ DROP COLUMN IF EXISTS "agenda"
26
+ `);
27
+ }
28
+ }
@@ -0,0 +1,27 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class RefundPolicyEventTiers1781160000000 implements MigrationInterface {
4
+ name = 'RefundPolicyEventTiers1781160000000';
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`
8
+ DO $$ BEGIN
9
+ ALTER TYPE "refund_policies_type_enum" ADD VALUE IF NOT EXISTS 'event_tiers';
10
+ EXCEPTION
11
+ WHEN duplicate_object THEN NULL;
12
+ END $$;
13
+ `);
14
+
15
+ await queryRunner.query(`
16
+ ALTER TABLE "refund_policies"
17
+ ADD COLUMN IF NOT EXISTS "tiers" jsonb
18
+ `);
19
+ }
20
+
21
+ public async down(queryRunner: QueryRunner): Promise<void> {
22
+ await queryRunner.query(`
23
+ ALTER TABLE "refund_policies"
24
+ DROP COLUMN IF EXISTS "tiers"
25
+ `);
26
+ }
27
+ }
@@ -0,0 +1,42 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class EventRefundPolicy1781170000000 implements MigrationInterface {
4
+ name = 'EventRefundPolicy1781170000000';
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`
8
+ ALTER TABLE "events"
9
+ ADD COLUMN IF NOT EXISTS "refundPolicyId" integer
10
+ `);
11
+
12
+ await queryRunner.query(`
13
+ DO $$ BEGIN
14
+ IF NOT EXISTS (
15
+ SELECT 1 FROM pg_constraint WHERE conname = 'FK_events_refund_policy'
16
+ ) THEN
17
+ ALTER TABLE "events"
18
+ ADD CONSTRAINT "FK_events_refund_policy"
19
+ FOREIGN KEY ("refundPolicyId")
20
+ REFERENCES "refund_policies"("id")
21
+ ON DELETE SET NULL
22
+ ON UPDATE NO ACTION;
23
+ END IF;
24
+ END $$;
25
+ `);
26
+
27
+ await queryRunner.query(`
28
+ CREATE INDEX IF NOT EXISTS "IDX_events_refundPolicyId"
29
+ ON "events" ("refundPolicyId")
30
+ `);
31
+ }
32
+
33
+ public async down(queryRunner: QueryRunner): Promise<void> {
34
+ await queryRunner.query(`DROP INDEX IF EXISTS "IDX_events_refundPolicyId"`);
35
+ await queryRunner.query(`
36
+ ALTER TABLE "events" DROP CONSTRAINT IF EXISTS "FK_events_refund_policy"
37
+ `);
38
+ await queryRunner.query(`
39
+ ALTER TABLE "events" DROP COLUMN IF EXISTS "refundPolicyId"
40
+ `);
41
+ }
42
+ }
@@ -0,0 +1,15 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class RemoveCartItemsUniqueConstraint1781180000000 implements MigrationInterface {
4
+ public async up(queryRunner: QueryRunner): Promise<void> {
5
+ await queryRunner.query(
6
+ `ALTER TABLE "cart_items" DROP CONSTRAINT IF EXISTS "UQ_cart_items_cart_product"`
7
+ );
8
+ }
9
+
10
+ public async down(queryRunner: QueryRunner): Promise<void> {
11
+ await queryRunner.query(
12
+ `ALTER TABLE "cart_items" ADD CONSTRAINT "UQ_cart_items_cart_product" UNIQUE ("cartId", "productId")`
13
+ );
14
+ }
15
+ }