@ooneex/typeorm 0.15.0 → 0.16.1
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/dist/shared/chunk-b668j15v.js +5 -0
- package/dist/shared/chunk-b668j15v.js.map +15 -0
- package/dist/shared/chunk-gb0y6wm0.js +5 -0
- package/dist/shared/{chunk-kw4t1san.js.map → chunk-gb0y6wm0.js.map} +3 -3
- package/dist/src/entities/payment/index.d.ts +39 -23
- package/dist/src/entities/payment/index.js +2 -2
- package/dist/src/entities/payment/index.js.map +1 -1
- package/dist/src/entities/user/index.d.ts +1 -0
- package/dist/src/entities/user/index.js +1 -1
- package/dist/src/migrations/payment/index.d.ts +4 -4
- package/dist/src/migrations/payment/index.js +113 -79
- package/dist/src/migrations/payment/index.js.map +6 -6
- package/dist/src/migrations/user/index.js +4 -1
- package/dist/src/migrations/user/index.js.map +3 -3
- package/dist/src/repositories/payment/index.d.ts +66 -50
- package/dist/src/repositories/payment/index.js +2 -2
- package/dist/src/repositories/payment/index.js.map +4 -4
- package/dist/src/repositories/user/index.d.ts +1 -0
- package/dist/src/repositories/user/index.js +1 -1
- package/package.json +22 -22
- package/dist/shared/chunk-5tnqjb3n.js +0 -5
- package/dist/shared/chunk-5tnqjb3n.js.map +0 -15
- package/dist/shared/chunk-kw4t1san.js +0 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as d}from"../../../shared/chunk-qyf32qsz.js";import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as T}from"../../../shared/chunk-aj0aak90.js";import"../../../shared/chunk-31y260d6.js";import{Ha as i}from"../../../shared/chunk-59vwmfpm.js";import{decorator as c}from"@ooneex/migrations";class t{async up(a){await a`
|
|
3
3
|
CREATE TABLE IF NOT EXISTS payment_features (
|
|
4
4
|
id VARCHAR(25) PRIMARY KEY,
|
|
5
5
|
name VARCHAR(255) NOT NULL,
|
|
@@ -31,15 +31,24 @@ import{a as o}from"../../../shared/chunk-qyf32qsz.js";import{b as T}from"../../.
|
|
|
31
31
|
CREATE INDEX IF NOT EXISTS idx_payment_features_created_at ON payment_features(created_at DESC)
|
|
32
32
|
`,await a`
|
|
33
33
|
CREATE INDEX IF NOT EXISTS idx_payment_features_active ON payment_features(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
34
|
-
`}async down(a){await a`DROP TABLE IF EXISTS payment_features CASCADE`}getVersion(){return"20251225182218185"}getDependencies(){return[]}}
|
|
34
|
+
`}async down(a){await a`DROP TABLE IF EXISTS payment_features CASCADE`}getVersion(){return"20251225182218185"}getDependencies(){return[]}}t=i([c.migration()],t);import{decorator as N}from"@ooneex/migrations";class s{async up(a){await a`
|
|
35
35
|
CREATE TABLE IF NOT EXISTS payment_products (
|
|
36
36
|
id VARCHAR(25) PRIMARY KEY,
|
|
37
|
+
key VARCHAR(255) UNIQUE,
|
|
37
38
|
name VARCHAR(255) NOT NULL,
|
|
38
39
|
description TEXT,
|
|
39
|
-
currency VARCHAR(3)
|
|
40
|
-
price DECIMAL(10, 2)
|
|
40
|
+
currency VARCHAR(3),
|
|
41
|
+
price DECIMAL(10, 2),
|
|
41
42
|
barcode VARCHAR(255),
|
|
42
43
|
attributes JSONB,
|
|
44
|
+
is_recurring BOOLEAN,
|
|
45
|
+
is_archived BOOLEAN,
|
|
46
|
+
organization_id VARCHAR(25),
|
|
47
|
+
recurring_interval VARCHAR(20),
|
|
48
|
+
metadata JSONB,
|
|
49
|
+
prices JSONB,
|
|
50
|
+
benefits JSONB,
|
|
51
|
+
attached_custom_fields JSONB,
|
|
43
52
|
is_locked BOOLEAN DEFAULT false,
|
|
44
53
|
locked_at TIMESTAMPTZ,
|
|
45
54
|
is_blocked BOOLEAN DEFAULT false,
|
|
@@ -75,6 +84,8 @@ import{a as o}from"../../../shared/chunk-qyf32qsz.js";import{b as T}from"../../.
|
|
|
75
84
|
CONSTRAINT fk_payment_products_tags_product FOREIGN KEY (product_id) REFERENCES payment_products(id) ON DELETE CASCADE,
|
|
76
85
|
CONSTRAINT fk_payment_products_tags_tag FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE
|
|
77
86
|
)
|
|
87
|
+
`,await a`
|
|
88
|
+
CREATE INDEX IF NOT EXISTS idx_payment_products_key ON payment_products(key)
|
|
78
89
|
`,await a`
|
|
79
90
|
CREATE INDEX IF NOT EXISTS idx_payment_products_name ON payment_products(name)
|
|
80
91
|
`,await a`
|
|
@@ -83,6 +94,14 @@ import{a as o}from"../../../shared/chunk-qyf32qsz.js";import{b as T}from"../../.
|
|
|
83
94
|
CREATE INDEX IF NOT EXISTS idx_payment_products_price ON payment_products(price)
|
|
84
95
|
`,await a`
|
|
85
96
|
CREATE INDEX IF NOT EXISTS idx_payment_products_barcode ON payment_products(barcode)
|
|
97
|
+
`,await a`
|
|
98
|
+
CREATE INDEX IF NOT EXISTS idx_payment_products_is_recurring ON payment_products(is_recurring)
|
|
99
|
+
`,await a`
|
|
100
|
+
CREATE INDEX IF NOT EXISTS idx_payment_products_is_archived ON payment_products(is_archived)
|
|
101
|
+
`,await a`
|
|
102
|
+
CREATE INDEX IF NOT EXISTS idx_payment_products_organization_id ON payment_products(organization_id)
|
|
103
|
+
`,await a`
|
|
104
|
+
CREATE INDEX IF NOT EXISTS idx_payment_products_recurring_interval ON payment_products(recurring_interval)
|
|
86
105
|
`,await a`
|
|
87
106
|
CREATE INDEX IF NOT EXISTS idx_payment_products_language ON payment_products(language)
|
|
88
107
|
`,await a`
|
|
@@ -105,7 +124,7 @@ import{a as o}from"../../../shared/chunk-qyf32qsz.js";import{b as T}from"../../.
|
|
|
105
124
|
CREATE INDEX IF NOT EXISTS idx_payment_products_tags_product_id ON payment_products_tags(product_id)
|
|
106
125
|
`,await a`
|
|
107
126
|
CREATE INDEX IF NOT EXISTS idx_payment_products_tags_tag_id ON payment_products_tags(tag_id)
|
|
108
|
-
`}async down(a){await a`DROP TABLE IF EXISTS payment_products_tags CASCADE`,await a`DROP TABLE IF EXISTS payment_products_images CASCADE`,await a`DROP TABLE IF EXISTS payment_products_categories CASCADE`,await a`DROP TABLE IF EXISTS payment_products CASCADE`}getVersion(){return"20251225182218188"}getDependencies(){return[
|
|
127
|
+
`}async down(a){await a`DROP TABLE IF EXISTS payment_products_tags CASCADE`,await a`DROP TABLE IF EXISTS payment_products_images CASCADE`,await a`DROP TABLE IF EXISTS payment_products_categories CASCADE`,await a`DROP TABLE IF EXISTS payment_products CASCADE`}getVersion(){return"20251225182218188"}getDependencies(){return[p,d,T]}}s=i([N.migration()],s);import{decorator as r}from"@ooneex/migrations";class e{async up(a){await a`
|
|
109
128
|
CREATE TYPE subscription_period AS ENUM ('monthly', 'yearly', 'weekly', 'daily')
|
|
110
129
|
`,await a`
|
|
111
130
|
CREATE TABLE IF NOT EXISTS payment_plans (
|
|
@@ -163,23 +182,13 @@ import{a as o}from"../../../shared/chunk-qyf32qsz.js";import{b as T}from"../../.
|
|
|
163
182
|
CREATE INDEX IF NOT EXISTS idx_payment_plans_features_plan_id ON payment_plans_features(plan_id)
|
|
164
183
|
`,await a`
|
|
165
184
|
CREATE INDEX IF NOT EXISTS idx_payment_plans_features_feature_id ON payment_plans_features(feature_id)
|
|
166
|
-
`}async down(a){await a`DROP TABLE IF EXISTS payment_plans_features CASCADE`,await a`DROP TABLE IF EXISTS payment_plans CASCADE`,await a`DROP TYPE IF EXISTS subscription_period CASCADE`}getVersion(){return"20251225182218190"}getDependencies(){return[
|
|
167
|
-
CREATE
|
|
168
|
-
`,await a`
|
|
169
|
-
CREATE TABLE IF NOT EXISTS payment_coupons (
|
|
185
|
+
`}async down(a){await a`DROP TABLE IF EXISTS payment_plans_features CASCADE`,await a`DROP TABLE IF EXISTS payment_plans CASCADE`,await a`DROP TYPE IF EXISTS subscription_period CASCADE`}getVersion(){return"20251225182218190"}getDependencies(){return[t]}}e=i([r.migration()],e);import{decorator as o}from"@ooneex/migrations";class E{async up(a){await a`
|
|
186
|
+
CREATE TABLE IF NOT EXISTS payment_credits (
|
|
170
187
|
id VARCHAR(25) PRIMARY KEY,
|
|
171
|
-
|
|
172
|
-
name VARCHAR(255),
|
|
173
|
-
description TEXT,
|
|
174
|
-
discount_type discount_type NOT NULL,
|
|
175
|
-
discount_value DECIMAL(10, 2) NOT NULL,
|
|
188
|
+
balance DECIMAL(10, 2) NOT NULL,
|
|
176
189
|
currency VARCHAR(3),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
start_at TIMESTAMPTZ,
|
|
180
|
-
end_at TIMESTAMPTZ,
|
|
181
|
-
is_active BOOLEAN DEFAULT true,
|
|
182
|
-
minimum_amount DECIMAL(10, 2),
|
|
190
|
+
expires_at TIMESTAMPTZ,
|
|
191
|
+
description TEXT,
|
|
183
192
|
is_locked BOOLEAN DEFAULT false,
|
|
184
193
|
locked_at TIMESTAMPTZ,
|
|
185
194
|
is_blocked BOOLEAN DEFAULT false,
|
|
@@ -192,58 +201,49 @@ import{a as o}from"../../../shared/chunk-qyf32qsz.js";import{b as T}from"../../.
|
|
|
192
201
|
deleted_at TIMESTAMPTZ
|
|
193
202
|
)
|
|
194
203
|
`,await a`
|
|
195
|
-
CREATE
|
|
196
|
-
coupon_id VARCHAR(25) NOT NULL,
|
|
197
|
-
product_id VARCHAR(25) NOT NULL,
|
|
198
|
-
PRIMARY KEY (coupon_id, product_id),
|
|
199
|
-
CONSTRAINT fk_payment_coupons_applicable_products_coupon FOREIGN KEY (coupon_id) REFERENCES payment_coupons(id) ON DELETE CASCADE,
|
|
200
|
-
CONSTRAINT fk_payment_coupons_applicable_products_product FOREIGN KEY (product_id) REFERENCES payment_products(id) ON DELETE CASCADE
|
|
201
|
-
)
|
|
202
|
-
`,await a`
|
|
203
|
-
CREATE TABLE IF NOT EXISTS payment_coupons_applicable_plans (
|
|
204
|
-
coupon_id VARCHAR(25) NOT NULL,
|
|
205
|
-
plan_id VARCHAR(25) NOT NULL,
|
|
206
|
-
PRIMARY KEY (coupon_id, plan_id),
|
|
207
|
-
CONSTRAINT fk_payment_coupons_applicable_plans_coupon FOREIGN KEY (coupon_id) REFERENCES payment_coupons(id) ON DELETE CASCADE,
|
|
208
|
-
CONSTRAINT fk_payment_coupons_applicable_plans_plan FOREIGN KEY (plan_id) REFERENCES payment_plans(id) ON DELETE CASCADE
|
|
209
|
-
)
|
|
210
|
-
`,await a`
|
|
211
|
-
CREATE INDEX IF NOT EXISTS idx_payment_coupons_code ON payment_coupons(code)
|
|
212
|
-
`,await a`
|
|
213
|
-
CREATE INDEX IF NOT EXISTS idx_payment_coupons_discount_type ON payment_coupons(discount_type)
|
|
214
|
-
`,await a`
|
|
215
|
-
CREATE INDEX IF NOT EXISTS idx_payment_coupons_is_active ON payment_coupons(is_active)
|
|
216
|
-
`,await a`
|
|
217
|
-
CREATE INDEX IF NOT EXISTS idx_payment_coupons_start_at ON payment_coupons(start_at)
|
|
218
|
-
`,await a`
|
|
219
|
-
CREATE INDEX IF NOT EXISTS idx_payment_coupons_end_at ON payment_coupons(end_at)
|
|
204
|
+
CREATE INDEX IF NOT EXISTS idx_payment_credits_balance ON payment_credits(balance)
|
|
220
205
|
`,await a`
|
|
221
|
-
CREATE INDEX IF NOT EXISTS
|
|
206
|
+
CREATE INDEX IF NOT EXISTS idx_payment_credits_currency ON payment_credits(currency)
|
|
222
207
|
`,await a`
|
|
223
|
-
CREATE INDEX IF NOT EXISTS
|
|
208
|
+
CREATE INDEX IF NOT EXISTS idx_payment_credits_expires_at ON payment_credits(expires_at)
|
|
224
209
|
`,await a`
|
|
225
|
-
CREATE INDEX IF NOT EXISTS
|
|
210
|
+
CREATE INDEX IF NOT EXISTS idx_payment_credits_language ON payment_credits(language)
|
|
226
211
|
`,await a`
|
|
227
|
-
CREATE INDEX IF NOT EXISTS
|
|
212
|
+
CREATE INDEX IF NOT EXISTS idx_payment_credits_deleted_at ON payment_credits(deleted_at)
|
|
228
213
|
`,await a`
|
|
229
|
-
CREATE INDEX IF NOT EXISTS
|
|
214
|
+
CREATE INDEX IF NOT EXISTS idx_payment_credits_is_public ON payment_credits(is_public) WHERE deleted_at IS NULL
|
|
230
215
|
`,await a`
|
|
231
|
-
CREATE INDEX IF NOT EXISTS
|
|
216
|
+
CREATE INDEX IF NOT EXISTS idx_payment_credits_created_at ON payment_credits(created_at DESC)
|
|
232
217
|
`,await a`
|
|
233
|
-
CREATE INDEX IF NOT EXISTS
|
|
218
|
+
CREATE INDEX IF NOT EXISTS idx_payment_credits_active ON payment_credits(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
234
219
|
`,await a`
|
|
235
|
-
CREATE INDEX IF NOT EXISTS
|
|
220
|
+
CREATE INDEX IF NOT EXISTS idx_payment_credits_valid ON payment_credits(expires_at) WHERE deleted_at IS NULL AND (expires_at IS NULL OR expires_at > CURRENT_TIMESTAMP)
|
|
221
|
+
`}async down(a){await a`DROP TABLE IF EXISTS payment_credits CASCADE`}getVersion(){return"20251225182218195"}getDependencies(){return[]}}E=i([o.migration()],E);import{decorator as A}from"@ooneex/migrations";import{decorator as I}from"@ooneex/migrations";class _{async up(a){await a`
|
|
222
|
+
CREATE TYPE payment_discount_type AS ENUM ('percentage', 'fixed')
|
|
236
223
|
`,await a`
|
|
237
|
-
CREATE
|
|
224
|
+
CREATE TYPE payment_discount_duration AS ENUM ('once', 'repeating', 'forever')
|
|
238
225
|
`,await a`
|
|
239
|
-
CREATE
|
|
240
|
-
`}async down(a){await a`DROP TABLE IF EXISTS payment_coupons_applicable_plans CASCADE`,await a`DROP TABLE IF EXISTS payment_coupons_applicable_products CASCADE`,await a`DROP TABLE IF EXISTS payment_coupons CASCADE`,await a`DROP TYPE IF EXISTS discount_type CASCADE`}getVersion(){return"20251225182218192"}getDependencies(){return[t,i]}}_=e([r.migration()],_);import{decorator as I}from"@ooneex/migrations";class s{async up(a){await a`
|
|
241
|
-
CREATE TABLE IF NOT EXISTS payment_credits (
|
|
226
|
+
CREATE TABLE IF NOT EXISTS payment_discounts (
|
|
242
227
|
id VARCHAR(25) PRIMARY KEY,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
expires_at TIMESTAMPTZ,
|
|
228
|
+
key VARCHAR(255) UNIQUE,
|
|
229
|
+
name VARCHAR(255) NOT NULL,
|
|
246
230
|
description TEXT,
|
|
231
|
+
code VARCHAR(50) UNIQUE,
|
|
232
|
+
type payment_discount_type NOT NULL,
|
|
233
|
+
amount DECIMAL(10, 2) NOT NULL,
|
|
234
|
+
currency VARCHAR(3),
|
|
235
|
+
duration payment_discount_duration NOT NULL,
|
|
236
|
+
duration_in_months INT,
|
|
237
|
+
start_at TIMESTAMPTZ,
|
|
238
|
+
end_at TIMESTAMPTZ,
|
|
239
|
+
max_uses INT,
|
|
240
|
+
used_count INT DEFAULT 0,
|
|
241
|
+
max_redemptions INT,
|
|
242
|
+
redemptions_count INT DEFAULT 0,
|
|
243
|
+
is_active BOOLEAN DEFAULT true,
|
|
244
|
+
minimum_amount DECIMAL(10, 2),
|
|
245
|
+
organization_id VARCHAR(25),
|
|
246
|
+
metadata JSONB,
|
|
247
247
|
is_locked BOOLEAN DEFAULT false,
|
|
248
248
|
locked_at TIMESTAMPTZ,
|
|
249
249
|
is_blocked BOOLEAN DEFAULT false,
|
|
@@ -256,24 +256,58 @@ import{a as o}from"../../../shared/chunk-qyf32qsz.js";import{b as T}from"../../.
|
|
|
256
256
|
deleted_at TIMESTAMPTZ
|
|
257
257
|
)
|
|
258
258
|
`,await a`
|
|
259
|
-
CREATE
|
|
259
|
+
CREATE TABLE IF NOT EXISTS payment_discounts_applicable_products (
|
|
260
|
+
discount_id VARCHAR(25) NOT NULL,
|
|
261
|
+
product_id VARCHAR(25) NOT NULL,
|
|
262
|
+
PRIMARY KEY (discount_id, product_id),
|
|
263
|
+
CONSTRAINT fk_payment_discounts_applicable_products_discount FOREIGN KEY (discount_id) REFERENCES payment_discounts(id) ON DELETE CASCADE,
|
|
264
|
+
CONSTRAINT fk_payment_discounts_applicable_products_product FOREIGN KEY (product_id) REFERENCES payment_products(id) ON DELETE CASCADE
|
|
265
|
+
)
|
|
260
266
|
`,await a`
|
|
261
|
-
CREATE
|
|
267
|
+
CREATE TABLE IF NOT EXISTS payment_discounts_applicable_plans (
|
|
268
|
+
discount_id VARCHAR(25) NOT NULL,
|
|
269
|
+
plan_id VARCHAR(25) NOT NULL,
|
|
270
|
+
PRIMARY KEY (discount_id, plan_id),
|
|
271
|
+
CONSTRAINT fk_payment_discounts_applicable_plans_discount FOREIGN KEY (discount_id) REFERENCES payment_discounts(id) ON DELETE CASCADE,
|
|
272
|
+
CONSTRAINT fk_payment_discounts_applicable_plans_plan FOREIGN KEY (plan_id) REFERENCES payment_plans(id) ON DELETE CASCADE
|
|
273
|
+
)
|
|
262
274
|
`,await a`
|
|
263
|
-
CREATE INDEX IF NOT EXISTS
|
|
275
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_key ON payment_discounts(key)
|
|
264
276
|
`,await a`
|
|
265
|
-
CREATE INDEX IF NOT EXISTS
|
|
277
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_name ON payment_discounts(name)
|
|
266
278
|
`,await a`
|
|
267
|
-
CREATE INDEX IF NOT EXISTS
|
|
279
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_code ON payment_discounts(code)
|
|
268
280
|
`,await a`
|
|
269
|
-
CREATE INDEX IF NOT EXISTS
|
|
281
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_type ON payment_discounts(type)
|
|
270
282
|
`,await a`
|
|
271
|
-
CREATE INDEX IF NOT EXISTS
|
|
283
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_duration ON payment_discounts(duration)
|
|
272
284
|
`,await a`
|
|
273
|
-
CREATE INDEX IF NOT EXISTS
|
|
285
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_organization_id ON payment_discounts(organization_id)
|
|
274
286
|
`,await a`
|
|
275
|
-
CREATE INDEX IF NOT EXISTS
|
|
276
|
-
|
|
287
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_start_at ON payment_discounts(start_at)
|
|
288
|
+
`,await a`
|
|
289
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_end_at ON payment_discounts(end_at)
|
|
290
|
+
`,await a`
|
|
291
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_is_active ON payment_discounts(is_active)
|
|
292
|
+
`,await a`
|
|
293
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_deleted_at ON payment_discounts(deleted_at)
|
|
294
|
+
`,await a`
|
|
295
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_is_public ON payment_discounts(is_public) WHERE deleted_at IS NULL
|
|
296
|
+
`,await a`
|
|
297
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_created_at ON payment_discounts(created_at DESC)
|
|
298
|
+
`,await a`
|
|
299
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_active ON payment_discounts(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
300
|
+
`,await a`
|
|
301
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_valid ON payment_discounts(is_active, start_at, end_at) WHERE deleted_at IS NULL AND is_active = true AND (start_at IS NULL OR start_at <= CURRENT_TIMESTAMP) AND (end_at IS NULL OR end_at >= CURRENT_TIMESTAMP)
|
|
302
|
+
`,await a`
|
|
303
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_applicable_products_discount_id ON payment_discounts_applicable_products(discount_id)
|
|
304
|
+
`,await a`
|
|
305
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_applicable_products_product_id ON payment_discounts_applicable_products(product_id)
|
|
306
|
+
`,await a`
|
|
307
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_applicable_plans_discount_id ON payment_discounts_applicable_plans(discount_id)
|
|
308
|
+
`,await a`
|
|
309
|
+
CREATE INDEX IF NOT EXISTS idx_payment_discounts_applicable_plans_plan_id ON payment_discounts_applicable_plans(plan_id)
|
|
310
|
+
`}async down(a){await a`DROP TABLE IF EXISTS payment_discounts_applicable_plans CASCADE`,await a`DROP TABLE IF EXISTS payment_discounts_applicable_products CASCADE`,await a`DROP TABLE IF EXISTS payment_discounts CASCADE`,await a`DROP TYPE IF EXISTS payment_discount_duration`,await a`DROP TYPE IF EXISTS payment_discount_type`}getVersion(){return"20260118214514066"}getDependencies(){return[s,e]}}_=i([I.migration()],_);class n{async up(a){await a`
|
|
277
311
|
CREATE TABLE IF NOT EXISTS payment_subscriptions (
|
|
278
312
|
id VARCHAR(25) PRIMARY KEY,
|
|
279
313
|
start_at TIMESTAMPTZ NOT NULL,
|
|
@@ -292,12 +326,12 @@ import{a as o}from"../../../shared/chunk-qyf32qsz.js";import{b as T}from"../../.
|
|
|
292
326
|
deleted_at TIMESTAMPTZ
|
|
293
327
|
)
|
|
294
328
|
`,await a`
|
|
295
|
-
CREATE TABLE IF NOT EXISTS
|
|
329
|
+
CREATE TABLE IF NOT EXISTS payment_subscriptions_discounts (
|
|
296
330
|
subscription_id VARCHAR(25) NOT NULL,
|
|
297
|
-
|
|
298
|
-
PRIMARY KEY (subscription_id,
|
|
299
|
-
CONSTRAINT
|
|
300
|
-
CONSTRAINT
|
|
331
|
+
discount_id VARCHAR(25) NOT NULL,
|
|
332
|
+
PRIMARY KEY (subscription_id, discount_id),
|
|
333
|
+
CONSTRAINT fk_payment_subscriptions_discounts_subscription FOREIGN KEY (subscription_id) REFERENCES payment_subscriptions(id) ON DELETE CASCADE,
|
|
334
|
+
CONSTRAINT fk_payment_subscriptions_discounts_discount FOREIGN KEY (discount_id) REFERENCES payment_discounts(id) ON DELETE CASCADE
|
|
301
335
|
)
|
|
302
336
|
`,await a`
|
|
303
337
|
CREATE TABLE IF NOT EXISTS payment_subscriptions_plans (
|
|
@@ -336,9 +370,9 @@ import{a as o}from"../../../shared/chunk-qyf32qsz.js";import{b as T}from"../../.
|
|
|
336
370
|
`,await a`
|
|
337
371
|
CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_active_subs ON payment_subscriptions(is_active, start_at, end_at) WHERE deleted_at IS NULL AND is_active = true
|
|
338
372
|
`,await a`
|
|
339
|
-
CREATE INDEX IF NOT EXISTS
|
|
373
|
+
CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_discounts_subscription_id ON payment_subscriptions_discounts(subscription_id)
|
|
340
374
|
`,await a`
|
|
341
|
-
CREATE INDEX IF NOT EXISTS
|
|
375
|
+
CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_discounts_discount_id ON payment_subscriptions_discounts(discount_id)
|
|
342
376
|
`,await a`
|
|
343
377
|
CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_plans_subscription_id ON payment_subscriptions_plans(subscription_id)
|
|
344
378
|
`,await a`
|
|
@@ -347,6 +381,6 @@ import{a as o}from"../../../shared/chunk-qyf32qsz.js";import{b as T}from"../../.
|
|
|
347
381
|
CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_credits_subscription_id ON payment_subscriptions_credits(subscription_id)
|
|
348
382
|
`,await a`
|
|
349
383
|
CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_credits_credit_id ON payment_subscriptions_credits(credit_id)
|
|
350
|
-
`}async down(a){await a`DROP TABLE IF EXISTS payment_subscriptions_credits CASCADE`,await a`DROP TABLE IF EXISTS payment_subscriptions_plans CASCADE`,await a`DROP TABLE IF EXISTS
|
|
384
|
+
`}async down(a){await a`DROP TABLE IF EXISTS payment_subscriptions_credits CASCADE`,await a`DROP TABLE IF EXISTS payment_subscriptions_plans CASCADE`,await a`DROP TABLE IF EXISTS payment_subscriptions_discounts CASCADE`,await a`DROP TABLE IF EXISTS payment_subscriptions CASCADE`}getVersion(){return"20251225182218197"}getDependencies(){return[_,e,E]}}n=i([A.migration()],n);export{_ as Migration20260118214514066,n as Migration20251225182218197,E as Migration20251225182218195,e as Migration20251225182218190,s as Migration20251225182218188,t as Migration20251225182218185};
|
|
351
385
|
|
|
352
|
-
//# debugId=
|
|
386
|
+
//# debugId=F497B52389C1164064756E2164756E21
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["src/migrations/payment/Migration20251225182218185.ts", "src/migrations/payment/Migration20251225182218188.ts", "src/migrations/payment/Migration20251225182218190.ts", "src/migrations/payment/
|
|
3
|
+
"sources": ["src/migrations/payment/Migration20251225182218185.ts", "src/migrations/payment/Migration20251225182218188.ts", "src/migrations/payment/Migration20251225182218190.ts", "src/migrations/payment/Migration20251225182218195.ts", "src/migrations/payment/Migration20251225182218197.ts", "src/migrations/payment/Migration20260118214514066.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\n\n@decorator.migration()\nexport class Migration20251225182218185 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS payment_features (\n id VARCHAR(25) PRIMARY KEY,\n name VARCHAR(255) NOT NULL,\n description TEXT,\n is_enabled BOOLEAN DEFAULT true,\n \"limit\" INT,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n deleted_at TIMESTAMPTZ\n )\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_features_name ON payment_features(name)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_features_is_enabled ON payment_features(is_enabled)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_features_language ON payment_features(language)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_features_deleted_at ON payment_features(deleted_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_features_is_public ON payment_features(is_public) WHERE deleted_at IS NULL\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_features_created_at ON payment_features(created_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_features_active ON payment_features(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false\n `;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS payment_features CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182218185\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [];\n }\n}\n",
|
|
6
|
-
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225173351645 } from \"../common/Migration20251225173351645\";\nimport { Migration20251225173352645 } from \"../common/Migration20251225173352645\";\nimport { Migration20251225181613479 } from \"../image/Migration20251225181613479\";\n\n@decorator.migration()\nexport class Migration20251225182218188 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS payment_products (\n id VARCHAR(25) PRIMARY KEY,\n name VARCHAR(255) NOT NULL,\n description TEXT,\n currency VARCHAR(3)
|
|
6
|
+
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225173351645 } from \"../common/Migration20251225173351645\";\nimport { Migration20251225173352645 } from \"../common/Migration20251225173352645\";\nimport { Migration20251225181613479 } from \"../image/Migration20251225181613479\";\n\n@decorator.migration()\nexport class Migration20251225182218188 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS payment_products (\n id VARCHAR(25) PRIMARY KEY,\n key VARCHAR(255) UNIQUE,\n name VARCHAR(255) NOT NULL,\n description TEXT,\n currency VARCHAR(3),\n price DECIMAL(10, 2),\n barcode VARCHAR(255),\n attributes JSONB,\n is_recurring BOOLEAN,\n is_archived BOOLEAN,\n organization_id VARCHAR(25),\n recurring_interval VARCHAR(20),\n metadata JSONB,\n prices JSONB,\n benefits JSONB,\n attached_custom_fields JSONB,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n deleted_at TIMESTAMPTZ\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_products_categories (\n product_id VARCHAR(25) NOT NULL,\n category_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (product_id, category_id),\n CONSTRAINT fk_payment_products_categories_product FOREIGN KEY (product_id) REFERENCES payment_products(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_products_categories_category FOREIGN KEY (category_id) REFERENCES categories(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_products_images (\n product_id VARCHAR(25) NOT NULL,\n image_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (product_id, image_id),\n CONSTRAINT fk_payment_products_images_product FOREIGN KEY (product_id) REFERENCES payment_products(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_products_images_image FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_products_tags (\n product_id VARCHAR(25) NOT NULL,\n tag_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (product_id, tag_id),\n CONSTRAINT fk_payment_products_tags_product FOREIGN KEY (product_id) REFERENCES payment_products(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_products_tags_tag FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_key ON payment_products(key)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_name ON payment_products(name)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_currency ON payment_products(currency)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_price ON payment_products(price)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_barcode ON payment_products(barcode)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_is_recurring ON payment_products(is_recurring)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_is_archived ON payment_products(is_archived)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_organization_id ON payment_products(organization_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_recurring_interval ON payment_products(recurring_interval)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_language ON payment_products(language)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_deleted_at ON payment_products(deleted_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_is_public ON payment_products(is_public) WHERE deleted_at IS NULL\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_created_at ON payment_products(created_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_active ON payment_products(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_categories_product_id ON payment_products_categories(product_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_categories_category_id ON payment_products_categories(category_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_images_product_id ON payment_products_images(product_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_images_image_id ON payment_products_images(image_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_tags_product_id ON payment_products_tags(product_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_products_tags_tag_id ON payment_products_tags(tag_id)\n `;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS payment_products_tags CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_products_images CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_products_categories CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_products CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182218188\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [\n Migration20251225173352645, // Categories table\n Migration20251225181613479, // Images table\n Migration20251225173351645, // Tags table\n ];\n }\n}\n",
|
|
7
7
|
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225182218185 } from \"./Migration20251225182218185\";\n\n@decorator.migration()\nexport class Migration20251225182218190 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TYPE subscription_period AS ENUM ('monthly', 'yearly', 'weekly', 'daily')\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_plans (\n id VARCHAR(25) PRIMARY KEY,\n name VARCHAR(255) NOT NULL,\n description TEXT,\n currency VARCHAR(3) NOT NULL,\n price DECIMAL(10, 2) NOT NULL,\n period subscription_period NOT NULL,\n period_count INT DEFAULT 1,\n is_active BOOLEAN DEFAULT true,\n trial_days INT DEFAULT 0,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n deleted_at TIMESTAMPTZ\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_plans_features (\n plan_id VARCHAR(25) NOT NULL,\n feature_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (plan_id, feature_id),\n CONSTRAINT fk_payment_plans_features_plan FOREIGN KEY (plan_id) REFERENCES payment_plans(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_plans_features_feature FOREIGN KEY (feature_id) REFERENCES payment_features(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_name ON payment_plans(name)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_currency ON payment_plans(currency)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_price ON payment_plans(price)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_period ON payment_plans(period)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_is_active ON payment_plans(is_active)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_language ON payment_plans(language)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_deleted_at ON payment_plans(deleted_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_is_public ON payment_plans(is_public) WHERE deleted_at IS NULL\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_created_at ON payment_plans(created_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_active ON payment_plans(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_active_plans ON payment_plans(is_active, price) WHERE deleted_at IS NULL AND is_active = true\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_features_plan_id ON payment_plans_features(plan_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_plans_features_feature_id ON payment_plans_features(feature_id)\n `;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS payment_plans_features CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_plans CASCADE`;\n await tx`DROP TYPE IF EXISTS subscription_period CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182218190\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [\n Migration20251225182218185, // Payment features table\n ];\n }\n}\n",
|
|
8
|
-
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225182218188 } from \"./Migration20251225182218188\";\nimport { Migration20251225182218190 } from \"./Migration20251225182218190\";\n\n@decorator.migration()\nexport class Migration20251225182218192 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TYPE discount_type AS ENUM ('percentage', 'fixed')\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_coupons (\n id VARCHAR(25) PRIMARY KEY,\n code VARCHAR(50) NOT NULL UNIQUE,\n name VARCHAR(255),\n description TEXT,\n discount_type discount_type NOT NULL,\n discount_value DECIMAL(10, 2) NOT NULL,\n currency VARCHAR(3),\n max_uses INT,\n used_count INT DEFAULT 0,\n start_at TIMESTAMPTZ,\n end_at TIMESTAMPTZ,\n is_active BOOLEAN DEFAULT true,\n minimum_amount DECIMAL(10, 2),\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n deleted_at TIMESTAMPTZ\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_coupons_applicable_products (\n coupon_id VARCHAR(25) NOT NULL,\n product_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (coupon_id, product_id),\n CONSTRAINT fk_payment_coupons_applicable_products_coupon FOREIGN KEY (coupon_id) REFERENCES payment_coupons(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_coupons_applicable_products_product FOREIGN KEY (product_id) REFERENCES payment_products(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_coupons_applicable_plans (\n coupon_id VARCHAR(25) NOT NULL,\n plan_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (coupon_id, plan_id),\n CONSTRAINT fk_payment_coupons_applicable_plans_coupon FOREIGN KEY (coupon_id) REFERENCES payment_coupons(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_coupons_applicable_plans_plan FOREIGN KEY (plan_id) REFERENCES payment_plans(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_code ON payment_coupons(code)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_discount_type ON payment_coupons(discount_type)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_is_active ON payment_coupons(is_active)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_start_at ON payment_coupons(start_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_end_at ON payment_coupons(end_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_language ON payment_coupons(language)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_deleted_at ON payment_coupons(deleted_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_is_public ON payment_coupons(is_public) WHERE deleted_at IS NULL\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_created_at ON payment_coupons(created_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_active ON payment_coupons(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_valid ON payment_coupons(is_active, start_at, end_at) WHERE deleted_at IS NULL AND is_active = true AND (start_at IS NULL OR start_at <= CURRENT_TIMESTAMP) AND (end_at IS NULL OR end_at >= CURRENT_TIMESTAMP)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_applicable_products_coupon_id ON payment_coupons_applicable_products(coupon_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_applicable_products_product_id ON payment_coupons_applicable_products(product_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_applicable_plans_coupon_id ON payment_coupons_applicable_plans(coupon_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_coupons_applicable_plans_plan_id ON payment_coupons_applicable_plans(plan_id)\n `;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS payment_coupons_applicable_plans CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_coupons_applicable_products CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_coupons CASCADE`;\n await tx`DROP TYPE IF EXISTS discount_type CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182218192\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [\n Migration20251225182218188, // Payment products table\n Migration20251225182218190, // Payment plans table\n ];\n }\n}\n",
|
|
9
8
|
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\n\n@decorator.migration()\nexport class Migration20251225182218195 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS payment_credits (\n id VARCHAR(25) PRIMARY KEY,\n balance DECIMAL(10, 2) NOT NULL,\n currency VARCHAR(3),\n expires_at TIMESTAMPTZ,\n description TEXT,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n deleted_at TIMESTAMPTZ\n )\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_credits_balance ON payment_credits(balance)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_credits_currency ON payment_credits(currency)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_credits_expires_at ON payment_credits(expires_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_credits_language ON payment_credits(language)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_credits_deleted_at ON payment_credits(deleted_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_credits_is_public ON payment_credits(is_public) WHERE deleted_at IS NULL\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_credits_created_at ON payment_credits(created_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_credits_active ON payment_credits(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_credits_valid ON payment_credits(expires_at) WHERE deleted_at IS NULL AND (expires_at IS NULL OR expires_at > CURRENT_TIMESTAMP)\n `;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS payment_credits CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182218195\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [];\n }\n}\n",
|
|
10
|
-
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225182218190 } from \"./Migration20251225182218190\";\nimport {
|
|
9
|
+
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225182218190 } from \"./Migration20251225182218190\";\nimport { Migration20251225182218195 } from \"./Migration20251225182218195\";\nimport { Migration20260118214514066 } from \"./Migration20260118214514066\";\n\n@decorator.migration()\nexport class Migration20251225182218197 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS payment_subscriptions (\n id VARCHAR(25) PRIMARY KEY,\n start_at TIMESTAMPTZ NOT NULL,\n end_at TIMESTAMPTZ,\n is_trial BOOLEAN DEFAULT false,\n is_active BOOLEAN DEFAULT true,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n deleted_at TIMESTAMPTZ\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_subscriptions_discounts (\n subscription_id VARCHAR(25) NOT NULL,\n discount_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (subscription_id, discount_id),\n CONSTRAINT fk_payment_subscriptions_discounts_subscription FOREIGN KEY (subscription_id) REFERENCES payment_subscriptions(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_subscriptions_discounts_discount FOREIGN KEY (discount_id) REFERENCES payment_discounts(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_subscriptions_plans (\n subscription_id VARCHAR(25) NOT NULL,\n plan_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (subscription_id, plan_id),\n CONSTRAINT fk_payment_subscriptions_plans_subscription FOREIGN KEY (subscription_id) REFERENCES payment_subscriptions(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_subscriptions_plans_plan FOREIGN KEY (plan_id) REFERENCES payment_plans(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_subscriptions_credits (\n subscription_id VARCHAR(25) NOT NULL,\n credit_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (subscription_id, credit_id),\n CONSTRAINT fk_payment_subscriptions_credits_subscription FOREIGN KEY (subscription_id) REFERENCES payment_subscriptions(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_subscriptions_credits_credit FOREIGN KEY (credit_id) REFERENCES payment_credits(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_start_at ON payment_subscriptions(start_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_end_at ON payment_subscriptions(end_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_is_trial ON payment_subscriptions(is_trial)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_is_active ON payment_subscriptions(is_active)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_language ON payment_subscriptions(language)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_deleted_at ON payment_subscriptions(deleted_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_is_public ON payment_subscriptions(is_public) WHERE deleted_at IS NULL\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_created_at ON payment_subscriptions(created_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_active ON payment_subscriptions(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_active_subs ON payment_subscriptions(is_active, start_at, end_at) WHERE deleted_at IS NULL AND is_active = true\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_discounts_subscription_id ON payment_subscriptions_discounts(subscription_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_discounts_discount_id ON payment_subscriptions_discounts(discount_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_plans_subscription_id ON payment_subscriptions_plans(subscription_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_plans_plan_id ON payment_subscriptions_plans(plan_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_credits_subscription_id ON payment_subscriptions_credits(subscription_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_subscriptions_credits_credit_id ON payment_subscriptions_credits(credit_id)\n `;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS payment_subscriptions_credits CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_subscriptions_plans CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_subscriptions_discounts CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_subscriptions CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182218197\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [\n Migration20260118214514066, // Payment discounts table\n Migration20251225182218190, // Payment plans table\n Migration20251225182218195, // Payment credits table\n ];\n }\n}\n",
|
|
10
|
+
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225182218188 } from \"./Migration20251225182218188\";\nimport { Migration20251225182218190 } from \"./Migration20251225182218190\";\n\n@decorator.migration()\nexport class Migration20260118214514066 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TYPE payment_discount_type AS ENUM ('percentage', 'fixed')\n `;\n\n await tx`\n CREATE TYPE payment_discount_duration AS ENUM ('once', 'repeating', 'forever')\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_discounts (\n id VARCHAR(25) PRIMARY KEY,\n key VARCHAR(255) UNIQUE,\n name VARCHAR(255) NOT NULL,\n description TEXT,\n code VARCHAR(50) UNIQUE,\n type payment_discount_type NOT NULL,\n amount DECIMAL(10, 2) NOT NULL,\n currency VARCHAR(3),\n duration payment_discount_duration NOT NULL,\n duration_in_months INT,\n start_at TIMESTAMPTZ,\n end_at TIMESTAMPTZ,\n max_uses INT,\n used_count INT DEFAULT 0,\n max_redemptions INT,\n redemptions_count INT DEFAULT 0,\n is_active BOOLEAN DEFAULT true,\n minimum_amount DECIMAL(10, 2),\n organization_id VARCHAR(25),\n metadata JSONB,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n deleted_at TIMESTAMPTZ\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_discounts_applicable_products (\n discount_id VARCHAR(25) NOT NULL,\n product_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (discount_id, product_id),\n CONSTRAINT fk_payment_discounts_applicable_products_discount FOREIGN KEY (discount_id) REFERENCES payment_discounts(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_discounts_applicable_products_product FOREIGN KEY (product_id) REFERENCES payment_products(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS payment_discounts_applicable_plans (\n discount_id VARCHAR(25) NOT NULL,\n plan_id VARCHAR(25) NOT NULL,\n PRIMARY KEY (discount_id, plan_id),\n CONSTRAINT fk_payment_discounts_applicable_plans_discount FOREIGN KEY (discount_id) REFERENCES payment_discounts(id) ON DELETE CASCADE,\n CONSTRAINT fk_payment_discounts_applicable_plans_plan FOREIGN KEY (plan_id) REFERENCES payment_plans(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_key ON payment_discounts(key)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_name ON payment_discounts(name)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_code ON payment_discounts(code)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_type ON payment_discounts(type)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_duration ON payment_discounts(duration)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_organization_id ON payment_discounts(organization_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_start_at ON payment_discounts(start_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_end_at ON payment_discounts(end_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_is_active ON payment_discounts(is_active)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_deleted_at ON payment_discounts(deleted_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_is_public ON payment_discounts(is_public) WHERE deleted_at IS NULL\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_created_at ON payment_discounts(created_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_active ON payment_discounts(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_valid ON payment_discounts(is_active, start_at, end_at) WHERE deleted_at IS NULL AND is_active = true AND (start_at IS NULL OR start_at <= CURRENT_TIMESTAMP) AND (end_at IS NULL OR end_at >= CURRENT_TIMESTAMP)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_applicable_products_discount_id ON payment_discounts_applicable_products(discount_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_applicable_products_product_id ON payment_discounts_applicable_products(product_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_applicable_plans_discount_id ON payment_discounts_applicable_plans(discount_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_payment_discounts_applicable_plans_plan_id ON payment_discounts_applicable_plans(plan_id)\n `;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS payment_discounts_applicable_plans CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_discounts_applicable_products CASCADE`;\n await tx`DROP TABLE IF EXISTS payment_discounts CASCADE`;\n await tx`DROP TYPE IF EXISTS payment_discount_duration`;\n await tx`DROP TYPE IF EXISTS payment_discount_type`;\n }\n\n public getVersion(): string {\n return \"20260118214514066\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [\n Migration20251225182218188, // payment_products table\n Migration20251225182218190, // payment_plans table\n ];\n }\n}\n"
|
|
11
11
|
],
|
|
12
|
-
"mappings": ";mOAAA,4BAAS,mCAIF,cAAM,SAAiD,MAC/C,GAAE,CAAC,EAAmC,CACjD,KAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAoBN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,WAKK,KAAI,CAAC,EAAmC,CACnD,KAAM,kDAGD,UAAU,EAAW,CAC1B,MAAO,oBAGF,eAAe,EAAyB,CAC7C,MAAO,CAAC,EAEZ,CA9Da,EAAN,GADN,EAAU,UAAU,GACR,GCJb,oBA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,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,WAKK,KAAI,CAAC,EAAmC,CACnD,KAAM,+DACN,KAAM,6DACN,KAAM,iEACN,KAAM,uDAGD,UAAU,EAAW,CAC1B,MAAO,oBAGF,eAAe,EAAyB,CAC7C,MAAO,CACL,EACA,EACA,CACF,EAEJ,CAvIa,EAAN,GADN,EAAU,UAAU,GACR",
|
|
13
|
+
"debugId": "F497B52389C1164064756E2164756E21",
|
|
14
14
|
"names": []
|
|
15
15
|
}
|
|
@@ -4,6 +4,7 @@ import{a as u}from"../../../shared/chunk-qyf32qsz.js";import"../../../shared/chu
|
|
|
4
4
|
id VARCHAR(25) PRIMARY KEY,
|
|
5
5
|
email VARCHAR(255) NOT NULL UNIQUE,
|
|
6
6
|
roles TEXT NOT NULL,
|
|
7
|
+
key VARCHAR(255) UNIQUE,
|
|
7
8
|
name VARCHAR(255),
|
|
8
9
|
last_name VARCHAR(255),
|
|
9
10
|
first_name VARCHAR(255),
|
|
@@ -39,6 +40,8 @@ import{a as u}from"../../../shared/chunk-qyf32qsz.js";import"../../../shared/chu
|
|
|
39
40
|
CREATE INDEX IF NOT EXISTS idx_users_email ON users(email)
|
|
40
41
|
`,await e`
|
|
41
42
|
CREATE INDEX IF NOT EXISTS idx_users_username ON users(username)
|
|
43
|
+
`,await e`
|
|
44
|
+
CREATE INDEX IF NOT EXISTS idx_users_key ON users(key)
|
|
42
45
|
`,await e`
|
|
43
46
|
CREATE INDEX IF NOT EXISTS idx_users_phone ON users(phone)
|
|
44
47
|
`,await e`
|
|
@@ -306,4 +309,4 @@ import{a as u}from"../../../shared/chunk-qyf32qsz.js";import"../../../shared/chu
|
|
|
306
309
|
)
|
|
307
310
|
`,await e`CREATE INDEX IF NOT EXISTS idx_users_viewed_user_id ON users_viewed(user_id)`,await e`CREATE INDEX IF NOT EXISTS idx_users_viewed_viewed_by_id ON users_viewed(viewed_by_id)`,await e`CREATE INDEX IF NOT EXISTS idx_users_viewed_created_at ON users_viewed(created_at)`,await e`CREATE INDEX IF NOT EXISTS idx_users_viewed_deleted_at ON users_viewed(deleted_at)`,await e`CREATE INDEX IF NOT EXISTS idx_users_viewed_user_viewed_by ON users_viewed(user_id, viewed_by_id, created_at)`}async down(e){await e`DROP TABLE IF EXISTS users_viewed CASCADE`}getVersion(){return"20251225182641319"}getDependencies(){return[s]}}A=i([C.migration()],A);export{A as Migration20251225182641319,d as Migration20251225182641316,o as Migration20251225182641314,t as Migration20251225182641312,_ as Migration20251225182641310,T as Migration20251225182641307,E as Migration20251225182641305,r as Migration20251225182641303,a as Migration20251225182641300,s as Migration20251225182641298};
|
|
308
311
|
|
|
309
|
-
//# debugId=
|
|
312
|
+
//# debugId=C5D405F309CEB89964756E2164756E21
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/migrations/user/Migration20251225182641298.ts", "src/migrations/user/Migration20251225182641300.ts", "src/migrations/user/Migration20251225182641303.ts", "src/migrations/user/Migration20251225182641305.ts", "src/migrations/user/Migration20251225182641307.ts", "src/migrations/user/Migration20251225182641310.ts", "src/migrations/user/Migration20251225182641312.ts", "src/migrations/user/Migration20251225182641314.ts", "src/migrations/user/Migration20251225182641316.ts", "src/migrations/user/Migration20251225182641319.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225181613479 } from \"../image/Migration20251225181613479\";\n\n@decorator.migration()\nexport class Migration20251225182641298 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS users (\n id VARCHAR(25) PRIMARY KEY,\n email VARCHAR(255) NOT NULL UNIQUE,\n roles TEXT NOT NULL,\n name VARCHAR(255),\n last_name VARCHAR(255),\n first_name VARCHAR(255),\n username VARCHAR(100) UNIQUE,\n avatar_id VARCHAR(25),\n bio TEXT,\n phone VARCHAR(20),\n birth_date DATE,\n timezone VARCHAR(50),\n is_email_verified BOOLEAN DEFAULT false,\n is_phone_verified BOOLEAN DEFAULT false,\n last_active_at TIMESTAMPTZ,\n email_verified_at TIMESTAMPTZ,\n phone_verified_at TIMESTAMPTZ,\n last_login_at TIMESTAMPTZ,\n password_changed_at TIMESTAMPTZ,\n two_factor_enabled BOOLEAN DEFAULT false,\n two_factor_secret VARCHAR(255),\n recovery_tokens TEXT,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n deleted_at TIMESTAMPTZ,\n CONSTRAINT fk_users_avatar FOREIGN KEY (avatar_id) REFERENCES images(id) ON DELETE SET NULL\n )\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_email ON users(email)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_username ON users(username)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_phone ON users(phone)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_is_email_verified ON users(is_email_verified)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_is_phone_verified ON users(is_phone_verified)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_last_active_at ON users(last_active_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_last_login_at ON users(last_login_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_two_factor_enabled ON users(two_factor_enabled)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_language ON users(language)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_deleted_at ON users(deleted_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_is_public ON users(is_public) WHERE deleted_at IS NULL\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_created_at ON users(created_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_updated_at ON users(updated_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_active ON users(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false\n `;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS users CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182641298\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [\n Migration20251225181613479, // Images table (for avatar_id foreign key)\n ];\n }\n}\n",
|
|
5
|
+
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225181613479 } from \"../image/Migration20251225181613479\";\n\n@decorator.migration()\nexport class Migration20251225182641298 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS users (\n id VARCHAR(25) PRIMARY KEY,\n email VARCHAR(255) NOT NULL UNIQUE,\n roles TEXT NOT NULL,\n key VARCHAR(255) UNIQUE,\n name VARCHAR(255),\n last_name VARCHAR(255),\n first_name VARCHAR(255),\n username VARCHAR(100) UNIQUE,\n avatar_id VARCHAR(25),\n bio TEXT,\n phone VARCHAR(20),\n birth_date DATE,\n timezone VARCHAR(50),\n is_email_verified BOOLEAN DEFAULT false,\n is_phone_verified BOOLEAN DEFAULT false,\n last_active_at TIMESTAMPTZ,\n email_verified_at TIMESTAMPTZ,\n phone_verified_at TIMESTAMPTZ,\n last_login_at TIMESTAMPTZ,\n password_changed_at TIMESTAMPTZ,\n two_factor_enabled BOOLEAN DEFAULT false,\n two_factor_secret VARCHAR(255),\n recovery_tokens TEXT,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n deleted_at TIMESTAMPTZ,\n CONSTRAINT fk_users_avatar FOREIGN KEY (avatar_id) REFERENCES images(id) ON DELETE SET NULL\n )\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_email ON users(email)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_username ON users(username)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_key ON users(key)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_phone ON users(phone)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_is_email_verified ON users(is_email_verified)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_is_phone_verified ON users(is_phone_verified)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_last_active_at ON users(last_active_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_last_login_at ON users(last_login_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_two_factor_enabled ON users(two_factor_enabled)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_language ON users(language)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_deleted_at ON users(deleted_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_is_public ON users(is_public) WHERE deleted_at IS NULL\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_created_at ON users(created_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_updated_at ON users(updated_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_users_active ON users(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false\n `;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS users CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182641298\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [\n Migration20251225181613479, // Images table (for avatar_id foreign key)\n ];\n }\n}\n",
|
|
6
6
|
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225182641298 } from \"./Migration20251225182641298\";\n\n@decorator.migration()\nexport class Migration20251225182641300 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TYPE account_type AS ENUM ('oauth', 'email', 'credentials', 'webauthn')\n `;\n\n await tx`\n CREATE TABLE IF NOT EXISTS accounts (\n id VARCHAR(25) PRIMARY KEY,\n provider VARCHAR(100),\n provider_account_id VARCHAR(255),\n type account_type NOT NULL,\n password VARCHAR(255),\n access_token TEXT,\n access_token_expires_at TIMESTAMPTZ,\n refresh_token TEXT,\n refresh_token_expires_at TIMESTAMPTZ,\n expires_at TIMESTAMPTZ,\n token_type VARCHAR(50),\n scope TEXT,\n id_token TEXT,\n session_state VARCHAR(255),\n email VARCHAR(255),\n email_verified BOOLEAN DEFAULT false,\n name VARCHAR(255),\n picture VARCHAR(500),\n profile JSONB,\n user_id VARCHAR(25),\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,\n deleted_at TIMESTAMPTZ,\n CONSTRAINT fk_accounts_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE\n )\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_user_id ON accounts(user_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_provider ON accounts(provider)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_provider_account_id ON accounts(provider_account_id)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_type ON accounts(type)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_email ON accounts(email)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_expires_at ON accounts(expires_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_language ON accounts(language)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_deleted_at ON accounts(deleted_at)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_is_public ON accounts(is_public) WHERE deleted_at IS NULL\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_created_at ON accounts(created_at DESC)\n `;\n\n await tx`\n CREATE INDEX IF NOT EXISTS idx_accounts_active ON accounts(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false\n `;\n\n await tx`\n CREATE UNIQUE INDEX IF NOT EXISTS idx_accounts_provider_unique ON accounts(provider, provider_account_id) WHERE deleted_at IS NULL\n `;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS accounts CASCADE`;\n await tx`DROP TYPE IF EXISTS account_type CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182641300\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [\n Migration20251225182641298, // Users table\n ];\n }\n}\n",
|
|
7
7
|
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225182641298 } from \"./Migration20251225182641298\";\n\n@decorator.migration()\nexport class Migration20251225182641303 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS users_sessions (\n id VARCHAR(25) PRIMARY KEY,\n user_id VARCHAR(25) NOT NULL,\n token VARCHAR(255) NOT NULL UNIQUE,\n refresh_token VARCHAR(255),\n expires_at TIMESTAMP NOT NULL,\n ip_address VARCHAR(45),\n user_agent TEXT,\n device VARCHAR(255),\n browser VARCHAR(255),\n os VARCHAR(255),\n is_revoked BOOLEAN DEFAULT false,\n revoked_at TIMESTAMP,\n last_activity_at TIMESTAMP,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMP,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMP,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10) DEFAULT 'en',\n created_at TIMESTAMP DEFAULT NOW(),\n updated_at TIMESTAMP DEFAULT NOW(),\n deleted_at TIMESTAMP,\n CONSTRAINT fk_users_sessions_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE\n )\n `;\n\n await tx`CREATE INDEX IF NOT EXISTS idx_users_sessions_user_id ON users_sessions(user_id)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_sessions_token ON users_sessions(token)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_sessions_refresh_token ON users_sessions(refresh_token)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_sessions_expires_at ON users_sessions(expires_at)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_sessions_is_revoked ON users_sessions(is_revoked)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_sessions_active ON users_sessions(user_id, is_revoked, expires_at)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_sessions_created_at ON users_sessions(created_at)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_sessions_deleted_at ON users_sessions(deleted_at)`;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS users_sessions CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182641303\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [Migration20251225182641298];\n }\n}\n",
|
|
8
8
|
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225182641298 } from \"./Migration20251225182641298\";\n\n@decorator.migration()\nexport class Migration20251225182641305 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`CREATE TYPE verification_type AS ENUM ('email', 'phone', 'two_factor')`;\n\n await tx`\n CREATE TABLE IF NOT EXISTS users_verifications (\n id VARCHAR(25) PRIMARY KEY,\n user_id VARCHAR(25) NOT NULL,\n type verification_type NOT NULL,\n token VARCHAR(255) NOT NULL,\n code VARCHAR(10),\n expires_at TIMESTAMP NOT NULL,\n verified_at TIMESTAMP,\n attempts INTEGER DEFAULT 0,\n max_attempts INTEGER DEFAULT 3,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMP,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMP,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10) DEFAULT 'en',\n created_at TIMESTAMP DEFAULT NOW(),\n updated_at TIMESTAMP DEFAULT NOW(),\n deleted_at TIMESTAMP,\n CONSTRAINT fk_users_verifications_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE\n )\n `;\n\n await tx`CREATE INDEX IF NOT EXISTS idx_users_verifications_user_id ON users_verifications(user_id)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_verifications_token ON users_verifications(token)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_verifications_code ON users_verifications(code)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_verifications_type ON users_verifications(type)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_verifications_expires_at ON users_verifications(expires_at)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_verifications_verified_at ON users_verifications(verified_at)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_verifications_created_at ON users_verifications(created_at)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_verifications_deleted_at ON users_verifications(deleted_at)`;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS users_verifications CASCADE`;\n await tx`DROP TYPE IF EXISTS verification_type CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182641305\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [Migration20251225182641298];\n }\n}\n",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225182641298 } from \"./Migration20251225182641298\";\n\n@decorator.migration()\nexport class Migration20251225182641316 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS users_reports (\n id VARCHAR(25) PRIMARY KEY,\n user_id VARCHAR(25),\n reason VARCHAR(255) NOT NULL,\n description TEXT,\n reported_by VARCHAR(255),\n reported_by_id VARCHAR(25),\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMP,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMP,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10) DEFAULT 'en',\n created_at TIMESTAMP DEFAULT NOW(),\n updated_at TIMESTAMP DEFAULT NOW(),\n deleted_at TIMESTAMP,\n CONSTRAINT fk_users_reports_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,\n CONSTRAINT fk_users_reports_reported_by FOREIGN KEY (reported_by_id) REFERENCES users(id) ON DELETE CASCADE\n )\n `;\n\n await tx`CREATE INDEX IF NOT EXISTS idx_users_reports_user_id ON users_reports(user_id)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_reports_reported_by_id ON users_reports(reported_by_id)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_reports_reason ON users_reports(reason)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_reports_created_at ON users_reports(created_at)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_reports_deleted_at ON users_reports(deleted_at)`;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS users_reports CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182641316\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [Migration20251225182641298];\n }\n}\n",
|
|
14
14
|
"import { decorator, type IMigration, type MigrationClassType } from \"@ooneex/migrations\";\nimport type { TransactionSQL } from \"bun\";\nimport { Migration20251225182641298 } from \"./Migration20251225182641298\";\n\n@decorator.migration()\nexport class Migration20251225182641319 implements IMigration {\n public async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS users_viewed (\n id VARCHAR(25) PRIMARY KEY,\n user_id VARCHAR(25),\n viewed_by VARCHAR(255),\n viewed_by_id VARCHAR(25),\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMP,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMP,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n language VARCHAR(10) DEFAULT 'en',\n created_at TIMESTAMP DEFAULT NOW(),\n updated_at TIMESTAMP DEFAULT NOW(),\n deleted_at TIMESTAMP,\n CONSTRAINT fk_users_viewed_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,\n CONSTRAINT fk_users_viewed_viewed_by FOREIGN KEY (viewed_by_id) REFERENCES users(id) ON DELETE CASCADE\n )\n `;\n\n await tx`CREATE INDEX IF NOT EXISTS idx_users_viewed_user_id ON users_viewed(user_id)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_viewed_viewed_by_id ON users_viewed(viewed_by_id)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_viewed_created_at ON users_viewed(created_at)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_viewed_deleted_at ON users_viewed(deleted_at)`;\n await tx`CREATE INDEX IF NOT EXISTS idx_users_viewed_user_viewed_by ON users_viewed(user_id, viewed_by_id, created_at)`;\n }\n\n public async down(tx: TransactionSQL): Promise<void> {\n await tx`DROP TABLE IF EXISTS users_viewed CASCADE`;\n }\n\n public getVersion(): string {\n return \"20251225182641319\";\n }\n\n public getDependencies(): MigrationClassType[] {\n return [Migration20251225182641298];\n }\n}\n"
|
|
15
15
|
],
|
|
16
|
-
"mappings": ";yKAAA,4BAAS,mCAKF,cAAM,CAAiD,MAC/C,GAAE,CAAC,EAAmC,CACjD,KAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
17
|
-
"debugId": "
|
|
16
|
+
"mappings": ";yKAAA,4BAAS,mCAKF,cAAM,CAAiD,MAC/C,GAAE,CAAC,EAAmC,CACjD,KAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAuCN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,MAIN,KAAM;AAAA;AAAA,W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