@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.
- package/README.md +22 -6
- package/dist/OrderTrackPage-W3J6WIG2.js +426 -0
- package/dist/OrderTrackPage-Z6FCJQYY.cjs +428 -0
- package/dist/admin.cjs +34072 -20487
- package/dist/admin.d.cts +191 -9
- package/dist/admin.d.ts +191 -9
- package/dist/admin.js +33913 -20423
- package/dist/api.cjs +123 -16508
- package/dist/api.d.cts +633 -3
- package/dist/api.d.ts +633 -3
- package/dist/api.js +14 -16519
- package/dist/auth.cjs +196 -955
- package/dist/auth.d.cts +201 -42
- package/dist/auth.d.ts +201 -42
- package/dist/auth.js +4 -888
- package/dist/chunk-2XE4X74C.js +29602 -0
- package/dist/chunk-3DZRIZOD.cjs +52 -0
- package/dist/chunk-3KPNTQBV.cjs +620 -0
- package/dist/chunk-46GKADYE.cjs +84 -0
- package/dist/chunk-4TRPKBKO.js +589 -0
- package/dist/chunk-5ELSW2UP.js +150 -0
- package/dist/chunk-6KPQWRFW.js +171 -0
- package/dist/chunk-7NMT3GBR.cjs +29 -0
- package/dist/chunk-7YIBMQDR.cjs +86 -0
- package/dist/chunk-BGJAV67S.cjs +29710 -0
- package/dist/chunk-CNTSLED2.cjs +559 -0
- package/dist/chunk-CRFV5WJK.js +16 -0
- package/dist/chunk-D5FBNKQM.cjs +104 -0
- package/dist/chunk-EF2JBPDM.js +114 -0
- package/dist/chunk-EQPITOP6.js +543 -0
- package/dist/chunk-GO7PPYNU.js +76 -0
- package/dist/chunk-HF3L2GIT.cjs +194 -0
- package/dist/chunk-J7XHLOLO.js +830 -0
- package/dist/chunk-JBRR5UYL.js +87 -0
- package/dist/chunk-JC6DLWTE.js +21 -0
- package/dist/chunk-JHF4YYRC.cjs +188 -0
- package/dist/chunk-JXF23MPG.js +25 -0
- package/dist/chunk-MQBT33IV.js +48 -0
- package/dist/chunk-N44BJZ4C.cjs +123 -0
- package/dist/chunk-OOTLNH63.cjs +18 -0
- package/dist/chunk-PAMVINEX.cjs +577 -0
- package/dist/chunk-PNOKNSG2.cjs +222 -0
- package/dist/chunk-QM733NUK.js +186 -0
- package/dist/chunk-R73BKDRO.cjs +90 -0
- package/dist/chunk-SHUYVCID.js +4 -0
- package/dist/chunk-SYBOCAWB.js +97 -0
- package/dist/chunk-TDV6EJHV.js +192 -0
- package/dist/chunk-TFUOHI37.cjs +839 -0
- package/dist/chunk-TIAEXJLI.cjs +182 -0
- package/dist/chunk-UPLVMVRX.cjs +23 -0
- package/dist/chunk-USNT2KNT.cjs +6 -0
- package/dist/chunk-WEMDMVHQ.js +216 -0
- package/dist/chunk-XDSNZUW7.js +564 -0
- package/dist/chunk-XQ3QUHWR.cjs +83 -0
- package/dist/chunk-XW5ATPRW.cjs +155 -0
- package/dist/chunk-ZQ4X6OAU.js +82 -0
- package/dist/chunk-ZSVCP6N3.js +83 -0
- package/dist/cli.cjs +142 -84
- package/dist/cli.js +101 -27
- package/dist/email-FKR4FXFI.js +5 -0
- package/dist/email-KVKVPNCL.cjs +58 -0
- package/dist/email-queue-CGZBVVAS.js +2 -0
- package/dist/email-queue-TPZWLTIV.cjs +23 -0
- package/dist/erp-config-enabled-CUMQ6N2V.cjs +11 -0
- package/dist/erp-config-enabled-T37X7T34.js +2 -0
- package/dist/erp-order-invoice-3YISSOWW.js +3 -0
- package/dist/erp-order-invoice-ZR5F2KTA.cjs +12 -0
- package/dist/event-order-defaults-6E543227.js +2 -0
- package/dist/event-order-defaults-DUGDVGJI.cjs +39 -0
- package/dist/event-order-notifications-5GSAOYVS.cjs +27 -0
- package/dist/event-order-notifications-IIIF23D5.js +10 -0
- package/dist/hooks.cjs +259 -132
- package/dist/hooks.d.cts +42 -1
- package/dist/hooks.d.ts +42 -1
- package/dist/hooks.js +234 -91
- package/dist/index.cjs +3884 -21070
- package/dist/index.d.cts +2255 -749
- package/dist/index.d.ts +2255 -749
- package/dist/index.js +1925 -19891
- package/dist/interpolate-WAKPN56R.cjs +11 -0
- package/dist/interpolate-WDUWDF3I.js +2 -0
- package/dist/layout-36UFTHC5.cjs +11 -0
- package/dist/layout-AOBN26XG.js +2 -0
- package/dist/migrations/1778660000004-CreateCustomerAndCustomerContacts.ts +99 -0
- package/dist/migrations/1778660000005-AddCustomerIdToVendorCustomers.ts +39 -0
- package/dist/migrations/1778660000006-UpdateVendorCustomersContactNullable.ts +36 -0
- package/dist/migrations/1778660000007-VendorOwnerCustomerContactsPermission.ts +39 -0
- package/dist/migrations/1779300000000-VendorOwnerContactsPermission.ts +39 -0
- package/dist/migrations/1779400000000-AddCustomerContactIdToOrders.ts +33 -0
- package/dist/migrations/1779400000000-ConvertStatusToEnum.ts +142 -0
- package/dist/migrations/1779400000000-SeedDefaultCurrencies.ts +33 -0
- package/dist/migrations/1779500000000-VendorRolesAndPermissions.ts +102 -0
- package/dist/migrations/1779600000000-VendorRegistrationProfile.ts +52 -0
- package/dist/migrations/1779700000000-CollectionIsCatalog.ts +22 -0
- package/dist/migrations/1779710000000-CollectionPlatformCatalog.ts +60 -0
- package/dist/migrations/1779720000000-ProductCategoryPlatformCatalog.ts +157 -0
- package/dist/migrations/1779800000000-EventsAndEventProducts.ts +173 -0
- package/dist/migrations/1779810000000-BackfillVendorRoleEventsPermissions.ts +38 -0
- package/dist/migrations/1779820000000-FixProductsCategoryForeignKey.ts +70 -0
- package/dist/migrations/1779830000000-ProductTitleColumn.ts +32 -0
- package/dist/migrations/1779840000000-EventAboutAndVisibilityFields.ts +34 -0
- package/dist/migrations/1779850000000-EventCityCountrySplit.ts +43 -0
- package/dist/migrations/1779860000000-CreateCombos.ts +140 -0
- package/dist/migrations/1780100000000-OrderAttendeesEventId.ts +55 -0
- package/dist/migrations/1780110000000-EventContactFormId.ts +49 -0
- package/dist/migrations/1780130000000-ProductVariants.ts +54 -0
- package/dist/migrations/1780140000000-EventManagementEnhancements.ts +44 -0
- package/dist/migrations/1780160000000-EventRegistrationGstProductContactForm.ts +79 -0
- package/dist/migrations/1780170000000-ComboCurrencyPrices.ts +20 -0
- package/dist/migrations/1781110000000-VendorOwnerCombosPermission.ts +38 -0
- package/dist/migrations/1781120000000-RefundPoliciesAndRequests.ts +225 -0
- package/dist/migrations/1781130000000-CreateAttendees.ts +44 -0
- package/dist/migrations/1781140000000-EventOrderNotifications.ts +29 -0
- package/dist/migrations/1781150000000-EventNamedLists.ts +28 -0
- package/dist/migrations/1781160000000-RefundPolicyEventTiers.ts +27 -0
- package/dist/migrations/1781170000000-EventRefundPolicy.ts +42 -0
- package/dist/migrations/1781180000000-RemoveCartItemsUniqueConstraint.ts +15 -0
- package/dist/migrations/1781190000000-RenameProductTaxesToProductConfig.ts +84 -0
- package/dist/migrations/1781200000000-VendorOwnerProductConfigPermissions.ts +51 -0
- package/dist/migrations/1781210000000-VendorRoleProductConfigPermissions.ts +46 -0
- package/dist/migrations/helpers/vendor-role-seed.ts +243 -0
- package/dist/paid-order-erp-3USEG6WL.js +3 -0
- package/dist/paid-order-erp-FSQ3GSXE.cjs +12 -0
- package/dist/pg-boss-service-4XF2TQ2E.js +2 -0
- package/dist/pg-boss-service-L6MTF4EQ.cjs +15 -0
- package/dist/razorpay-KLO2KNCB.js +49 -0
- package/dist/razorpay-U23LGY72.cjs +56 -0
- package/dist/rbac-debug-db-D7ME7QUY.cjs +35 -0
- package/dist/rbac-debug-db-MTCTVNNM.js +33 -0
- package/dist/sms-defaults-2NL24H57.js +2 -0
- package/dist/sms-defaults-KCOPKQBA.cjs +19 -0
- package/dist/stripe-4FD27QVJ.js +51 -0
- package/dist/stripe-VU6OEG2D.cjs +57 -0
- package/dist/theme.cjs +31 -59
- package/dist/theme.d.cts +78 -3
- package/dist/theme.d.ts +78 -3
- package/dist/theme.js +23 -20
- package/dist/vendor-invite-status-77O7ZQ3U.cjs +19 -0
- package/dist/vendor-invite-status-PWJ3DE76.js +2 -0
- package/dist/whatsapp-queue-3DXA4MXU.js +2 -0
- package/dist/whatsapp-queue-KG65MXD5.cjs +15 -0
- package/package.json +147 -141
- package/dist/admin.cjs.map +0 -1
- package/dist/admin.js.map +0 -1
- package/dist/api.cjs.map +0 -1
- package/dist/api.js.map +0 -1
- package/dist/auth.cjs.map +0 -1
- package/dist/auth.js.map +0 -1
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/config-DJ5CmQvS.d.cts +0 -8
- package/dist/config-DJ5CmQvS.d.ts +0 -8
- package/dist/hooks.cjs.map +0 -1
- package/dist/hooks.js.map +0 -1
- package/dist/index-DWd5Gjc4.d.ts +0 -582
- package/dist/index-rZTnpK7y.d.cts +0 -582
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/theme.cjs.map +0 -1
- package/dist/theme.js.map +0 -1
- package/dist/types-DCVaXlPV.d.cts +0 -78
- package/dist/types-DCVaXlPV.d.ts +0 -78
- package/dist/vendor-scope-DTYhJk_I.d.cts +0 -129
- package/dist/vendor-scope-DTYhJk_I.d.ts +0 -129
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
export class RenameProductTaxesToProductConfig1781190000000
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
name = 'RenameProductTaxesToProductConfig1781190000000';
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
// Rename table if old table exists
|
|
10
|
+
await queryRunner.query(`
|
|
11
|
+
DO $$
|
|
12
|
+
BEGIN
|
|
13
|
+
IF EXISTS (
|
|
14
|
+
SELECT 1
|
|
15
|
+
FROM information_schema.tables
|
|
16
|
+
WHERE table_name = 'product_taxes'
|
|
17
|
+
) THEN
|
|
18
|
+
ALTER TABLE "product_taxes"
|
|
19
|
+
RENAME TO "product_config";
|
|
20
|
+
END IF;
|
|
21
|
+
END $$;
|
|
22
|
+
`);
|
|
23
|
+
|
|
24
|
+
// Add refundPolicyId
|
|
25
|
+
await queryRunner.query(`
|
|
26
|
+
ALTER TABLE "product_config"
|
|
27
|
+
ADD COLUMN IF NOT EXISTS "refundPolicyId" integer
|
|
28
|
+
`);
|
|
29
|
+
|
|
30
|
+
// FK to refund policies
|
|
31
|
+
await queryRunner.query(`
|
|
32
|
+
DO $$ BEGIN
|
|
33
|
+
IF NOT EXISTS (
|
|
34
|
+
SELECT 1
|
|
35
|
+
FROM pg_constraint
|
|
36
|
+
WHERE conname = 'FK_product_config_refund_policy'
|
|
37
|
+
) THEN
|
|
38
|
+
ALTER TABLE "product_config"
|
|
39
|
+
ADD CONSTRAINT "FK_product_config_refund_policy"
|
|
40
|
+
FOREIGN KEY ("refundPolicyId")
|
|
41
|
+
REFERENCES "refund_policies"("id")
|
|
42
|
+
ON DELETE SET NULL
|
|
43
|
+
ON UPDATE NO ACTION;
|
|
44
|
+
END IF;
|
|
45
|
+
END $$;
|
|
46
|
+
`);
|
|
47
|
+
|
|
48
|
+
// Index
|
|
49
|
+
await queryRunner.query(`
|
|
50
|
+
CREATE INDEX IF NOT EXISTS "IDX_product_config_refund_policy"
|
|
51
|
+
ON "product_config" ("refundPolicyId")
|
|
52
|
+
`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
56
|
+
await queryRunner.query(`
|
|
57
|
+
DROP INDEX IF EXISTS "IDX_product_config_refund_policy"
|
|
58
|
+
`);
|
|
59
|
+
|
|
60
|
+
await queryRunner.query(`
|
|
61
|
+
ALTER TABLE "product_config"
|
|
62
|
+
DROP CONSTRAINT IF EXISTS "FK_product_config_refund_policy"
|
|
63
|
+
`);
|
|
64
|
+
|
|
65
|
+
await queryRunner.query(`
|
|
66
|
+
ALTER TABLE "product_config"
|
|
67
|
+
DROP COLUMN IF EXISTS "refundPolicyId"
|
|
68
|
+
`);
|
|
69
|
+
|
|
70
|
+
await queryRunner.query(`
|
|
71
|
+
DO $$
|
|
72
|
+
BEGIN
|
|
73
|
+
IF EXISTS (
|
|
74
|
+
SELECT 1
|
|
75
|
+
FROM information_schema.tables
|
|
76
|
+
WHERE table_name = 'product_config'
|
|
77
|
+
) THEN
|
|
78
|
+
ALTER TABLE "product_config"
|
|
79
|
+
RENAME TO "product_taxes";
|
|
80
|
+
END IF;
|
|
81
|
+
END $$;
|
|
82
|
+
`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
export class VendorOwnerProductConfigPermissions1781200000000
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
name = 'VendorOwnerProductConfigPermissions1781200000000';
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
const entities = [
|
|
10
|
+
'product_variants',
|
|
11
|
+
'product_config',
|
|
12
|
+
'product_attributes',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
for (const entity of entities) {
|
|
16
|
+
await queryRunner.query(`
|
|
17
|
+
INSERT INTO "permissions"
|
|
18
|
+
("groupId", "entity", "canCreate", "canRead", "canUpdate", "canDelete")
|
|
19
|
+
SELECT
|
|
20
|
+
g.id,
|
|
21
|
+
'${entity}',
|
|
22
|
+
true,
|
|
23
|
+
true,
|
|
24
|
+
true,
|
|
25
|
+
true
|
|
26
|
+
FROM "user_groups" g
|
|
27
|
+
WHERE g.name = 'Vendor Owner'
|
|
28
|
+
AND g.deleted = false
|
|
29
|
+
ON CONFLICT ("groupId", "entity") DO UPDATE SET
|
|
30
|
+
"canCreate" = true,
|
|
31
|
+
"canRead" = true,
|
|
32
|
+
"canUpdate" = true,
|
|
33
|
+
"canDelete" = true
|
|
34
|
+
`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
39
|
+
await queryRunner.query(`
|
|
40
|
+
DELETE FROM "permissions" p
|
|
41
|
+
USING "user_groups" g
|
|
42
|
+
WHERE p."groupId" = g.id
|
|
43
|
+
AND g.name = 'Vendor Owner'
|
|
44
|
+
AND p.entity IN (
|
|
45
|
+
'product_variants',
|
|
46
|
+
'product_config',
|
|
47
|
+
'product_attributes'
|
|
48
|
+
)
|
|
49
|
+
`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
export class VendorRoleProductConfigPermissions1781210000000
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
name = 'VendorRoleProductConfigPermissions1781210000000';
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
const entities = [
|
|
10
|
+
'product_variants',
|
|
11
|
+
'product_config',
|
|
12
|
+
'product_attributes',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
for (const entity of entities) {
|
|
16
|
+
await queryRunner.query(`
|
|
17
|
+
INSERT INTO "vendor_role_permissions"
|
|
18
|
+
("vendorRoleId", "entity", "canCreate", "canRead", "canUpdate", "canDelete")
|
|
19
|
+
SELECT
|
|
20
|
+
vr.id,
|
|
21
|
+
'${entity}',
|
|
22
|
+
true,
|
|
23
|
+
true,
|
|
24
|
+
true,
|
|
25
|
+
true
|
|
26
|
+
FROM "vendor_roles" vr
|
|
27
|
+
ON CONFLICT ("vendorRoleId", "entity") DO UPDATE SET
|
|
28
|
+
"canCreate" = true,
|
|
29
|
+
"canRead" = true,
|
|
30
|
+
"canUpdate" = true,
|
|
31
|
+
"canDelete" = true
|
|
32
|
+
`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
37
|
+
await queryRunner.query(`
|
|
38
|
+
DELETE FROM "vendor_role_permissions"
|
|
39
|
+
WHERE "entity" IN (
|
|
40
|
+
'product_variants',
|
|
41
|
+
'product_config',
|
|
42
|
+
'product_attributes'
|
|
43
|
+
)
|
|
44
|
+
`);
|
|
45
|
+
}
|
|
46
|
+
}
|