@bash-app/bash-common 30.173.0 → 30.176.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.
@@ -22,6 +22,7 @@ import {
22
22
  Exhibitor,
23
23
  IdeaConfiguration,
24
24
  IdeaInterest,
25
+ IdeaInterestResponse,
25
26
  Invitation,
26
27
  Link,
27
28
  Media,
@@ -75,7 +76,12 @@ import {
75
76
  VolunteerService
76
77
  } from "@prisma/client";
77
78
  import { BlogStatus, SERVICE_LINK_DATA_TO_INCLUDE } from "./definitions.js";
78
- import { RemoveCommonProperties, UnionFromArray } from "./utils/typeUtils.js";
79
+ import {
80
+ DeepPartial,
81
+ Override,
82
+ RemoveCommonProperties,
83
+ UnionFromArray,
84
+ } from "./utils/typeUtils.js";
79
85
 
80
86
  export interface ApiResponse<T> {
81
87
  data: T;
@@ -148,6 +154,10 @@ export const FRONT_END_USER_DATA_TO_SELECT = {
148
154
  isFirstInCity: true,
149
155
  /** Venmo / Zelle / CashApp handle for off-platform payouts (promoters). */
150
156
  paymentHandle: true,
157
+ /** Host reputation fields */
158
+ hostRating: true,
159
+ totalRatings: true,
160
+ totalEventsHosted: true,
151
161
  } satisfies Prisma.UserSelect;
152
162
 
153
163
  export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
@@ -175,7 +185,10 @@ export interface CompetitionExt extends Competition {
175
185
  votes?: CompetitionVote[];
176
186
  }
177
187
 
178
- export interface BashEventExt extends BashEvent {
188
+ export interface BashEventExt extends Omit<
189
+ BashEvent,
190
+ "ideaExpiresAt" | "ideaInterestThreshold" | "isAutoApprovable"
191
+ > {
179
192
  targetAudience?: TargetAudience;
180
193
  amountOfGuests?: AmountOfGuests;
181
194
  recurrence?: Recurrence;
@@ -191,13 +204,44 @@ export interface BashEventExt extends BashEvent {
191
204
  venueOwner?: PublicUser;
192
205
  sponsorships?: SponsoredEventExt[];
193
206
  competitions?: CompetitionExt[];
194
- interests?: IdeaInterest[];
207
+ interests?: (IdeaInterest & { responses?: IdeaInterestResponse[] })[];
195
208
  configurations?: IdeaConfiguration[];
209
+ /** GET /event/:id — tickets sold (non-cancelled), for social proof */
210
+ goingCount?: number;
211
+ /** GET /event/:id when status=Idea — total IdeaInterest rows */
212
+ ideaInterestCount?: number;
213
+ /** GET /event/:id — PublicBashRsvp counts (published / presale) */
214
+ publicRsvpCounts?: { going: number; interested: number; notGoing: number };
215
+ /** Current viewer's soft RSVP (PublicBashRsvp), if any */
216
+ myPublicRsvpStatus?: string | null;
217
+ /** GET /event/:id when status=Idea — viewer's IdeaInterest row (matched by email) */
218
+ myIdeaInterest?: (IdeaInterest & { responses: IdeaInterestResponse[] }) | null;
219
+ /** Rolling expiry timestamp for Idea events (aligned with Prisma `BashEvent.ideaExpiresAt`) */
220
+ ideaExpiresAt: Date | null;
221
+ /** Whether the Idea has met the auto-approval threshold */
222
+ isAutoApprovable: boolean;
223
+ /** Number of interests needed for auto-publish (see DEFAULT_IDEA_INTEREST_THRESHOLD) */
224
+ ideaInterestThreshold: number | null;
225
+ /** GET /event/:id when status=Idea — distinct service providers who sent a service-offer notification */
226
+ ideaServiceProviderInterestCount?: number;
196
227
  // Event page visual customisation (stored as scalar columns on BashEvent)
197
228
  backgroundImage: string | null;
198
229
  themeColor: string | null;
199
230
  }
200
231
 
232
+ /**
233
+ * Incoming create/update payload (e.g. Express JSON body): core date fields may still be ISO strings
234
+ * until normalized in the API (`getBashEventWithNormalizedDates` / `upsertBashEvent`).
235
+ */
236
+ export type BashEventUpsertWireInput = Override<
237
+ DeepPartial<BashEventExt>,
238
+ Partial<BashEventExt> & {
239
+ startDateTime?: Date | string | null;
240
+ endDateTime?: Date | string | null;
241
+ ideaExpiresAt?: Date | string | null;
242
+ }
243
+ >;
244
+
201
245
  export const TICKET_TIER_DATA_TO_INCLUDE = {
202
246
  tickets: {
203
247
  include: {
@@ -846,7 +890,6 @@ export interface TargetAudienceExt extends TargetAudience {
846
890
  tags?: string[];
847
891
  createdAt?: Date;
848
892
  updatedAt?: Date;
849
- notes?: string;
850
893
  isHighlighted?: boolean;
851
894
  associatedCampaigns?: string[];
852
895
  icon?: string;
@@ -866,6 +909,9 @@ export const BASH_NOTIFICATION_DATA_TO_INCLUDE = {
866
909
  creator: {
867
910
  select: {
868
911
  image: true,
912
+ uploadedImage: true,
913
+ imageUpdatedAt: true,
914
+ uploadedImageUpdatedAt: true,
869
915
  },
870
916
  },
871
917
  service: {
package/src/index.ts CHANGED
@@ -1,9 +1,18 @@
1
1
  export * from "./definitions.js";
2
2
  export * from "./extendedSchemas.js";
3
+ export * from "./bashFeedTypes.js";
3
4
  export * from "./membershipDefinitions.js";
4
5
 
5
6
  // Re-export commonly used Prisma types
6
- export type { Service, Organization, User, BashEvent } from '@prisma/client';
7
+ export type {
8
+ Service,
9
+ Organization,
10
+ User,
11
+ BashEvent,
12
+ BashFeedPost,
13
+ BashAssociationType,
14
+ Privacy,
15
+ } from '@prisma/client';
7
16
 
8
17
  export * from "./utils/addressUtils.js";
9
18
  export * from "./utils/apiUtils.js";
@@ -30,6 +30,21 @@ export function databaseAddressStringToAddressValues(addressString: string | und
30
30
  }
31
31
 
32
32
 
33
+ /**
34
+ * City, state/region, and country for compact card/list UIs (no street or full formatted address).
35
+ * Detail pages should use {@link databaseAddressStringToOneLineString} or full address fields.
36
+ */
37
+ export function formatLocalityForCardDisplay(
38
+ city?: string | null,
39
+ state?: string | null,
40
+ country?: string | null
41
+ ): string {
42
+ const parts = [city?.trim(), state?.trim(), country?.trim()].filter(
43
+ (p): p is string => !!p && p.length > 0
44
+ );
45
+ return parts.join(", ");
46
+ }
47
+
33
48
  export function databaseAddressStringToOneLineString(addressString: string | undefined | null): string {
34
49
  if (addressString) {
35
50
  // Special handling for place-only addresses