@bash-app/bash-common 29.58.0 → 29.60.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
|
@@ -750,18 +750,19 @@ enum PrizeType {
|
|
|
750
750
|
|
|
751
751
|
model Review {
|
|
752
752
|
id String @id @default(cuid())
|
|
753
|
-
rating Int
|
|
754
|
-
creatorId String
|
|
753
|
+
rating Int // Star rating, required
|
|
754
|
+
creatorId String // ID of the user who created the review
|
|
755
755
|
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
756
|
-
bashEventId String
|
|
756
|
+
bashEventId String // ID of the bash event being reviewed
|
|
757
757
|
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
758
|
-
comments BashComment[]
|
|
759
|
-
createdAt DateTime @default(now()) //
|
|
760
|
-
updatedAt DateTime @updatedAt
|
|
758
|
+
comments BashComment[] // Optional comments tied to the review
|
|
759
|
+
createdAt DateTime @default(now()) // Timestamp for when the review was created
|
|
760
|
+
updatedAt DateTime @updatedAt // Auto-updated timestamp for edits
|
|
761
761
|
|
|
762
|
-
@@unique([creatorId, bashEventId])
|
|
762
|
+
@@unique([creatorId, bashEventId]) // Prevent duplicate reviews for the same bash by a user
|
|
763
763
|
}
|
|
764
764
|
|
|
765
|
+
|
|
765
766
|
model GoogleReview {
|
|
766
767
|
id String @id @default(cuid())
|
|
767
768
|
author_name String?
|
|
@@ -880,8 +881,6 @@ model User {
|
|
|
880
881
|
competitions Competition[]
|
|
881
882
|
competitionSponsorships CompetitionSponsor[]
|
|
882
883
|
competitionPrizes Prize[]
|
|
883
|
-
userRatingGiven UserRatingGiven[]
|
|
884
|
-
userRating UserRating[]
|
|
885
884
|
hostRating Float?
|
|
886
885
|
totalRatings Int?
|
|
887
886
|
magicLink String?
|
|
@@ -1607,23 +1606,6 @@ model UserLink {
|
|
|
1607
1606
|
userId String
|
|
1608
1607
|
}
|
|
1609
1608
|
|
|
1610
|
-
model UserRating {
|
|
1611
|
-
id String @id @default(cuid())
|
|
1612
|
-
rating Int
|
|
1613
|
-
comment String?
|
|
1614
|
-
givenBy UserRatingGiven @relation(fields: [userRatingGivenId], references: [id], onDelete: Cascade)
|
|
1615
|
-
userRatingGivenId String
|
|
1616
|
-
givenTo User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1617
|
-
userId String
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
model UserRatingGiven {
|
|
1621
|
-
id String @id @default(cuid())
|
|
1622
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1623
|
-
userId String
|
|
1624
|
-
UserRating UserRating[]
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
1609
|
enum UserStatus {
|
|
1628
1610
|
Active
|
|
1629
1611
|
Inactive
|
package/src/extendedSchemas.ts
CHANGED
|
@@ -50,7 +50,6 @@ import {
|
|
|
50
50
|
SocialMediaProfile,
|
|
51
51
|
SocialMediaPlatform,
|
|
52
52
|
ServiceSubscriptionCounts,
|
|
53
|
-
UserRating,
|
|
54
53
|
} from "@prisma/client";
|
|
55
54
|
import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray } from "./definitions";
|
|
56
55
|
|
|
@@ -100,7 +99,6 @@ export const FRONT_END_USER_DATA_TO_SELECT = {
|
|
|
100
99
|
documentIDId: true,
|
|
101
100
|
// documentID: true,
|
|
102
101
|
reviews: true,
|
|
103
|
-
userRating: true,
|
|
104
102
|
contacts: true,
|
|
105
103
|
accepted: true,
|
|
106
104
|
boughtTicket: true,
|
|
@@ -126,7 +124,7 @@ export interface BashEventExt extends BashEvent {
|
|
|
126
124
|
amountOfGuests?: AmountOfGuests;
|
|
127
125
|
recurrence?: Recurrence;
|
|
128
126
|
creator?: PublicUser;
|
|
129
|
-
ticketTiers
|
|
127
|
+
ticketTiers?: TicketTierExt[];
|
|
130
128
|
media: Media[];
|
|
131
129
|
eventTasks: EventTask[];
|
|
132
130
|
tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
|
|
@@ -530,7 +528,7 @@ export interface InvitationExtraData extends Invitation {
|
|
|
530
528
|
}
|
|
531
529
|
|
|
532
530
|
export interface AssociatedBashExt extends AssociatedBash {
|
|
533
|
-
bashEvent:
|
|
531
|
+
bashEvent: BashEventExt;
|
|
534
532
|
invitation?: Partial<InvitationExt>;
|
|
535
533
|
}
|
|
536
534
|
|
|
@@ -611,7 +609,6 @@ export interface UserExt extends User {
|
|
|
611
609
|
createdServices?: ServiceExt[];
|
|
612
610
|
password?: string;
|
|
613
611
|
otp?: string;
|
|
614
|
-
userRating?: UserRating[];
|
|
615
612
|
}
|
|
616
613
|
|
|
617
614
|
export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
|
|
@@ -7,7 +7,7 @@ export function findPromoCodeFromBashEvent(bashEvent: BashEventExt | undefined |
|
|
|
7
7
|
if (!promoCodeId) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
-
if (bashEvent?.ticketTiers
|
|
10
|
+
if (bashEvent?.ticketTiers?.length) {
|
|
11
11
|
for (const tier of bashEvent?.ticketTiers) {
|
|
12
12
|
const foundPromoCode = tier.promoCodes.find((promoCode) => promoCode.id === promoCodeId);
|
|
13
13
|
if (foundPromoCode) {
|
|
@@ -23,7 +23,7 @@ export function getPromoCodesFromBashEvent(bashEvent: BashEventExt | undefined |
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export function updatePromoCodesOnBashEventTicketTiers(bashEvent: BashEventExt, promoCodes: BashEventPromoCode[]): void {
|
|
26
|
-
bashEvent.ticketTiers
|
|
26
|
+
bashEvent.ticketTiers?.forEach((tier) => {
|
|
27
27
|
tier.promoCodes = promoCodes.filter((pc) => tier.id === pc.ticketTierId);
|
|
28
28
|
});
|
|
29
29
|
}
|