@bash-app/bash-common 3.3.0 → 3.4.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.
@@ -1,153 +1,167 @@
1
- import {
2
- AmountOfGuests,
3
- EventTask,
4
- AssociatedBash,
5
- BashEvent,
6
- Invitation,
7
- TargetAudience,
8
- Ticket,
9
- User,
10
- TicketTier, Service, Review, Media, BashComment, Recurrence, Contact,
11
- BashNotification, BashEventPromoCode,
12
- Reminder
13
- } from "@prisma/client";
14
-
15
-
16
- export interface BashEventExt extends BashEvent {
17
- targetAudience?: TargetAudience;
18
- amountOfGuests?: AmountOfGuests;
19
- recurrence?: Recurrence;
20
- creator?: User;
21
- ticketTiers: TicketTierExt[];
22
- media: Media[];
23
- eventTasks: EventTask[];
24
- promoCodes?: BashEventPromoCode[];
25
- tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
26
- // Do not include in fetch. Could be hundreds of these
27
- invitations: InvitationExt[];
28
- }
29
-
30
- export interface BashNotificationsExt extends BashNotification {
31
- creator?: User;
32
- bashEvent?: BashEvent;
33
- eventTask?: EventTask;
34
- invitation?: Invitation;
35
- reminders?: Reminder[];
36
- }
37
-
38
- export const BASH_EVENT_DATA_TO_INCLUDE = {
39
- targetAudience: true,
40
- amountOfGuests: true,
41
- recurrence: true,
42
- ticketTiers: true,
43
- creator: true,
44
- eventTasks: true,
45
- media: true,
46
- promoCodes: true,
47
- }
48
-
49
- export const BASH_EVENT_DATA_TO_CLONE = [
50
- 'targetAudience',
51
- 'amountOfGuests',
52
- 'ticketTiers',
53
- 'media',
54
- 'recurrence',
55
- 'invitations',
56
- 'promoCodes',
57
- ] as const;
58
-
59
- type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
60
- type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
61
- type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
62
-
63
- export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
64
- 'creator',
65
- 'eventTasks',
66
- 'tickets'
67
- ];
68
-
69
- export interface InvitationExt extends Invitation {
70
- creator: User;
71
- sentTo: User;
72
- tickets: Ticket[];
73
- }
74
-
75
- export const INVITATION_DATA_TO_INCLUDE = {
76
- creator: true,
77
- sentTo: true,
78
- tickets: true
79
- }
80
-
81
- export interface InvitationExtraData extends Invitation {
82
- isFreeGuest?: boolean;
83
- isOrganizer?: boolean;
84
- }
85
-
86
- export interface AssociatedBashExt extends AssociatedBash {
87
- bashEvent: BashEventExt;
88
- invitation: InvitationExt;
89
- }
90
-
91
-
92
- export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
93
- bashEvent: {
94
- include: BASH_EVENT_DATA_TO_INCLUDE
95
- },
96
- invitation: {
97
- include: INVITATION_DATA_TO_INCLUDE
98
- }
99
- }
100
-
101
- export interface TicketTierExt extends TicketTier {
102
- bashEvent: BashEvent;
103
- tickets: TicketExt[];
104
- }
105
-
106
- export interface TicketExt extends Ticket {
107
- owner: User;
108
- forUser: User;
109
- }
110
-
111
- export interface ReviewExt extends Review {
112
- comments: BashComment[];
113
- }
114
-
115
- export interface UserExtraData extends User {
116
- password: string;
117
- }
118
-
119
- export interface UserExt extends User {
120
- services: Service[];
121
-
122
- // Do not include in fetch as there could be thousands of these
123
- associatedBashes?: AssociatedBash[]
124
- reviews?: ReviewExt[];
125
- contacts?: Contact[];
126
- }
127
-
128
- export const USER_DATA_TO_INCLUDE = {
129
- services: true,
130
- }
131
-
132
- export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
133
- reviews: {
134
- include: {
135
- comments: true
136
- }
137
- }
138
- }
139
-
140
- export const PUBLIC_USER_DATA_TO_SELECT = {
141
- id: true,
142
- email: true,
143
- givenName: true,
144
- familyName: true,
145
- fullName: true,
146
- username: true,
147
- image: true,
148
- uploadedImage: true,
149
- services: true,
150
- }
151
-
152
- export type Public_User = Pick<UserExt, keyof typeof PUBLIC_USER_DATA_TO_SELECT>
153
- & Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
1
+ import {
2
+ AmountOfGuests,
3
+ EventTask,
4
+ AssociatedBash,
5
+ BashEvent,
6
+ Invitation,
7
+ TargetAudience,
8
+ Ticket,
9
+ User,
10
+ TicketTier, Service, Review, Media, BashComment, Recurrence, Contact,
11
+ BashNotification, BashEventPromoCode,
12
+ Reminder, ServiceRange
13
+ } from "@prisma/client";
14
+
15
+
16
+ export interface BashEventExt extends BashEvent {
17
+ targetAudience?: TargetAudience;
18
+ amountOfGuests?: AmountOfGuests;
19
+ recurrence?: Recurrence;
20
+ creator?: User;
21
+ ticketTiers: TicketTierExt[];
22
+ media: Media[];
23
+ eventTasks: EventTask[];
24
+ promoCodes?: BashEventPromoCode[];
25
+ tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
26
+ // Do not include in fetch. Could be hundreds of these
27
+ invitations: InvitationExt[];
28
+ }
29
+
30
+ export interface BashNotificationsExt extends BashNotification {
31
+ creator?: User;
32
+ bashEvent?: BashEvent;
33
+ eventTask?: EventTask;
34
+ invitation?: Invitation;
35
+ reminders?: Reminder[];
36
+ }
37
+
38
+ export const BASH_EVENT_DATA_TO_INCLUDE = {
39
+ targetAudience: true,
40
+ amountOfGuests: true,
41
+ recurrence: true,
42
+ ticketTiers: true,
43
+ creator: true,
44
+ eventTasks: true,
45
+ media: true,
46
+ promoCodes: true,
47
+ }
48
+
49
+ export const BASH_EVENT_DATA_TO_CLONE = [
50
+ 'targetAudience',
51
+ 'amountOfGuests',
52
+ 'ticketTiers',
53
+ 'media',
54
+ 'recurrence',
55
+ 'invitations',
56
+ 'promoCodes',
57
+ ] as const;
58
+
59
+ type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
60
+ type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
61
+ type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
62
+
63
+ export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
64
+ 'creator',
65
+ 'eventTasks',
66
+ 'tickets'
67
+ ];
68
+
69
+ export interface ServiceExt extends Service {
70
+ owner: User;
71
+ media: Media[];
72
+ crowdSize: ServiceRange;
73
+ serviceRange: ServiceRange;
74
+ }
75
+
76
+ export const SERVICE_DATA_TO_INCLUDE = {
77
+ owner: true,
78
+ media: true,
79
+ crowdSize: true,
80
+ serviceRange: true,
81
+ }
82
+
83
+ export interface InvitationExt extends Invitation {
84
+ creator: User;
85
+ sentTo: User;
86
+ tickets: Ticket[];
87
+ }
88
+
89
+ export const INVITATION_DATA_TO_INCLUDE = {
90
+ creator: true,
91
+ sentTo: true,
92
+ tickets: true
93
+ }
94
+
95
+ export interface InvitationExtraData extends Invitation {
96
+ isFreeGuest?: boolean;
97
+ isOrganizer?: boolean;
98
+ }
99
+
100
+ export interface AssociatedBashExt extends AssociatedBash {
101
+ bashEvent: BashEventExt;
102
+ invitation: InvitationExt;
103
+ }
104
+
105
+
106
+ export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
107
+ bashEvent: {
108
+ include: BASH_EVENT_DATA_TO_INCLUDE
109
+ },
110
+ invitation: {
111
+ include: INVITATION_DATA_TO_INCLUDE
112
+ }
113
+ }
114
+
115
+ export interface TicketTierExt extends TicketTier {
116
+ bashEvent: BashEvent;
117
+ tickets: TicketExt[];
118
+ }
119
+
120
+ export interface TicketExt extends Ticket {
121
+ owner: User;
122
+ forUser: User;
123
+ }
124
+
125
+ export interface ReviewExt extends Review {
126
+ comments: BashComment[];
127
+ }
128
+
129
+ export interface UserExtraData extends User {
130
+ password: string;
131
+ }
132
+
133
+ export interface UserExt extends User {
134
+ services: Service[];
135
+
136
+ // Do not include in fetch as there could be thousands of these
137
+ associatedBashes?: AssociatedBash[]
138
+ reviews?: ReviewExt[];
139
+ contacts?: Contact[];
140
+ }
141
+
142
+ export const USER_DATA_TO_INCLUDE = {
143
+ services: true,
144
+ }
145
+
146
+ export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
147
+ reviews: {
148
+ include: {
149
+ comments: true
150
+ }
151
+ }
152
+ }
153
+
154
+ export const PUBLIC_USER_DATA_TO_SELECT = {
155
+ id: true,
156
+ email: true,
157
+ givenName: true,
158
+ familyName: true,
159
+ fullName: true,
160
+ username: true,
161
+ image: true,
162
+ uploadedImage: true,
163
+ services: true,
164
+ }
165
+
166
+ export type Public_User = Pick<UserExt, keyof typeof PUBLIC_USER_DATA_TO_SELECT>
167
+ & Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
package/src/index.ts CHANGED
@@ -1,9 +1,9 @@
1
- export * from "./extendedSchemas";
2
- export * from "./definitions";
3
- export * from "./utils/ticketListUtils";
4
- export * from "./utils/dateTimeUtils";
5
- export * from "./utils/recurrenceUtils";
6
- export * from "./utils/addressUtils";
7
- export * from "./utils/paymentUtils";
8
- export * from "./utils/awsS3Utils";
9
- export * from "./utils/qrCodeUtils";
1
+ export * from "./extendedSchemas";
2
+ export * from "./definitions";
3
+ export * from "./utils/ticketListUtils";
4
+ export * from "./utils/dateTimeUtils";
5
+ export * from "./utils/recurrenceUtils";
6
+ export * from "./utils/addressUtils";
7
+ export * from "./utils/paymentUtils";
8
+ export * from "./utils/awsS3Utils";
9
+ export * from "./utils/qrCodeUtils";