@bash-app/bash-common 3.0.0 → 3.0.2
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 +1 -1
- package/prisma/schema.prisma +1 -1
- package/src/utils/awsS3Utils.ts +3 -2
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -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
|
|
270
|
+
checkoutSessionId String? @unique
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
model TicketTier {
|
package/src/utils/awsS3Utils.ts
CHANGED
|
@@ -2,12 +2,13 @@ import {DeleteObjectCommand, PutObjectCommand, S3Client} from "@aws-sdk/client-s
|
|
|
2
2
|
import {getSignedUrl} from "@aws-sdk/s3-request-presigner";
|
|
3
3
|
import {DeleteObjectCommandOutput} from "@aws-sdk/client-s3/dist-types/commands";
|
|
4
4
|
|
|
5
|
+
const BASE_64_IMAGE_REGEX = /^data:image\/\w+;base64,/;
|
|
5
6
|
|
|
6
7
|
export class AwsS3Utils {
|
|
7
8
|
static async uploadBase64String(base64Str: string, assetKey: string): Promise<string | undefined> {
|
|
8
|
-
const bufferData = Buffer.from(base64Str, 'base64');
|
|
9
|
+
const bufferData = Buffer.from(base64Str.replace(BASE_64_IMAGE_REGEX, ""), 'base64');
|
|
9
10
|
const blobData = new Blob([bufferData]);
|
|
10
|
-
return AwsS3Utils.uploadFile(blobData, assetKey, '
|
|
11
|
+
return AwsS3Utils.uploadFile(blobData, assetKey, 'image/jpeg');
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
static async uploadFile(file: Blob, assetKey: string, mimetype: string): Promise<string | undefined> {
|