@bash-app/bash-common 30.118.1 → 30.119.0
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/definitions.d.ts +3 -0
- package/dist/definitions.d.ts.map +1 -1
- package/dist/definitions.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/membershipDefinitions.d.ts +9 -5
- package/dist/membershipDefinitions.d.ts.map +1 -1
- package/dist/membershipDefinitions.js +28 -24
- package/dist/membershipDefinitions.js.map +1 -1
- package/dist/utils/bashPointsPaymentUtils.d.ts +55 -0
- package/dist/utils/bashPointsPaymentUtils.d.ts.map +1 -0
- package/dist/utils/bashPointsPaymentUtils.js +79 -0
- package/dist/utils/bashPointsPaymentUtils.js.map +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/ticketListUtils.d.ts +2 -1
- package/dist/utils/ticketListUtils.d.ts.map +1 -1
- package/dist/utils/ticketListUtils.js +61 -11
- package/dist/utils/ticketListUtils.js.map +1 -1
- package/package.json +1 -1
- package/prisma/migrations/add_bashcash_pricing_to_ticket_tier.sql +15 -0
- package/prisma/migrations/add_bashpoints_purchase_tracking.sql +33 -0
- package/prisma/migrations/add_pricing_type_enum.sql +88 -0
- package/prisma/migrations/diagnostic_bashcash_columns.sql +157 -0
- package/prisma/migrations/fix_bashcash_referral_code_schema_mismatch.sql +81 -0
- package/prisma/migrations/rename_bashcash_to_bashpoints.sql +183 -0
- package/prisma/migrations/rename_bashcredits_to_bashpoints.sql +96 -0
- package/prisma/schema.prisma +64 -48
- package/src/definitions.ts +3 -0
- package/src/index.ts +1 -1
- package/src/membershipDefinitions.ts +29 -25
- package/src/utils/bashPointsPaymentUtils.ts +107 -0
- package/src/utils/index.ts +1 -1
- package/src/utils/ticketListUtils.ts +64 -10
- package/src/utils/bashCashPaymentUtils.ts +0 -146
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
-- Migration: Rename BashCash to BashPoints (SAFE VERSION)
|
|
2
|
+
-- Date: 2026-01-31
|
|
3
|
+
-- Description: Renames all database columns and enums containing "BashCash" to "BashPoints"
|
|
4
|
+
-- This version checks if columns/enums exist before attempting to rename them
|
|
5
|
+
|
|
6
|
+
-- =====================================================================
|
|
7
|
+
-- SAFE COLUMN RENAMES (Only renames if column exists)
|
|
8
|
+
-- =====================================================================
|
|
9
|
+
|
|
10
|
+
-- 1. TicketTier: Rename priceBashCash to priceBashPoints
|
|
11
|
+
DO $$
|
|
12
|
+
BEGIN
|
|
13
|
+
IF EXISTS (
|
|
14
|
+
SELECT 1 FROM information_schema.columns
|
|
15
|
+
WHERE table_name = 'TicketTier' AND column_name = 'priceBashCash'
|
|
16
|
+
) THEN
|
|
17
|
+
ALTER TABLE "TicketTier" RENAME COLUMN "priceBashCash" TO "priceBashPoints";
|
|
18
|
+
RAISE NOTICE '✅ Renamed TicketTier.priceBashCash → priceBashPoints';
|
|
19
|
+
ELSE
|
|
20
|
+
RAISE NOTICE 'ℹ️ Column TicketTier.priceBashCash already renamed or does not exist';
|
|
21
|
+
END IF;
|
|
22
|
+
END $$;
|
|
23
|
+
|
|
24
|
+
-- 2. User: Rename bashCashReferralCode to bashPointsReferralCode
|
|
25
|
+
DO $$
|
|
26
|
+
BEGIN
|
|
27
|
+
IF EXISTS (
|
|
28
|
+
SELECT 1 FROM information_schema.columns
|
|
29
|
+
WHERE table_name = 'User' AND column_name = 'bashCashReferralCode'
|
|
30
|
+
) THEN
|
|
31
|
+
ALTER TABLE "User" RENAME COLUMN "bashCashReferralCode" TO "bashPointsReferralCode";
|
|
32
|
+
RAISE NOTICE '✅ Renamed User.bashCashReferralCode → bashPointsReferralCode';
|
|
33
|
+
ELSE
|
|
34
|
+
RAISE NOTICE 'ℹ️ Column User.bashCashReferralCode already renamed or does not exist';
|
|
35
|
+
END IF;
|
|
36
|
+
END $$;
|
|
37
|
+
|
|
38
|
+
-- 3. Notification: Rename bashCashTransactionId to bashPointsTransactionId
|
|
39
|
+
DO $$
|
|
40
|
+
BEGIN
|
|
41
|
+
IF EXISTS (
|
|
42
|
+
SELECT 1 FROM information_schema.columns
|
|
43
|
+
WHERE table_name = 'Notification' AND column_name = 'bashCashTransactionId'
|
|
44
|
+
) THEN
|
|
45
|
+
ALTER TABLE "Notification" RENAME COLUMN "bashCashTransactionId" TO "bashPointsTransactionId";
|
|
46
|
+
RAISE NOTICE '✅ Renamed Notification.bashCashTransactionId → bashPointsTransactionId';
|
|
47
|
+
ELSE
|
|
48
|
+
RAISE NOTICE 'ℹ️ Column Notification.bashCashTransactionId already renamed or does not exist';
|
|
49
|
+
END IF;
|
|
50
|
+
END $$;
|
|
51
|
+
|
|
52
|
+
-- 4. PrizePayment: Rename bashCashTransactionId to bashPointsTransactionId
|
|
53
|
+
DO $$
|
|
54
|
+
BEGIN
|
|
55
|
+
IF EXISTS (
|
|
56
|
+
SELECT 1 FROM information_schema.columns
|
|
57
|
+
WHERE table_name = 'PrizePayment' AND column_name = 'bashCashTransactionId'
|
|
58
|
+
) THEN
|
|
59
|
+
ALTER TABLE "PrizePayment" RENAME COLUMN "bashCashTransactionId" TO "bashPointsTransactionId";
|
|
60
|
+
RAISE NOTICE '✅ Renamed PrizePayment.bashCashTransactionId → bashPointsTransactionId';
|
|
61
|
+
ELSE
|
|
62
|
+
RAISE NOTICE 'ℹ️ Column PrizePayment.bashCashTransactionId already renamed or does not exist';
|
|
63
|
+
END IF;
|
|
64
|
+
END $$;
|
|
65
|
+
|
|
66
|
+
-- 5. Service: Rename acceptsBashCash to acceptsBashPoints
|
|
67
|
+
DO $$
|
|
68
|
+
BEGIN
|
|
69
|
+
IF EXISTS (
|
|
70
|
+
SELECT 1 FROM information_schema.columns
|
|
71
|
+
WHERE table_name = 'Service' AND column_name = 'acceptsBashCash'
|
|
72
|
+
) THEN
|
|
73
|
+
ALTER TABLE "Service" RENAME COLUMN "acceptsBashCash" TO "acceptsBashPoints";
|
|
74
|
+
RAISE NOTICE '✅ Renamed Service.acceptsBashCash → acceptsBashPoints';
|
|
75
|
+
ELSE
|
|
76
|
+
RAISE NOTICE 'ℹ️ Column Service.acceptsBashCash already renamed or does not exist';
|
|
77
|
+
END IF;
|
|
78
|
+
END $$;
|
|
79
|
+
|
|
80
|
+
-- 6. ServiceBooking: Rename bashCashApplied to bashPointsApplied
|
|
81
|
+
DO $$
|
|
82
|
+
BEGIN
|
|
83
|
+
IF EXISTS (
|
|
84
|
+
SELECT 1 FROM information_schema.columns
|
|
85
|
+
WHERE table_name = 'ServiceBooking' AND column_name = 'bashCashApplied'
|
|
86
|
+
) THEN
|
|
87
|
+
ALTER TABLE "ServiceBooking" RENAME COLUMN "bashCashApplied" TO "bashPointsApplied";
|
|
88
|
+
RAISE NOTICE '✅ Renamed ServiceBooking.bashCashApplied → bashPointsApplied';
|
|
89
|
+
ELSE
|
|
90
|
+
RAISE NOTICE 'ℹ️ Column ServiceBooking.bashCashApplied already renamed or does not exist';
|
|
91
|
+
END IF;
|
|
92
|
+
END $$;
|
|
93
|
+
|
|
94
|
+
-- 7. ServiceBooking: Rename bashCashTransactionId to bashPointsTransactionId
|
|
95
|
+
DO $$
|
|
96
|
+
BEGIN
|
|
97
|
+
IF EXISTS (
|
|
98
|
+
SELECT 1 FROM information_schema.columns
|
|
99
|
+
WHERE table_name = 'ServiceBooking' AND column_name = 'bashCashTransactionId'
|
|
100
|
+
) THEN
|
|
101
|
+
ALTER TABLE "ServiceBooking" RENAME COLUMN "bashCashTransactionId" TO "bashPointsTransactionId";
|
|
102
|
+
RAISE NOTICE '✅ Renamed ServiceBooking.bashCashTransactionId → bashPointsTransactionId';
|
|
103
|
+
ELSE
|
|
104
|
+
RAISE NOTICE 'ℹ️ Column ServiceBooking.bashCashTransactionId already renamed or does not exist';
|
|
105
|
+
END IF;
|
|
106
|
+
END $$;
|
|
107
|
+
|
|
108
|
+
-- =====================================================================
|
|
109
|
+
-- SAFE ENUM VALUE UPDATES (Only updates if value exists)
|
|
110
|
+
-- =====================================================================
|
|
111
|
+
|
|
112
|
+
-- 8. Update AuditCategory enum: BashCash → BashPoints
|
|
113
|
+
DO $$
|
|
114
|
+
BEGIN
|
|
115
|
+
IF EXISTS (
|
|
116
|
+
SELECT 1 FROM pg_enum e
|
|
117
|
+
JOIN pg_type t ON e.enumtypid = t.oid
|
|
118
|
+
WHERE t.typname = 'AuditCategory' AND e.enumlabel = 'BashCash'
|
|
119
|
+
) THEN
|
|
120
|
+
ALTER TYPE "AuditCategory" RENAME VALUE 'BashCash' TO 'BashPoints';
|
|
121
|
+
RAISE NOTICE '✅ Renamed enum AuditCategory: BashCash → BashPoints';
|
|
122
|
+
ELSE
|
|
123
|
+
RAISE NOTICE 'ℹ️ Enum value AuditCategory.BashCash already renamed or does not exist';
|
|
124
|
+
END IF;
|
|
125
|
+
END $$;
|
|
126
|
+
|
|
127
|
+
-- 9. Update PrizePaymentMethod enum: BashCash → BashPoints
|
|
128
|
+
DO $$
|
|
129
|
+
BEGIN
|
|
130
|
+
IF EXISTS (
|
|
131
|
+
SELECT 1 FROM pg_enum e
|
|
132
|
+
JOIN pg_type t ON e.enumtypid = t.oid
|
|
133
|
+
WHERE t.typname = 'PrizePaymentMethod' AND e.enumlabel = 'BashCash'
|
|
134
|
+
) THEN
|
|
135
|
+
ALTER TYPE "PrizePaymentMethod" RENAME VALUE 'BashCash' TO 'BashPoints';
|
|
136
|
+
RAISE NOTICE '✅ Renamed enum PrizePaymentMethod: BashCash → BashPoints';
|
|
137
|
+
ELSE
|
|
138
|
+
RAISE NOTICE 'ℹ️ Enum value PrizePaymentMethod.BashCash already renamed or does not exist';
|
|
139
|
+
END IF;
|
|
140
|
+
END $$;
|
|
141
|
+
|
|
142
|
+
-- 10. Update AuditAction enum: BashCash → BashPoints
|
|
143
|
+
DO $$
|
|
144
|
+
BEGIN
|
|
145
|
+
IF EXISTS (
|
|
146
|
+
SELECT 1 FROM pg_enum e
|
|
147
|
+
JOIN pg_type t ON e.enumtypid = t.oid
|
|
148
|
+
WHERE t.typname = 'AuditAction' AND e.enumlabel = 'BashCash'
|
|
149
|
+
) THEN
|
|
150
|
+
ALTER TYPE "AuditAction" RENAME VALUE 'BashCash' TO 'BashPoints';
|
|
151
|
+
RAISE NOTICE '✅ Renamed enum AuditAction: BashCash → BashPoints';
|
|
152
|
+
ELSE
|
|
153
|
+
RAISE NOTICE 'ℹ️ Enum value AuditAction.BashCash already renamed or does not exist';
|
|
154
|
+
END IF;
|
|
155
|
+
END $$;
|
|
156
|
+
|
|
157
|
+
-- =====================================================================
|
|
158
|
+
-- VERIFICATION QUERIES (Runs automatically)
|
|
159
|
+
-- =====================================================================
|
|
160
|
+
|
|
161
|
+
-- Show renamed columns
|
|
162
|
+
SELECT
|
|
163
|
+
'✅ Columns with bashpoints naming:' AS info;
|
|
164
|
+
|
|
165
|
+
SELECT
|
|
166
|
+
table_name,
|
|
167
|
+
column_name,
|
|
168
|
+
data_type
|
|
169
|
+
FROM information_schema.columns
|
|
170
|
+
WHERE column_name ILIKE '%bashpoints%'
|
|
171
|
+
ORDER BY table_name, column_name;
|
|
172
|
+
|
|
173
|
+
-- Show enum values
|
|
174
|
+
SELECT
|
|
175
|
+
'✅ Enum values with BashPoints:' AS info;
|
|
176
|
+
|
|
177
|
+
SELECT
|
|
178
|
+
t.typname AS enum_type,
|
|
179
|
+
e.enumlabel AS enum_value
|
|
180
|
+
FROM pg_enum e
|
|
181
|
+
JOIN pg_type t ON e.enumtypid = t.oid
|
|
182
|
+
WHERE e.enumlabel ILIKE '%bashpoints%'
|
|
183
|
+
ORDER BY t.typname, e.enumlabel;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
-- Migration: Rename bashCredits* to bashPoints* (Complete BashPoints Migration)
|
|
2
|
+
-- Date: 2026-02-02
|
|
3
|
+
-- Description: Renames all remaining "bashCredits" columns to "bashPoints" to complete
|
|
4
|
+
-- the BashCash → BashPoints migration and maintain naming consistency
|
|
5
|
+
|
|
6
|
+
-- =====================================================================
|
|
7
|
+
-- DIAGNOSTIC: Check current state
|
|
8
|
+
-- =====================================================================
|
|
9
|
+
|
|
10
|
+
-- Check for bashCredits columns
|
|
11
|
+
SELECT
|
|
12
|
+
'📊 Current bashCredits columns:' AS info;
|
|
13
|
+
|
|
14
|
+
SELECT
|
|
15
|
+
table_name,
|
|
16
|
+
column_name,
|
|
17
|
+
data_type
|
|
18
|
+
FROM information_schema.columns
|
|
19
|
+
WHERE column_name ILIKE '%bashcredits%'
|
|
20
|
+
ORDER BY table_name, column_name;
|
|
21
|
+
|
|
22
|
+
-- =====================================================================
|
|
23
|
+
-- SAFE COLUMN RENAMES (Only renames if column exists)
|
|
24
|
+
-- =====================================================================
|
|
25
|
+
|
|
26
|
+
-- 1. User: Rename bashCreditsBalance to bashPointsBalance
|
|
27
|
+
DO $$
|
|
28
|
+
BEGIN
|
|
29
|
+
IF EXISTS (
|
|
30
|
+
SELECT 1 FROM information_schema.columns
|
|
31
|
+
WHERE table_name = 'User' AND column_name = 'bashCreditsBalance'
|
|
32
|
+
) THEN
|
|
33
|
+
ALTER TABLE "User" RENAME COLUMN "bashCreditsBalance" TO "bashPointsBalance";
|
|
34
|
+
RAISE NOTICE '✅ Renamed User.bashCreditsBalance → bashPointsBalance';
|
|
35
|
+
ELSE
|
|
36
|
+
RAISE NOTICE 'ℹ️ Column User.bashCreditsBalance already renamed or does not exist';
|
|
37
|
+
END IF;
|
|
38
|
+
END $$;
|
|
39
|
+
|
|
40
|
+
-- 2. User: Rename bashCreditsEarnedLifetime to bashPointsEarnedLifetime
|
|
41
|
+
DO $$
|
|
42
|
+
BEGIN
|
|
43
|
+
IF EXISTS (
|
|
44
|
+
SELECT 1 FROM information_schema.columns
|
|
45
|
+
WHERE table_name = 'User' AND column_name = 'bashCreditsEarnedLifetime'
|
|
46
|
+
) THEN
|
|
47
|
+
ALTER TABLE "User" RENAME COLUMN "bashCreditsEarnedLifetime" TO "bashPointsEarnedLifetime";
|
|
48
|
+
RAISE NOTICE '✅ Renamed User.bashCreditsEarnedLifetime → bashPointsEarnedLifetime';
|
|
49
|
+
ELSE
|
|
50
|
+
RAISE NOTICE 'ℹ️ Column User.bashCreditsEarnedLifetime already renamed or does not exist';
|
|
51
|
+
END IF;
|
|
52
|
+
END $$;
|
|
53
|
+
|
|
54
|
+
-- 3. User: Rename bashCreditsSpentLifetime to bashPointsSpentLifetime
|
|
55
|
+
DO $$
|
|
56
|
+
BEGIN
|
|
57
|
+
IF EXISTS (
|
|
58
|
+
SELECT 1 FROM information_schema.columns
|
|
59
|
+
WHERE table_name = 'User' AND column_name = 'bashCreditsSpentLifetime'
|
|
60
|
+
) THEN
|
|
61
|
+
ALTER TABLE "User" RENAME COLUMN "bashCreditsSpentLifetime" TO "bashPointsSpentLifetime";
|
|
62
|
+
RAISE NOTICE '✅ Renamed User.bashCreditsSpentLifetime → bashPointsSpentLifetime';
|
|
63
|
+
ELSE
|
|
64
|
+
RAISE NOTICE 'ℹ️ Column User.bashCreditsSpentLifetime already renamed or does not exist';
|
|
65
|
+
END IF;
|
|
66
|
+
END $$;
|
|
67
|
+
|
|
68
|
+
-- =====================================================================
|
|
69
|
+
-- VERIFICATION: Show final state
|
|
70
|
+
-- =====================================================================
|
|
71
|
+
|
|
72
|
+
-- Show all bashPoints columns
|
|
73
|
+
SELECT
|
|
74
|
+
'✅ Final bashPoints columns:' AS info;
|
|
75
|
+
|
|
76
|
+
SELECT
|
|
77
|
+
table_name,
|
|
78
|
+
column_name,
|
|
79
|
+
data_type,
|
|
80
|
+
is_nullable,
|
|
81
|
+
column_default
|
|
82
|
+
FROM information_schema.columns
|
|
83
|
+
WHERE column_name ILIKE '%bashpoints%'
|
|
84
|
+
ORDER BY table_name, column_name;
|
|
85
|
+
|
|
86
|
+
-- Verify no bashCredits columns remain
|
|
87
|
+
SELECT
|
|
88
|
+
'🔍 Checking for remaining bashCredits columns (should be empty):' AS info;
|
|
89
|
+
|
|
90
|
+
SELECT
|
|
91
|
+
table_name,
|
|
92
|
+
column_name,
|
|
93
|
+
data_type
|
|
94
|
+
FROM information_schema.columns
|
|
95
|
+
WHERE column_name ILIKE '%bashcredits%'
|
|
96
|
+
ORDER BY table_name, column_name;
|
package/prisma/schema.prisma
CHANGED
|
@@ -945,6 +945,10 @@ model TicketTier {
|
|
|
945
945
|
specialOffers SpecialOffer[] // NEW - Special offers for this tier
|
|
946
946
|
appliedDiscounts AppliedDiscount[] // NEW - Discounts applied to this tier
|
|
947
947
|
|
|
948
|
+
// BashPoints Pricing (peer-to-peer economy)
|
|
949
|
+
pricingType PricingType @default(USD) // 'USD' or 'BASHPOINTS'
|
|
950
|
+
priceBashPoints Int? // Price in BashPoints (if pricingType='BASHPOINTS')
|
|
951
|
+
|
|
948
952
|
// Organization member restrictions (for org events)
|
|
949
953
|
restrictedToRoles String[] @default([]) // ["Admin", "Owner"] - empty = all roles
|
|
950
954
|
restrictedToDepartments String[] @default([]) // [deptId1, deptId2] - empty = all departments
|
|
@@ -985,6 +989,12 @@ model Ticket {
|
|
|
985
989
|
lastValidationAttempt DateTime?
|
|
986
990
|
lastValidatedBy String?
|
|
987
991
|
waitlistUserId String?
|
|
992
|
+
|
|
993
|
+
// BashPoints Purchase Tracking
|
|
994
|
+
purchaseType String? // "USD", "BashPoints", "Free", "Comp"
|
|
995
|
+
pointsPaid Int? // BashPoints amount paid (if purchaseType="BashPoints")
|
|
996
|
+
stripePurchaseId String? // Stripe payment ID (if purchaseType="USD")
|
|
997
|
+
|
|
988
998
|
bashEvent BashEvent @relation(fields: [bashEventId], references: [id])
|
|
989
999
|
checkout Checkout? @relation(fields: [checkoutId], references: [id])
|
|
990
1000
|
forUser User? @relation("TicketsISent", fields: [forUserId], references: [id])
|
|
@@ -1201,29 +1211,29 @@ model Prize {
|
|
|
1201
1211
|
claimedAt DateTime? // When the prize was claimed
|
|
1202
1212
|
|
|
1203
1213
|
// Automatic payment fields
|
|
1204
|
-
autoPayEnabled
|
|
1205
|
-
paymentMethod
|
|
1206
|
-
paymentStatus
|
|
1207
|
-
|
|
1208
|
-
venmoTransactionId
|
|
1209
|
-
zelleTransactionId
|
|
1210
|
-
paidAmount
|
|
1211
|
-
paidAt
|
|
1212
|
-
paymentError
|
|
1213
|
-
paymentNotes
|
|
1214
|
+
autoPayEnabled Boolean @default(false)
|
|
1215
|
+
paymentMethod PrizePaymentMethod?
|
|
1216
|
+
paymentStatus PrizePaymentStatus @default(Pending)
|
|
1217
|
+
bashPointsTransactionId String?
|
|
1218
|
+
venmoTransactionId String?
|
|
1219
|
+
zelleTransactionId String?
|
|
1220
|
+
paidAmount Float?
|
|
1221
|
+
paidAt DateTime?
|
|
1222
|
+
paymentError String? @db.Text
|
|
1223
|
+
paymentNotes String? @db.Text
|
|
1214
1224
|
|
|
1215
1225
|
// Winner payment info (for P2P)
|
|
1216
1226
|
winnerVenmoUsername String?
|
|
1217
1227
|
winnerZelleEmail String?
|
|
1218
1228
|
winnerZellePhone String?
|
|
1219
1229
|
|
|
1220
|
-
competition
|
|
1221
|
-
winner
|
|
1222
|
-
|
|
1230
|
+
competition Competition? @relation(fields: [competitionId], references: [id], onDelete: Cascade)
|
|
1231
|
+
winner User? @relation(fields: [winnerUserId], references: [id], onDelete: Cascade)
|
|
1232
|
+
bashPointsTransaction BashCreditTransaction? @relation(fields: [bashPointsTransactionId], references: [id], onDelete: SetNull)
|
|
1223
1233
|
|
|
1224
1234
|
@@index([competitionId])
|
|
1225
1235
|
@@index([winnerUserId]) // For fetching user's wins
|
|
1226
|
-
@@index([
|
|
1236
|
+
@@index([bashPointsTransactionId])
|
|
1227
1237
|
}
|
|
1228
1238
|
|
|
1229
1239
|
model Review {
|
|
@@ -1388,11 +1398,11 @@ model User {
|
|
|
1388
1398
|
totalServiceReferrals Int @default(0)
|
|
1389
1399
|
fcmTokens String[] @default([]) // Firebase Cloud Messaging tokens for push notifications
|
|
1390
1400
|
|
|
1391
|
-
//
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1401
|
+
// BashPoints System Fields
|
|
1402
|
+
bashPointsBalance Int @default(0)
|
|
1403
|
+
bashPointsEarnedLifetime Int @default(0)
|
|
1404
|
+
bashPointsSpentLifetime Int @default(0)
|
|
1405
|
+
bashPointsReferralCode String? @unique
|
|
1396
1406
|
referredById String?
|
|
1397
1407
|
referralPurchaseCredited Boolean @default(false)
|
|
1398
1408
|
|
|
@@ -1513,7 +1523,7 @@ model User {
|
|
|
1513
1523
|
// Special Offers - Discount Attribution
|
|
1514
1524
|
discountAttributions AppliedDiscount[] @relation("DiscountAttribution")
|
|
1515
1525
|
|
|
1516
|
-
//
|
|
1526
|
+
// BashPoints Referral Relations
|
|
1517
1527
|
referredBy User? @relation("Referrals", fields: [referredById], references: [id])
|
|
1518
1528
|
referrals User[] @relation("Referrals")
|
|
1519
1529
|
|
|
@@ -1994,7 +2004,7 @@ model Service {
|
|
|
1994
2004
|
isFreeFirstListing Boolean @default(false)
|
|
1995
2005
|
monthlyPrice Decimal @default(0)
|
|
1996
2006
|
serviceListingStripeSubscriptionId String?
|
|
1997
|
-
|
|
2007
|
+
acceptsBashPoints Boolean @default(true) // NEW: Allow BashPoints payments
|
|
1998
2008
|
isVerified Boolean @default(false) // Service owner verified
|
|
1999
2009
|
isLicensed Boolean @default(false) // Has required licenses
|
|
2000
2010
|
verifiedAt DateTime? // When verification was approved
|
|
@@ -2618,9 +2628,9 @@ model ServiceInclude {
|
|
|
2618
2628
|
createdAt DateTime @default(now())
|
|
2619
2629
|
updatedAt DateTime @updatedAt
|
|
2620
2630
|
|
|
2621
|
-
service Service
|
|
2622
|
-
suggestedBy User?
|
|
2623
|
-
convertedToAddon ServiceAddon?
|
|
2631
|
+
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
2632
|
+
suggestedBy User? @relation("SuggestedIncludes", fields: [suggestedByUserId], references: [id], onDelete: SetNull)
|
|
2633
|
+
convertedToAddon ServiceAddon? @relation("IncludeConvertedToAddon", fields: [convertedToAddonId], references: [id], onDelete: SetNull)
|
|
2624
2634
|
votes ServiceIncludeVote[]
|
|
2625
2635
|
|
|
2626
2636
|
@@unique([serviceId, name]) // Prevent duplicate suggestions for same service
|
|
@@ -2631,12 +2641,12 @@ model ServiceInclude {
|
|
|
2631
2641
|
}
|
|
2632
2642
|
|
|
2633
2643
|
model ServiceIncludeVote {
|
|
2634
|
-
id String
|
|
2644
|
+
id String @id @default(cuid())
|
|
2635
2645
|
serviceIncludeId String
|
|
2636
2646
|
userId String
|
|
2637
2647
|
voteType VoteType // Upvote or Downvote
|
|
2638
|
-
createdAt DateTime
|
|
2639
|
-
updatedAt DateTime
|
|
2648
|
+
createdAt DateTime @default(now())
|
|
2649
|
+
updatedAt DateTime @updatedAt
|
|
2640
2650
|
|
|
2641
2651
|
serviceInclude ServiceInclude @relation(fields: [serviceIncludeId], references: [id], onDelete: Cascade)
|
|
2642
2652
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
@@ -2647,18 +2657,18 @@ model ServiceIncludeVote {
|
|
|
2647
2657
|
}
|
|
2648
2658
|
|
|
2649
2659
|
model ServiceAddonRequest {
|
|
2650
|
-
id String
|
|
2660
|
+
id String @id @default(cuid())
|
|
2651
2661
|
serviceId String
|
|
2652
2662
|
userId String? // null if anonymous
|
|
2653
2663
|
name String // e.g., "Specialty Lighting Package"
|
|
2654
2664
|
description String? // Optional details
|
|
2655
|
-
status ServiceAddonRequestStatus
|
|
2665
|
+
status ServiceAddonRequestStatus @default(Pending)
|
|
2656
2666
|
providerNote String? // Provider's response/notes
|
|
2657
|
-
notifyOnAvailable Boolean
|
|
2667
|
+
notifyOnAvailable Boolean @default(false) // Customer wants notification
|
|
2658
2668
|
convertedToAddonId String? // Links to actual ServiceAddon if created
|
|
2659
|
-
requestCount Int
|
|
2660
|
-
createdAt DateTime
|
|
2661
|
-
updatedAt DateTime
|
|
2669
|
+
requestCount Int @default(1) // How many customers requested this
|
|
2670
|
+
createdAt DateTime @default(now())
|
|
2671
|
+
updatedAt DateTime @updatedAt
|
|
2662
2672
|
|
|
2663
2673
|
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
2664
2674
|
user User? @relation("RequestedAddons", fields: [userId], references: [id], onDelete: SetNull)
|
|
@@ -5117,17 +5127,17 @@ enum ServiceAddonStatus {
|
|
|
5117
5127
|
}
|
|
5118
5128
|
|
|
5119
5129
|
enum ServiceIncludeStatus {
|
|
5120
|
-
Pending
|
|
5121
|
-
Approved
|
|
5122
|
-
Declined
|
|
5130
|
+
Pending // Customer suggested, awaiting provider review
|
|
5131
|
+
Approved // Provider confirmed it IS included
|
|
5132
|
+
Declined // Provider says not possible/won't include
|
|
5123
5133
|
Duplicate // Same as another suggestion
|
|
5124
5134
|
}
|
|
5125
5135
|
|
|
5126
5136
|
enum ServiceIncludeResponse {
|
|
5127
|
-
NotPossible
|
|
5128
|
-
Added
|
|
5129
|
-
AlreadyIncluded
|
|
5130
|
-
AvailableAsAddOn
|
|
5137
|
+
NotPossible // Can't offer this
|
|
5138
|
+
Added // Now included in base package
|
|
5139
|
+
AlreadyIncluded // Was already included
|
|
5140
|
+
AvailableAsAddOn // Can offer but as paid add-on
|
|
5131
5141
|
UnderConsideration // Thinking about it
|
|
5132
5142
|
}
|
|
5133
5143
|
|
|
@@ -5137,11 +5147,11 @@ enum VoteType {
|
|
|
5137
5147
|
}
|
|
5138
5148
|
|
|
5139
5149
|
enum ServiceAddonRequestStatus {
|
|
5140
|
-
Pending
|
|
5150
|
+
Pending // New request
|
|
5141
5151
|
Acknowledged // Provider saw it
|
|
5142
|
-
Added
|
|
5143
|
-
Declined
|
|
5144
|
-
Duplicate
|
|
5152
|
+
Added // Provider created the add-on
|
|
5153
|
+
Declined // Provider won't offer this
|
|
5154
|
+
Duplicate // Same as another request
|
|
5145
5155
|
}
|
|
5146
5156
|
|
|
5147
5157
|
enum ServiceBookingFeeType {
|
|
@@ -5272,6 +5282,11 @@ enum PricingModel {
|
|
|
5272
5282
|
CUSTOM // Custom pricing structure with base rate + notes for negotiation
|
|
5273
5283
|
}
|
|
5274
5284
|
|
|
5285
|
+
enum PricingType {
|
|
5286
|
+
USD // Ticket priced in USD (paid with credit card, earns BashPoints cashback)
|
|
5287
|
+
BASHPOINTS // Ticket priced in BashPoints (peer-to-peer loyalty points transfer)
|
|
5288
|
+
}
|
|
5289
|
+
|
|
5275
5290
|
enum EntityType {
|
|
5276
5291
|
EVENT_SERVICE
|
|
5277
5292
|
ENTERTAINMENT_SERVICE
|
|
@@ -5341,9 +5356,10 @@ enum CreditTransactionStatus {
|
|
|
5341
5356
|
}
|
|
5342
5357
|
|
|
5343
5358
|
enum CreditSourceType {
|
|
5344
|
-
MembershipReward // Monthly membership
|
|
5345
|
-
TicketPurchase //
|
|
5346
|
-
|
|
5359
|
+
MembershipReward // Monthly membership points
|
|
5360
|
+
TicketPurchase // Cashback on ticket
|
|
5361
|
+
TicketSale // Host receives BashPoints from ticket sales (peer-to-peer)
|
|
5362
|
+
ServiceBooking // Cashback on service
|
|
5347
5363
|
ReferralBonus // 10% of referee's first purchase
|
|
5348
5364
|
AdminAdjustment // Manual credit by admin
|
|
5349
5365
|
PromotionalBonus // Marketing campaigns
|
|
@@ -5808,7 +5824,7 @@ enum EventFormat {
|
|
|
5808
5824
|
enum DiscountSourceType {
|
|
5809
5825
|
PROMO_CODE
|
|
5810
5826
|
SPECIAL_OFFER
|
|
5811
|
-
PLATFORM_CREDIT // For future
|
|
5827
|
+
PLATFORM_CREDIT // For future BashPoints integration
|
|
5812
5828
|
MANUAL_OVERRIDE // Admin adjustments
|
|
5813
5829
|
}
|
|
5814
5830
|
|
package/src/definitions.ts
CHANGED
|
@@ -354,6 +354,7 @@ export type FilterFields = {
|
|
|
354
354
|
specialOffers: string[];
|
|
355
355
|
eventFormat: string[];
|
|
356
356
|
hasOpenTasks: boolean; // Boolean filter for events with open volunteer tasks
|
|
357
|
+
acceptsBashPoints: boolean; // Boolean filter for events with BashPoints-priced tickets
|
|
357
358
|
};
|
|
358
359
|
|
|
359
360
|
export type ApiEntityApproval = {
|
|
@@ -362,6 +363,8 @@ export type ApiEntityApproval = {
|
|
|
362
363
|
|
|
363
364
|
export type TicketTierWherePriceIsAString = Omit<TicketTier, "price"> & {
|
|
364
365
|
price: string;
|
|
366
|
+
pricingType?: string; // 'USD' or 'BASHCASH'
|
|
367
|
+
priceBashPoints?: string; // Price in BashPoints credits (string for form input)
|
|
365
368
|
} & { cannotDelete: boolean };
|
|
366
369
|
|
|
367
370
|
export type ApiServiceAddonParams = {
|
package/src/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export * from "./utils/addressUtils";
|
|
|
9
9
|
export * from "./utils/apiUtils";
|
|
10
10
|
export * from "./utils/arrayUtils";
|
|
11
11
|
export * from "./utils/awsS3Utils";
|
|
12
|
-
export * from "./utils/
|
|
12
|
+
export * from "./utils/bashPointsPaymentUtils";
|
|
13
13
|
export * from "./utils/contentFilterUtils";
|
|
14
14
|
export * from "./utils/dateTimeUtils";
|
|
15
15
|
export * from "./utils/discountEngine/bestPriceResolver";
|
|
@@ -90,7 +90,7 @@ export const MEMBERSHIP_PRICING = {
|
|
|
90
90
|
Legend: { monthly: 99900, yearly: 1000000 }, // $999/month, $10,000/year
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
// Helper: Get monthly price in cents for a tier (for
|
|
93
|
+
// Helper: Get monthly price in cents for a tier (for BashPoints calculations)
|
|
94
94
|
export const MEMBERSHIP_MONTHLY_PRICE_CENTS: Record<MembershipTier, number> = {
|
|
95
95
|
Basic: MEMBERSHIP_PRICING.Basic.monthly,
|
|
96
96
|
Creator: MEMBERSHIP_PRICING.Creator.monthly,
|
|
@@ -104,59 +104,63 @@ export const MEMBERSHIP_TIER_HIERARCHY: MembershipTier[] = [
|
|
|
104
104
|
];
|
|
105
105
|
|
|
106
106
|
// ============================================================================
|
|
107
|
-
//
|
|
107
|
+
// BASHPOINTS REWARDS SYSTEM
|
|
108
108
|
// ============================================================================
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
111
|
+
* BashPoints rewards per membership tier
|
|
112
|
+
* Points are loyalty rewards with floating market value (like airline miles)
|
|
113
113
|
*/
|
|
114
|
-
export const
|
|
115
|
-
monthlyCredits: number; //
|
|
114
|
+
export const BASHPOINTS_REWARDS: Record<MembershipTier, {
|
|
115
|
+
monthlyCredits: number; // Points earned per month
|
|
116
116
|
ticketCashbackRate: number; // Cashback % on ticket purchases
|
|
117
117
|
serviceCashbackRate: number; // Cashback % on service bookings
|
|
118
118
|
}> = {
|
|
119
119
|
Basic: {
|
|
120
120
|
monthlyCredits: 0,
|
|
121
|
-
ticketCashbackRate: 0,
|
|
122
|
-
serviceCashbackRate: 0,
|
|
121
|
+
ticketCashbackRate: 0.01, // 1% cashback
|
|
122
|
+
serviceCashbackRate: 0.01, // 1% cashback
|
|
123
123
|
},
|
|
124
124
|
Creator: {
|
|
125
|
-
monthlyCredits: 10000, // 10,000
|
|
126
|
-
ticketCashbackRate: 0.
|
|
127
|
-
serviceCashbackRate: 0.
|
|
125
|
+
monthlyCredits: 10000, // 10,000 BashPoints/month
|
|
126
|
+
ticketCashbackRate: 0.03, // 3% cashback
|
|
127
|
+
serviceCashbackRate: 0.02, // 2% cashback
|
|
128
128
|
},
|
|
129
129
|
Pro: {
|
|
130
|
-
monthlyCredits: 40000, // 40,000
|
|
130
|
+
monthlyCredits: 40000, // 40,000 BashPoints/month
|
|
131
131
|
ticketCashbackRate: 0.05, // 5% cashback
|
|
132
132
|
serviceCashbackRate: 0.03, // 3% cashback
|
|
133
133
|
},
|
|
134
134
|
Elite: {
|
|
135
|
-
monthlyCredits: 120000, // 120,000
|
|
136
|
-
ticketCashbackRate: 0.
|
|
137
|
-
serviceCashbackRate: 0.
|
|
135
|
+
monthlyCredits: 120000, // 120,000 BashPoints/month
|
|
136
|
+
ticketCashbackRate: 0.07, // 7% cashback
|
|
137
|
+
serviceCashbackRate: 0.04, // 4% cashback
|
|
138
138
|
},
|
|
139
139
|
Legend: {
|
|
140
|
-
monthlyCredits: 250000, // 250,000
|
|
141
|
-
ticketCashbackRate: 0.
|
|
142
|
-
serviceCashbackRate: 0.
|
|
140
|
+
monthlyCredits: 250000, // 250,000 BashPoints/month
|
|
141
|
+
ticketCashbackRate: 0.10, // 10% cashback
|
|
142
|
+
serviceCashbackRate: 0.05, // 5% cashback
|
|
143
143
|
},
|
|
144
144
|
} as const;
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
*
|
|
147
|
+
* BashPoints system rules and limits
|
|
148
|
+
*
|
|
149
|
+
* IMPORTANT: BashPoints is a LOYALTY POINTS SYSTEM with floating market value.
|
|
150
|
+
* Credits do NOT have a fixed dollar conversion rate.
|
|
151
|
+
* Hosts/providers set their own BashPoints prices for tickets and services.
|
|
148
152
|
*/
|
|
149
|
-
export const
|
|
153
|
+
export const BASHPOINTS_CONFIG = {
|
|
150
154
|
// Referral bonuses
|
|
151
|
-
referralBonusRate: 0.10, // 10% of referee's first purchase
|
|
152
|
-
maxReferralCredits: 10000, //
|
|
155
|
+
referralBonusRate: 0.10, // 10% of referee's first USD purchase (in credits)
|
|
156
|
+
maxReferralCredits: 10000, // 10,000 credit cap on referral bonuses
|
|
153
157
|
|
|
154
158
|
// Credit lifecycle
|
|
155
159
|
creditExpirationMonths: 12, // Credits expire after 12 months
|
|
156
160
|
|
|
157
|
-
// Redemption rules
|
|
158
|
-
minimumRedemption: 100, //
|
|
159
|
-
membershipRedemptionCap: 0.50, //
|
|
161
|
+
// Redemption rules (deprecated for floating value system)
|
|
162
|
+
minimumRedemption: 100, // Legacy: was used for fixed-value redemptions
|
|
163
|
+
membershipRedemptionCap: 0.50, // NOT USED: Can't pay memberships with BashPoints (no fixed value)
|
|
160
164
|
} as const;
|
|
161
165
|
|
|
162
166
|
// ============================================================================
|