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