@bash-app/bash-common 1.0.8 → 1.0.10
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/README.md +8 -8
- package/package.json +38 -39
- package/prisma/schema.prisma +880 -880
- package/src/definitions.ts +360 -371
- package/src/extendedSchemas.ts +145 -143
- package/src/index.ts +2 -2
- package/tsconfig.json +19 -19
- package/scripts/installSelfInMainProject.ts +0 -23
package/src/extendedSchemas.ts
CHANGED
|
@@ -1,143 +1,145 @@
|
|
|
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
|
-
} from "@prisma/client";
|
|
12
|
-
import {RecordKey} from "./definitions";
|
|
13
|
-
|
|
14
|
-
// TODO: Get this to work
|
|
15
|
-
type PrismaInclude<T extends Record<RecordKey, unknown>> = {[key in keyof T]: boolean | {include: T[key]}};
|
|
16
|
-
|
|
17
|
-
export interface BashEventExt extends BashEvent {
|
|
18
|
-
targetAudience?: TargetAudience;
|
|
19
|
-
amountOfGuests?: AmountOfGuests;
|
|
20
|
-
recurrence?: Recurrence;
|
|
21
|
-
creator?: User;
|
|
22
|
-
ticketTiers: TicketTierExt[];
|
|
23
|
-
media: Media[];
|
|
24
|
-
eventTasks: EventTask[];
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
type
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
'
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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
|
+
} from "@prisma/client";
|
|
12
|
+
import {RecordKey} from "./definitions";
|
|
13
|
+
|
|
14
|
+
// TODO: Get this to work
|
|
15
|
+
type PrismaInclude<T extends Record<RecordKey, unknown>> = {[key in keyof T]: boolean | {include: T[key]}};
|
|
16
|
+
|
|
17
|
+
export interface BashEventExt extends BashEvent {
|
|
18
|
+
targetAudience?: TargetAudience;
|
|
19
|
+
amountOfGuests?: AmountOfGuests;
|
|
20
|
+
recurrence?: Recurrence;
|
|
21
|
+
creator?: User;
|
|
22
|
+
ticketTiers: TicketTierExt[];
|
|
23
|
+
media: Media[];
|
|
24
|
+
eventTasks: EventTask[];
|
|
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
|
+
location: string;
|
|
29
|
+
place?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const BASH_EVENT_DATA_TO_INCLUDE = {
|
|
33
|
+
targetAudience: true,
|
|
34
|
+
amountOfGuests: true,
|
|
35
|
+
recurrence: true,
|
|
36
|
+
ticketTiers: true,
|
|
37
|
+
creator: true,
|
|
38
|
+
eventTasks: true,
|
|
39
|
+
media: true
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const BASH_EVENT_DATA_TO_CLONE = [
|
|
43
|
+
'targetAudience',
|
|
44
|
+
'amountOfGuests',
|
|
45
|
+
'ticketTiers',
|
|
46
|
+
'media',
|
|
47
|
+
'recurrence',
|
|
48
|
+
'invitations',
|
|
49
|
+
] as const;
|
|
50
|
+
|
|
51
|
+
type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
|
|
52
|
+
type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
|
|
53
|
+
type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
|
|
54
|
+
|
|
55
|
+
export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
|
|
56
|
+
'creator',
|
|
57
|
+
'eventTasks',
|
|
58
|
+
'tickets'
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
export interface InvitationExt extends Invitation {
|
|
62
|
+
creator: User;
|
|
63
|
+
sentTo: User;
|
|
64
|
+
tickets: Ticket[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const INVITATION_DATA_TO_INCLUDE = {
|
|
68
|
+
creator: true,
|
|
69
|
+
sentTo: true,
|
|
70
|
+
tickets: true
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface InvitationExtraData extends Invitation {
|
|
74
|
+
isFreeGuest?: boolean;
|
|
75
|
+
isOrganizer?: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface AssociatedBashExt extends AssociatedBash {
|
|
79
|
+
bashEvent: BashEventExt;
|
|
80
|
+
invitation: InvitationExt;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
|
|
85
|
+
bashEvent: {
|
|
86
|
+
include: BASH_EVENT_DATA_TO_INCLUDE
|
|
87
|
+
},
|
|
88
|
+
invitation: {
|
|
89
|
+
include: INVITATION_DATA_TO_INCLUDE
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface TicketTierExt extends TicketTier {
|
|
94
|
+
bashEvent: BashEvent;
|
|
95
|
+
tickets: TicketExt[];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface TicketExt extends Ticket {
|
|
99
|
+
owner: User;
|
|
100
|
+
forUser: User;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface ReviewExt extends Review {
|
|
104
|
+
comments: BashComment[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface UserExtraData extends User {
|
|
108
|
+
password: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface UserExt extends User {
|
|
112
|
+
services: Service[];
|
|
113
|
+
|
|
114
|
+
// Do not include in fetch as there could be thousands of these
|
|
115
|
+
associatedBashes?: AssociatedBash[]
|
|
116
|
+
reviews?: ReviewExt[];
|
|
117
|
+
contacts?: Contact[];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const USER_DATA_TO_INCLUDE = {
|
|
121
|
+
services: true,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
|
|
125
|
+
reviews: {
|
|
126
|
+
include: {
|
|
127
|
+
comments: true
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const PUBLIC_USER_DATA_TO_SELECT = {
|
|
133
|
+
id: true,
|
|
134
|
+
email: true,
|
|
135
|
+
givenName: true,
|
|
136
|
+
familyName: true,
|
|
137
|
+
fullName: true,
|
|
138
|
+
username: true,
|
|
139
|
+
image: true,
|
|
140
|
+
uploadedImage: true,
|
|
141
|
+
services: true,
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type Public_User = Pick<UserExt, keyof typeof PUBLIC_USER_DATA_TO_SELECT>
|
|
145
|
+
& Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./extendedSchemas";
|
|
2
|
-
export * from "./definitions";
|
|
1
|
+
export * from "./extendedSchemas";
|
|
2
|
+
export * from "./definitions";
|
package/tsconfig.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2022",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"noEmit": true,
|
|
8
|
-
"outDir": "./dist",
|
|
9
|
-
"rootDir": "./src",
|
|
10
|
-
"strict": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"jsx": "react-jsx",
|
|
14
|
-
"noImplicitAny": true,
|
|
15
|
-
"sourceMap": true,
|
|
16
|
-
},
|
|
17
|
-
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
18
|
-
"exclude": ["node_modules"]
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"rootDir": "./src",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
|
+
"noImplicitAny": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
18
|
+
"exclude": ["node_modules"]
|
|
19
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import shell from 'shelljs';
|
|
2
|
-
|
|
3
|
-
const BASH_COMMON_DIR = 'bash-common';
|
|
4
|
-
const BASH_APP_PATH = '../node_modules/@bash-app/'; // Need to get to the main project folder
|
|
5
|
-
const BASH_COMMON_PATH = `${BASH_APP_PATH}${BASH_COMMON_DIR}`;
|
|
6
|
-
|
|
7
|
-
shell.echo('', `Current working dir: ${shell.pwd()}`);
|
|
8
|
-
shell.echo('', `Deleting bash-common folder: ${BASH_COMMON_PATH}`);
|
|
9
|
-
|
|
10
|
-
shell.rm('-rf', BASH_COMMON_PATH);
|
|
11
|
-
shell.mkdir('-p', BASH_COMMON_PATH);
|
|
12
|
-
|
|
13
|
-
shell.echo('', `Copying bash-common folder: ${BASH_COMMON_PATH}`);
|
|
14
|
-
shell.cp('-rf', `../${BASH_COMMON_DIR}`,`${BASH_APP_PATH}`);
|
|
15
|
-
|
|
16
|
-
shell.echo('', `Running npm commands in bash-common folder: ${BASH_COMMON_PATH}`);
|
|
17
|
-
shell.exec(`npm --prefix ${BASH_COMMON_PATH} install`);
|
|
18
|
-
shell.exec(`npm --prefix ${BASH_COMMON_PATH} run build`);
|
|
19
|
-
|
|
20
|
-
shell.echo('', `Copying prisma folder from bash-common folder: ${BASH_COMMON_PATH}`);
|
|
21
|
-
shell.cp('-rf', `${BASH_COMMON_PATH}/prisma`, '../'); // Need to get to the main project folder
|
|
22
|
-
|
|
23
|
-
shell.echo('', 'Done setting up bash-common!');
|