@bash-app/bash-common 30.4.0 → 30.6.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/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -99,7 +99,7 @@ model EventTask {
|
|
|
99
99
|
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
100
100
|
bashEventId String
|
|
101
101
|
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
102
|
-
title String
|
|
102
|
+
title String
|
|
103
103
|
description String?
|
|
104
104
|
assignedToId String?
|
|
105
105
|
assignedTo User? @relation("TasksAssignedToMe", fields: [assignedToId], references: [id], onDelete: Cascade)
|
|
@@ -138,10 +138,60 @@ model BashEventPromoCode {
|
|
|
138
138
|
maxRedemptions Int?
|
|
139
139
|
redeemBy DateTime?
|
|
140
140
|
usedBy User[]
|
|
141
|
+
promoter Promoter? @relation(fields: [promoterId], references: [id])
|
|
142
|
+
promoterId String? // Remove the @unique constraint here
|
|
143
|
+
meta String?
|
|
141
144
|
|
|
142
145
|
@@unique([ticketTierId, code])
|
|
143
146
|
}
|
|
144
147
|
|
|
148
|
+
model Promoter {
|
|
149
|
+
id String @id @default(cuid())
|
|
150
|
+
promoterId String // The user who is promoting
|
|
151
|
+
promotedForBash String // The bash being promoted
|
|
152
|
+
level Int @default(1)
|
|
153
|
+
isActive Boolean @default(true)
|
|
154
|
+
commissionRate Float @default(5.0)
|
|
155
|
+
creditsGenerated Int @default(0)
|
|
156
|
+
earningsGenerated Float @default(0.00)
|
|
157
|
+
createdAt DateTime @default(now())
|
|
158
|
+
updatedAt DateTime @updatedAt
|
|
159
|
+
promoCodes BashEventPromoCode[] // This allows one promoter to have multiple promo codes
|
|
160
|
+
promoterUser User @relation(fields: [userId], references: [id])
|
|
161
|
+
userId String
|
|
162
|
+
|
|
163
|
+
@@unique([promoterId, promotedForBash])
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
model PromoterStats {
|
|
167
|
+
id String @id @default(cuid())
|
|
168
|
+
userId String @unique
|
|
169
|
+
user User @relation(fields: [userId], references: [id])
|
|
170
|
+
directSignups Int @default(0)
|
|
171
|
+
indirectSignups Int @default(0)
|
|
172
|
+
totalSignups Int @default(0)
|
|
173
|
+
directClicks Int @default(0)
|
|
174
|
+
indirectClicks Int @default(0)
|
|
175
|
+
totalClicks Int @default(0)
|
|
176
|
+
directCreditsEarned Int @default(0)
|
|
177
|
+
indirectCreditsEarned Int @default(0)
|
|
178
|
+
totalCreditsEarned Int @default(0)
|
|
179
|
+
createdAt DateTime @default(now())
|
|
180
|
+
updatedAt DateTime @updatedAt
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
model PromoterClick {
|
|
184
|
+
id String @id @default(cuid())
|
|
185
|
+
promoterId String // References Promoter.id
|
|
186
|
+
promoterCode String?
|
|
187
|
+
userAgent String?
|
|
188
|
+
ipHash String? // Store a hash of IP for privacy
|
|
189
|
+
converted Boolean @default(false)
|
|
190
|
+
attributionChain String // JSON string of the full attribution path
|
|
191
|
+
createdAt DateTime @default(now())
|
|
192
|
+
clickedAt DateTime @default(now())
|
|
193
|
+
}
|
|
194
|
+
|
|
145
195
|
model BashNotification {
|
|
146
196
|
id String @id @default(cuid())
|
|
147
197
|
creatorId String
|
|
@@ -948,6 +998,8 @@ model User {
|
|
|
948
998
|
serviceBookingForCreator ServiceBooking[] @relation("BookingCreator")
|
|
949
999
|
serviceBookingForUser ServiceBooking[] @relation("BookingForUser")
|
|
950
1000
|
serviceBookingCheckout ServiceBookingCheckout[]
|
|
1001
|
+
promoter Promoter[]
|
|
1002
|
+
promoterStats PromoterStats?
|
|
951
1003
|
}
|
|
952
1004
|
|
|
953
1005
|
model Contact {
|
|
@@ -1750,6 +1802,8 @@ model ServiceBookingCheckout {
|
|
|
1750
1802
|
stripeCheckoutSessionId String? @unique
|
|
1751
1803
|
stripePaymentIntentId String? @unique
|
|
1752
1804
|
|
|
1805
|
+
stripeRefundId String? @unique
|
|
1806
|
+
|
|
1753
1807
|
paidOn DateTime?
|
|
1754
1808
|
refundedOn DateTime?
|
|
1755
1809
|
|
|
@@ -107,11 +107,18 @@ export function serviceBookingCanHaveApprovalDecision(
|
|
|
107
107
|
errorMessage: "Approval decisions can only be made on booking requests.",
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
if (
|
|
110
|
+
if (serviceBookingIsCanceled(booking)) {
|
|
111
|
+
return {
|
|
112
|
+
valid: false,
|
|
113
|
+
errorMessage:
|
|
114
|
+
"Approval decisions can not be made on canceled booking requests.",
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (serviceBookingIsConfirmed(booking)) {
|
|
111
118
|
return {
|
|
112
119
|
valid: false,
|
|
113
120
|
errorMessage:
|
|
114
|
-
"Approval decisions can
|
|
121
|
+
"Approval decisions can not be made on confirmed booking requests.",
|
|
115
122
|
};
|
|
116
123
|
}
|
|
117
124
|
|