@bash-app/bash-common 2.1.0 → 3.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash-app/bash-common",
3
- "version": "2.1.0",
3
+ "version": "3.0.1",
4
4
  "description": "Common data and scripts to use on the frontend and backend",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -157,12 +157,12 @@ model BashEventPromoCode {
157
157
  bashEventId String
158
158
  bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
159
159
  code String
160
- currency String @default("USD")
160
+ stripeCouponId String?
161
161
  discountAmountInCents Int?
162
- discountAmountPercentage Float?
162
+ discountAmountPercentage Int?
163
+ maxRedemptions Int?
164
+ redeemBy DateTime?
163
165
  usedBy User[]
164
- validStartDateTime DateTime @default(now())
165
- validUntilDateTime DateTime?
166
166
 
167
167
  @@unique([bashEventId, code])
168
168
  }
@@ -267,7 +267,7 @@ model Checkout {
267
267
  bashEventId String
268
268
  bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
269
269
  tickets Ticket[]
270
- checkoutSessionId String @unique
270
+ checkoutSessionId String? @unique
271
271
  }
272
272
 
273
273
  model TicketTier {
@@ -5,8 +5,7 @@ import {DeleteObjectCommandOutput} from "@aws-sdk/client-s3/dist-types/commands"
5
5
 
6
6
  export class AwsS3Utils {
7
7
  static async uploadBase64String(base64Str: string, assetKey: string): Promise<string | undefined> {
8
- const bufferData = Buffer.from(base64Str, 'base64');
9
- const blobData = new Blob([bufferData]);
8
+ const blobData = new Blob([base64Str]);
10
9
  return AwsS3Utils.uploadFile(blobData, assetKey, 'text/plain');
11
10
  }
12
11
 
@@ -14,7 +14,7 @@ export function calculateDiscountFromPromoCode(totalInDollars: number, promoCode
14
14
  return Math.max(0, discountInDollars); // Ensure we don't discount more than 100%
15
15
  }
16
16
  if (promoCode.discountAmountPercentage) {
17
- const discountInDollars = totalInDollars * promoCode.discountAmountPercentage;
17
+ const discountInDollars = totalInDollars * (promoCode.discountAmountPercentage / 100);
18
18
  return Math.min(totalInDollars, discountInDollars); // Ensure we don't discount more than 100%
19
19
  }
20
20
  }