@bash-app/bash-common 30.62.0 → 30.64.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash-app/bash-common",
3
- "version": "30.62.0",
3
+ "version": "30.64.0",
4
4
  "description": "Common data and scripts to use on the frontend and backend",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,5 @@
1
+ /* Prisma Migrate: disable-transaction */
2
+ -- Step 1: Add Basic to MembershipTier (must be committed before use)
3
+ ALTER TYPE "MembershipTier" ADD VALUE 'Basic';
4
+
5
+
@@ -0,0 +1,91 @@
1
+ -- Add new Privacy enum values and migrate ConnectionsOnly -> ContactsOnly
2
+
3
+ DO $
4
+ $
5
+ BEGIN
6
+ IF NOT EXISTS (
7
+ SELECT 1
8
+ FROM pg_enum
9
+ WHERE enumlabel = 'ContactsOnly'
10
+ AND enumtypid = (SELECT oid
11
+ FROM pg_type
12
+ WHERE typname = 'Privacy')
13
+ ) THEN
14
+ ALTER TYPE "Privacy"
15
+ ADD VALUE 'ContactsOnly';
16
+ END
17
+ IF;
18
+
19
+ IF NOT EXISTS (
20
+ SELECT 1
21
+ FROM pg_enum
22
+ WHERE enumlabel = 'CreatorOnly'
23
+ AND enumtypid = (SELECT oid
24
+ FROM pg_type
25
+ WHERE typname = 'Privacy')
26
+ ) THEN
27
+ ALTER TYPE "Privacy"
28
+ ADD VALUE 'CreatorOnly';
29
+ END
30
+ IF;
31
+
32
+ IF NOT EXISTS (
33
+ SELECT 1
34
+ FROM pg_enum
35
+ WHERE enumlabel = 'ProOnly'
36
+ AND enumtypid = (SELECT oid
37
+ FROM pg_type
38
+ WHERE typname = 'Privacy')
39
+ ) THEN
40
+ ALTER TYPE "Privacy"
41
+ ADD VALUE 'ProOnly';
42
+ END
43
+ IF;
44
+
45
+ IF NOT EXISTS (
46
+ SELECT 1
47
+ FROM pg_enum
48
+ WHERE enumlabel = 'EliteOnly'
49
+ AND enumtypid = (SELECT oid
50
+ FROM pg_type
51
+ WHERE typname = 'Privacy')
52
+ ) THEN
53
+ ALTER TYPE "Privacy"
54
+ ADD VALUE 'EliteOnly';
55
+ END
56
+ IF;
57
+
58
+ IF NOT EXISTS (
59
+ SELECT 1
60
+ FROM pg_enum
61
+ WHERE enumlabel = 'LegendOnly'
62
+ AND enumtypid = (SELECT oid
63
+ FROM pg_type
64
+ WHERE typname = 'Privacy')
65
+ ) THEN
66
+ ALTER TYPE "Privacy"
67
+ ADD VALUE 'LegendOnly';
68
+ END
69
+ IF;
70
+ END $$;
71
+
72
+ -- Migrate ConnectionsOnly to ContactsOnly if present
73
+ DO $$
74
+ BEGIN
75
+ IF EXISTS (
76
+ SELECT 1
77
+ FROM pg_enum
78
+ WHERE enumlabel = 'ConnectionsOnly'
79
+ AND enumtypid = (SELECT oid
80
+ FROM pg_type
81
+ WHERE typname = 'Privacy')
82
+ ) THEN
83
+ UPDATE "BashEvent"
84
+ SET "privacy" = 'ContactsOnly'
85
+ ::"Privacy"
86
+ WHERE "privacy" = 'ConnectionsOnly'::"Privacy";
87
+ END
88
+ IF;
89
+ END $$;
90
+
91
+
@@ -0,0 +1,20 @@
1
+ -- Add 'Model' to PromotionAndMarketingSubType enum
2
+
3
+ DO $
4
+ $
5
+ BEGIN
6
+ IF NOT EXISTS (
7
+ SELECT 1
8
+ FROM pg_enum
9
+ WHERE enumlabel = 'Model'
10
+ AND enumtypid = (SELECT oid
11
+ FROM pg_type
12
+ WHERE typname = 'PromotionAndMarketingSubType')
13
+ ) THEN
14
+ ALTER TYPE "PromotionAndMarketingSubType"
15
+ ADD VALUE 'Model';
16
+ END
17
+ IF;
18
+ END $$;
19
+
20
+
@@ -0,0 +1,68 @@
1
+ -- Create VoucherStatus enum and Voucher table
2
+
3
+ DO $
4
+ $
5
+ BEGIN
6
+ IF NOT EXISTS (SELECT 1
7
+ FROM pg_type
8
+ WHERE typname = 'VoucherStatus') THEN
9
+ CREATE TYPE "VoucherStatus" AS ENUM
10
+ ('Active', 'Used', 'Cancelled');
11
+ END
12
+ IF;
13
+ END $$;
14
+
15
+ CREATE TABLE
16
+ IF NOT EXISTS "Voucher"
17
+ (
18
+ "id" TEXT NOT NULL,
19
+ "codeHash" TEXT NOT NULL,
20
+ "issuedToEmail" TEXT,
21
+ "shopifyOrderId" TEXT,
22
+ "createdAt" TIMESTAMP
23
+ (3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
24
+ "redeemedAt" TIMESTAMP
25
+ (3),
26
+ "redeemedById" TEXT,
27
+ "status" "VoucherStatus" NOT NULL DEFAULT 'Active',
28
+ "stripePromotionCodeId" TEXT,
29
+ "stripeCouponId" TEXT,
30
+ CONSTRAINT "Voucher_pkey" PRIMARY KEY
31
+ ("id")
32
+ );
33
+
34
+ CREATE UNIQUE INDEX
35
+ IF NOT EXISTS "Voucher_codeHash_key" ON "Voucher"
36
+ ("codeHash");
37
+ CREATE INDEX
38
+ IF NOT EXISTS "Voucher_issuedToEmail_idx" ON "Voucher"
39
+ ("issuedToEmail");
40
+ CREATE INDEX
41
+ IF NOT EXISTS "Voucher_shopifyOrderId_idx" ON "Voucher"
42
+ ("shopifyOrderId");
43
+ CREATE INDEX
44
+ IF NOT EXISTS "Voucher_status_idx" ON "Voucher"
45
+ ("status");
46
+ CREATE INDEX
47
+ IF NOT EXISTS "Voucher_createdAt_idx" ON "Voucher"
48
+ ("createdAt");
49
+
50
+ DO $$
51
+ BEGIN
52
+ IF NOT EXISTS (
53
+ SELECT 1
54
+ FROM information_schema.table_constraints
55
+ WHERE constraint_name = 'Voucher_redeemedById_fkey'
56
+ AND table_name = 'Voucher'
57
+ ) THEN
58
+ ALTER TABLE "Voucher"
59
+ ADD CONSTRAINT "Voucher_redeemedById_fkey"
60
+ FOREIGN KEY ("redeemedById")
61
+ REFERENCES "User"("id")
62
+ ON DELETE SET NULL
63
+ ON UPDATE CASCADE;
64
+ END
65
+ IF;
66
+ END $$;
67
+
68
+
@@ -1085,20 +1085,20 @@ enum SocialMediaPlatform {
1085
1085
  }
1086
1086
 
1087
1087
  model User {
1088
- id String @id @default(cuid())
1089
- username String? @unique
1090
- email String @unique
1091
- createdOn DateTime @default(now())
1092
- stripeCustomerId String? @unique
1093
- stripeAccountId String? @unique
1094
- isSuperUser Boolean @default(false)
1095
- isSuspended Boolean @default(false)
1088
+ id String @id @default(cuid())
1089
+ username String? @unique
1090
+ email String @unique
1091
+ createdOn DateTime @default(now())
1092
+ stripeCustomerId String? @unique
1093
+ stripeAccountId String? @unique
1094
+ isSuperUser Boolean @default(false)
1095
+ isSuspended Boolean @default(false)
1096
1096
  intent UserIntent?
1097
1097
  googleCalendarAccess String?
1098
1098
  googleCalendarSyncSettings String?
1099
1099
  givenName String?
1100
1100
  familyName String?
1101
- nameChangeCount Int @default(0)
1101
+ nameChangeCount Int @default(0)
1102
1102
  hash String?
1103
1103
  emailVerified DateTime?
1104
1104
  image String?
@@ -1106,19 +1106,19 @@ model User {
1106
1106
  dob DateTime?
1107
1107
  gender Gender?
1108
1108
  sex Sex?
1109
- roles UserRole[] @default([User])
1109
+ roles UserRole[] @default([User])
1110
1110
  aboutMe String?
1111
1111
  levelBadge String?
1112
- temporaryBadges String[] @default([])
1113
- ownedServices Service[] @relation("OwnedService")
1114
- createdServices Service[] @relation("CreatedService")
1115
- createdEvents BashEvent[] @relation("CreatedEvent")
1112
+ temporaryBadges String[] @default([])
1113
+ ownedServices Service[] @relation("OwnedService")
1114
+ createdServices Service[] @relation("CreatedService")
1115
+ createdEvents BashEvent[] @relation("CreatedEvent")
1116
1116
  checkouts Checkout[]
1117
- ticketsISent Ticket[] @relation("TicketsISent")
1118
- ticketsIOwn Ticket[] @relation("TicketsIOwn")
1119
- transfersFrom TicketTransfer[] @relation("TransfersFrom")
1120
- transfersTo TicketTransfer[] @relation("TransfersTo")
1121
- ticketsOnWaitlist Ticket[] @relation("TicketsOnWaitlist")
1117
+ ticketsISent Ticket[] @relation("TicketsISent")
1118
+ ticketsIOwn Ticket[] @relation("TicketsIOwn")
1119
+ transfersFrom TicketTransfer[] @relation("TransfersFrom")
1120
+ transfersTo TicketTransfer[] @relation("TransfersTo")
1121
+ ticketsOnWaitlist Ticket[] @relation("TicketsOnWaitlist")
1122
1122
  ticketTiersWaitListsIveJoined TicketTier[]
1123
1123
  reviews Review[]
1124
1124
  sponsorships SponsoredEvent[]
@@ -1142,23 +1142,24 @@ model User {
1142
1142
  city String?
1143
1143
  state String?
1144
1144
  zipCode String?
1145
- country String? @default("US")
1145
+ country String? @default("US")
1146
1146
  phone String?
1147
1147
  socialMediaProfiles SocialMediaProfile[]
1148
- documentIDId String? @unique
1148
+ documentIDId String? @unique
1149
1149
  documentID DocumentID?
1150
1150
  comment BashComment[]
1151
1151
  associatedBashes AssociatedBash[]
1152
1152
  associatedServices AssociatedService[]
1153
- invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
1154
- invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
1155
- notificationsCreatedByMe Notification[] @relation("NotificationsCreatedByMe")
1156
- remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
1157
- remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
1158
- eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
1153
+ invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
1154
+ invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
1155
+ notificationsCreatedByMe Notification[] @relation("NotificationsCreatedByMe")
1156
+ remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
1157
+ remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
1158
+ eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
1159
1159
  contacts Contact[]
1160
- vouchersRedeemed Voucher[] @relation("UserVouchersRedeemed")
1161
- contactLists ContactList[] @relation("UserContactLists")
1160
+ vouchersRedeemed Voucher[] @relation("UserVouchersRedeemed")
1161
+ pushNotificationTokens PushNotificationToken[]
1162
+ contactLists ContactList[] @relation("UserContactLists")
1162
1163
  contactlist ContactList[]
1163
1164
 
1164
1165
  bashEventPromoCodesIUsed BashEventPromoCode[]
@@ -1978,6 +1979,7 @@ enum PromotionAndMarketingSubType {
1978
1979
  Influencer
1979
1980
  Promoter
1980
1981
  CelebrityAppearance
1982
+ Model
1981
1983
  }
1982
1984
 
1983
1985
  enum StaffingSubType {
@@ -3701,3 +3703,19 @@ enum VoucherStatus {
3701
3703
  Used
3702
3704
  Cancelled
3703
3705
  }
3706
+
3707
+ model PushNotificationToken {
3708
+ id String @id @default(cuid())
3709
+ userId String
3710
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
3711
+ token String @unique
3712
+ platform String // 'web', 'ios', 'android'
3713
+ userAgent String?
3714
+ isActive Boolean @default(true)
3715
+ createdAt DateTime @default(now())
3716
+ updatedAt DateTime @updatedAt
3717
+
3718
+ @@unique([userId, platform])
3719
+ @@index([userId])
3720
+ @@index([isActive])
3721
+ }