@jsb188/mday 1.1.7 → 1.1.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/package.json +39 -20
- package/src/constants/dataTable.ts +22 -0
- package/src/constants/email.ts +28 -0
- package/src/constants/inboundContact.ts +8 -0
- package/src/constants/integration.ts +14 -0
- package/src/constants/log-activityTexts.ts +54 -28
- package/src/constants/log.ts +82 -38
- package/src/constants/organization.ts +11 -2
- package/src/constants/product.ts +9 -33
- package/src/constants/report.ts +29 -10
- package/src/constants/sheet.ts +20 -0
- package/src/constants/square.ts +16 -0
- package/src/constants/storage.ts +12 -0
- package/src/schemas/editLogEntry.ts +90 -44
- package/src/schemas/inboundContact.ts +72 -0
- package/src/schemas/logsQuery.ts +7 -272
- package/src/schemas/organization.ts +11 -174
- package/src/schemas/productsQuery.ts +2 -94
- package/src/schemas/reportsQuery.ts +8 -95
- package/src/types/account.d.ts +78 -0
- package/src/types/dataTable.d.ts +447 -0
- package/src/types/email.d.ts +71 -0
- package/src/types/inboundContact.d.ts +56 -0
- package/src/types/integration.d.ts +42 -0
- package/src/types/log.d.ts +289 -178
- package/src/types/organization.d.ts +106 -50
- package/src/types/product.d.ts +7 -96
- package/src/types/report.d.ts +239 -152
- package/src/types/sheet.d.ts +298 -0
- package/src/types/storage.d.ts +161 -0
- package/src/types/workflow.d.ts +174 -0
- package/src/utils/dataTable.ts +834 -0
- package/src/utils/email.ts +113 -0
- package/src/utils/log.ts +30 -628
- package/src/utils/organization.ts +227 -44
- package/src/utils/product-calEvent.ts +7 -60
- package/src/utils/report.ts +158 -0
- package/src/utils/sheet.ts +170 -0
- package/src/utils/square.ts +22 -0
- package/src/utils/table-route.ts +146 -0
- package/src/utils/workflow.ts +212 -0
- package/tsconfig.json +12 -0
- package/src/schemas/childOrganizationsQuery.ts +0 -44
- package/src/types/action.d.ts +0 -42
- package/src/utils/route-helpers.ts +0 -583
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
} from '../constants/organization.ts';
|
|
8
8
|
import { PRODUCT_FEATURES } from '../constants/product.ts';
|
|
9
9
|
|
|
10
|
-
import type { AddressObj } from '@jsb188/app/types/other.d';
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
10
|
+
import type { AddressObj } from '@jsb188/app/types/other.d.ts';
|
|
11
|
+
import type { IntegrationConnectionData, IntegrationConnectionGQL } from './integration.d.ts';
|
|
12
|
+
import type { StorageData, StorageGQL } from './storage.d.ts';
|
|
13
|
+
import type { OrganizationRouteSettingsObj } from '../utils/table-route.ts';
|
|
13
14
|
|
|
14
15
|
/*
|
|
15
16
|
* Enums
|
|
@@ -27,15 +28,16 @@ export type OrganizationComplianceType = typeof COMPLIANCE_DOCUMENT_TYPE_ENUMS[n
|
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
30
|
export interface ChildOrgsFilterArgs {
|
|
30
|
-
|
|
31
|
+
childOrgIds?: Array<string | number | bigint>;
|
|
32
|
+
affiliated?: boolean | null;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/*
|
|
34
36
|
* ACL
|
|
35
37
|
*/
|
|
36
38
|
|
|
37
|
-
type ACLPermission = 0 | 1 | 2 | 3; // 0: no access, 1: read-only, 2: allow-write, 3: allow-manage
|
|
38
|
-
type ACLPermissionEnum = 'NONE' | 'READ' | 'WRITE' | 'MANAGE';
|
|
39
|
+
export type ACLPermission = 0 | 1 | 2 | 3; // 0: no access, 1: read-only, 2: allow-write, 3: allow-manage
|
|
40
|
+
export type ACLPermissionEnum = 'NONE' | 'READ' | 'WRITE' | 'MANAGE';
|
|
39
41
|
|
|
40
42
|
export interface OrganizationACL {
|
|
41
43
|
billing: ACLPermission;
|
|
@@ -74,10 +76,10 @@ export interface OrganizationData {
|
|
|
74
76
|
__table: 'organizations';
|
|
75
77
|
id: bigint;
|
|
76
78
|
stripeCustomerId: string | null;
|
|
79
|
+
inboundEmail: string | null;
|
|
77
80
|
name: string;
|
|
78
81
|
commodities: string[] | null;
|
|
79
82
|
operation: OrganizationOperationEnum;
|
|
80
|
-
dailyDigestTime: string | null;
|
|
81
83
|
features: OrganizationFeatureEnum[];
|
|
82
84
|
settings?: OrganizationSettingsObj | null;
|
|
83
85
|
address?:
|
|
@@ -86,22 +88,56 @@ export interface OrganizationData {
|
|
|
86
88
|
__table: 'organization_addresses';
|
|
87
89
|
organizationId: bigint;
|
|
88
90
|
};
|
|
91
|
+
integrations?: IntegrationConnectionData[] | null;
|
|
89
92
|
activated: boolean;
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
export interface
|
|
95
|
+
export interface OrganizationSiteData {
|
|
96
|
+
__table: 'organization_sites';
|
|
97
|
+
id: bigint;
|
|
98
|
+
organizationId: bigint;
|
|
99
|
+
parentId?: bigint | null;
|
|
100
|
+
name: string;
|
|
101
|
+
region?: string | null;
|
|
102
|
+
note?: string | null;
|
|
103
|
+
createdAt: Date;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface OrgContact {
|
|
93
107
|
department: OrganizationDepartmentEnum;
|
|
94
108
|
name?: string | null;
|
|
95
109
|
phoneNumber?: string | null;
|
|
96
110
|
emailAddress?: string | null;
|
|
97
111
|
}
|
|
98
112
|
|
|
113
|
+
export interface MergedOrgContact extends OrgContact {
|
|
114
|
+
department: OrganizationDepartmentEnum;
|
|
115
|
+
defaultName?: string | null;
|
|
116
|
+
defaultPhoneNumber?: string | null;
|
|
117
|
+
defaultEmailAddress?: string | null;
|
|
118
|
+
officialContact?: boolean;
|
|
119
|
+
locked?: boolean;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface OrganizationSidebarItemObj {
|
|
123
|
+
slug: string;
|
|
124
|
+
label: string;
|
|
125
|
+
iconName: string | null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface OrganizationSidebarGroupObj {
|
|
129
|
+
title: string;
|
|
130
|
+
items: OrganizationSidebarItemObj[];
|
|
131
|
+
}
|
|
132
|
+
|
|
99
133
|
export interface OrganizationSettingsObj {
|
|
100
134
|
timeZone: string | null;
|
|
101
135
|
language: string | null;
|
|
102
136
|
color: string | null;
|
|
103
137
|
priorityService: boolean;
|
|
104
|
-
directory?:
|
|
138
|
+
directory?: OrgContact[];
|
|
139
|
+
routes?: Record<string, OrganizationRouteSettingsObj>;
|
|
140
|
+
sidebar?: OrganizationSidebarGroupObj[] | null;
|
|
105
141
|
}
|
|
106
142
|
|
|
107
143
|
export interface OrganizationChildData {
|
|
@@ -116,6 +152,8 @@ export interface OrganizationChildData {
|
|
|
116
152
|
emailAddress: string | null;
|
|
117
153
|
}>;
|
|
118
154
|
};
|
|
155
|
+
memory?: string | null;
|
|
156
|
+
affiliated: boolean;
|
|
119
157
|
addedAt: Date;
|
|
120
158
|
}
|
|
121
159
|
|
|
@@ -139,41 +177,80 @@ export interface OrganizationComplianceGQL {
|
|
|
139
177
|
__deleted?: boolean;
|
|
140
178
|
|
|
141
179
|
id: string;
|
|
142
|
-
number: string;
|
|
143
|
-
|
|
180
|
+
number: string | null;
|
|
181
|
+
documentName: string | null;
|
|
144
182
|
type: OrganizationComplianceType;
|
|
145
183
|
expirationDate: string; // YYYY-MM-DD
|
|
146
|
-
notes: string;
|
|
147
184
|
createdAt: string; // ISO date string
|
|
148
185
|
updatedAt: string; // ISO date string
|
|
149
|
-
|
|
150
|
-
files: {
|
|
151
|
-
id: string;
|
|
152
|
-
complianceId: string;
|
|
153
|
-
storageId: string;
|
|
154
|
-
uri: string | null;
|
|
155
|
-
contentType: string | null;
|
|
156
|
-
order: number;
|
|
157
|
-
}[];
|
|
186
|
+
files: StorageGQL[] | null;
|
|
158
187
|
}
|
|
159
188
|
|
|
160
189
|
export interface OrganizationGQL {
|
|
190
|
+
__deleted?: boolean;
|
|
191
|
+
|
|
161
192
|
id: string;
|
|
162
193
|
stripeCustomerId: string | null;
|
|
194
|
+
inboundEmail: string | null;
|
|
163
195
|
name: string;
|
|
164
196
|
commodities: string[] | null;
|
|
165
197
|
address: AddressObj;
|
|
166
198
|
operation: OrganizationOperationEnum;
|
|
167
199
|
compliance: OrganizationComplianceGQL[] | null;
|
|
200
|
+
integrations: IntegrationConnectionGQL[] | null;
|
|
168
201
|
features: OrganizationFeatureEnum[];
|
|
169
202
|
settings?: OrganizationSettingsObj | null;
|
|
170
|
-
directory:
|
|
203
|
+
directory: OrgContact[];
|
|
171
204
|
activated: boolean;
|
|
172
205
|
membersCount: number;
|
|
173
206
|
}
|
|
174
207
|
|
|
208
|
+
export interface OrganizationSiteGQL {
|
|
209
|
+
__deleted?: boolean;
|
|
210
|
+
|
|
211
|
+
id: string;
|
|
212
|
+
readableId?: string | null;
|
|
213
|
+
organizationId: string;
|
|
214
|
+
parentId?: string | null;
|
|
215
|
+
name: string;
|
|
216
|
+
region?: string | null;
|
|
217
|
+
note?: string | null;
|
|
218
|
+
createdAt: string;
|
|
219
|
+
organizationName?: string | null;
|
|
220
|
+
parentName?: string | null;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface OrganizationRelAccountGQL {
|
|
224
|
+
id: string;
|
|
225
|
+
deleted: boolean;
|
|
226
|
+
color: string | null;
|
|
227
|
+
profile: null | {
|
|
228
|
+
id: string;
|
|
229
|
+
firstName: string | null;
|
|
230
|
+
lastName: string | null;
|
|
231
|
+
photoId: string | null;
|
|
232
|
+
photoUri: string | null;
|
|
233
|
+
};
|
|
234
|
+
settings: Record<string, any> | null;
|
|
235
|
+
email: null | {
|
|
236
|
+
id: string;
|
|
237
|
+
address: string | null;
|
|
238
|
+
verified: boolean;
|
|
239
|
+
};
|
|
240
|
+
phone: null | {
|
|
241
|
+
id: string;
|
|
242
|
+
number: string | null;
|
|
243
|
+
verified: boolean;
|
|
244
|
+
primary: boolean;
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
175
248
|
export interface OrganizationRelGQL {
|
|
249
|
+
__deleted?: boolean;
|
|
250
|
+
|
|
176
251
|
id: string;
|
|
252
|
+
organizationId?: string;
|
|
253
|
+
account?: OrganizationRelAccountGQL | null;
|
|
177
254
|
primary: boolean;
|
|
178
255
|
role: OrganizationRoleEnum;
|
|
179
256
|
acl: OrganizationACLGQLData;
|
|
@@ -181,8 +258,15 @@ export interface OrganizationRelGQL {
|
|
|
181
258
|
}
|
|
182
259
|
|
|
183
260
|
export interface OrganizationChildGQL {
|
|
261
|
+
__deleted?: boolean;
|
|
262
|
+
|
|
184
263
|
id: string;
|
|
264
|
+
parentId: string;
|
|
265
|
+
cursor: string;
|
|
185
266
|
organization: OrganizationGQL;
|
|
267
|
+
preferredContacts: OrgContact[];
|
|
268
|
+
memory?: string | null;
|
|
269
|
+
affiliated: boolean;
|
|
186
270
|
addedAt: Date;
|
|
187
271
|
}
|
|
188
272
|
|
|
@@ -192,7 +276,6 @@ export interface OrganizationChildGQL {
|
|
|
192
276
|
|
|
193
277
|
export interface OrganizationComplianceFileData {
|
|
194
278
|
__table: 'organization_compliance_files';
|
|
195
|
-
id: number;
|
|
196
279
|
complianceId: number;
|
|
197
280
|
storageId: number;
|
|
198
281
|
order: number;
|
|
@@ -217,30 +300,3 @@ export interface OrganizationComplianceData extends Omit<OrganizationComplianceO
|
|
|
217
300
|
createdAt: Date;
|
|
218
301
|
updatedAt: Date;
|
|
219
302
|
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Workflow instructions
|
|
223
|
-
*/
|
|
224
|
-
|
|
225
|
-
export interface OrganizationInstructionsData {
|
|
226
|
-
__table: 'organization_instructions';
|
|
227
|
-
id: bigint | number;
|
|
228
|
-
organizationId: bigint | number;
|
|
229
|
-
logType: LogTypeEnum;
|
|
230
|
-
instructions: string;
|
|
231
|
-
summary: string;
|
|
232
|
-
createdAt: Date;
|
|
233
|
-
updatedAt: Date;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export interface OrganizationInstructionsGQL {
|
|
237
|
-
__deleted?: boolean;
|
|
238
|
-
|
|
239
|
-
id: string;
|
|
240
|
-
organizationId: string;
|
|
241
|
-
logType: LogTypeEnum;
|
|
242
|
-
instructions: string;
|
|
243
|
-
summary: string;
|
|
244
|
-
createdAt: string; // ISO date string
|
|
245
|
-
updatedAt: string; // ISO date string
|
|
246
|
-
}
|
package/src/types/product.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
1
|
+
import type { AccountData } from './account.d.ts';
|
|
2
|
+
import type { AddressObj, ScheduleObj } from '@jsb188/app/types/other.d.ts';
|
|
3
|
+
import { PRODUCT_TYPES } from '../constants/product.ts';
|
|
4
|
+
import type { OrganizationData, OrganizationGQL } from './organization.d.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Enums
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export type ProductTypeEnum = typeof PRODUCT_TYPES[number];
|
|
11
|
-
export type ProductLivestockTypeEnum = typeof PRODUCT_LIVESTOCK_TYPES[number];
|
|
12
|
-
export type ProductLivestockStatusEnum = typeof PRODUCT_LIVESTOCK_STATUS[number];
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* Filters
|
|
@@ -21,49 +19,6 @@ export interface ProductsFilterArgs {
|
|
|
21
19
|
query?: string | null;
|
|
22
20
|
calDate?: string | null; // "YYYY-MM-DD"
|
|
23
21
|
timeZone?: string | null; // Server only for now
|
|
24
|
-
// status: ProductLivestockStatusEnum;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Product details; Livestock
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
export interface ProductLivestockObj {
|
|
32
|
-
// This interface is not ready yet; old system has to be migrated.
|
|
33
|
-
'?': '?';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface ProductLivestockData {
|
|
37
|
-
__table: 'products_livestock';
|
|
38
|
-
id?: number | bigint;
|
|
39
|
-
productId: number | bigint;
|
|
40
|
-
type: ProductLivestockTypeEnum;
|
|
41
|
-
status: ProductLivestockStatusEnum;
|
|
42
|
-
birthDate?: string | null; // "YYYY-MM-DD"
|
|
43
|
-
deathDate?: string | null; // "YYYY-MM-DD"
|
|
44
|
-
damIdentifier?: string | null;
|
|
45
|
-
livestockIdentifier: string;
|
|
46
|
-
livestockGroup?: string | null;
|
|
47
|
-
metadata: {
|
|
48
|
-
overview: string;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface ProductLivestockGQL {
|
|
53
|
-
__typename: 'ProductLivestock';
|
|
54
|
-
|
|
55
|
-
id: string;
|
|
56
|
-
organizationId: string;
|
|
57
|
-
damIdentifier: string | null;
|
|
58
|
-
livestockIdentifier: string | null;
|
|
59
|
-
livestockGroup: string | null;
|
|
60
|
-
|
|
61
|
-
type: ProductLivestockTypeEnum;
|
|
62
|
-
status: ProductLivestockStatusEnum;
|
|
63
|
-
livestockClass: string;
|
|
64
|
-
|
|
65
|
-
birthDate: string | null; // "YYYY-MM-DD"
|
|
66
|
-
deathDate: string | null; // "YYYY-MM-DD"
|
|
67
22
|
}
|
|
68
23
|
|
|
69
24
|
/**
|
|
@@ -99,53 +54,9 @@ export interface ProductCalEventGQL {
|
|
|
99
54
|
endAt: Date;
|
|
100
55
|
}
|
|
101
56
|
|
|
102
|
-
export type ProductDetailsObj =
|
|
103
|
-
export type ProductDetailsData =
|
|
104
|
-
export type ProductDetailsGQL =
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* CalEvent; attendance
|
|
108
|
-
*/
|
|
109
|
-
|
|
110
|
-
export interface ProductAttendanceObj {
|
|
111
|
-
productId: number | bigint;
|
|
112
|
-
organizationId: number | bigint;
|
|
113
|
-
accountId: number | bigint;
|
|
114
|
-
attended: boolean | null;
|
|
115
|
-
calDate: string; // "YYYY-MM-DD" format
|
|
116
|
-
history?: [string, '0' | '1'][] | null; // [YYYY-MM-DD, '0' | '1'][]
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface ProductAttendanceData extends ProductAttendanceObj {
|
|
120
|
-
__table: 'products_attendance';
|
|
121
|
-
organization: OrganizationData;
|
|
122
|
-
account: AccountData; // account data
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface ProductAttendanceGQL {
|
|
126
|
-
__deleted: boolean; // For client-side only
|
|
127
|
-
id: string;
|
|
128
|
-
productId: string;
|
|
129
|
-
organizationId: string;
|
|
130
|
-
attended: boolean | null;
|
|
131
|
-
calDate: string; // "YYYY-MM-DD" format
|
|
132
|
-
organization: OrganizationGQL;
|
|
133
|
-
checkedBy: any; // account data
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* CalEvent; load list
|
|
138
|
-
*/
|
|
139
|
-
|
|
140
|
-
export interface ProductLoadListData {
|
|
141
|
-
__table: 'products_load_list';
|
|
142
|
-
organizationId: number | bigint;
|
|
143
|
-
productId: number | bigint;
|
|
144
|
-
calDate: Date; // Postgres returns "date" as JS Date, but it's safe to convert "YYYY-MM-DD" without time zone.
|
|
145
|
-
items: string[][]; // [ [itemName, quantity, unit], ... ]
|
|
146
|
-
createdAt: Date;
|
|
147
|
-
updatedAt: Date;
|
|
148
|
-
}
|
|
57
|
+
export type ProductDetailsObj = ProductCalEventObj;
|
|
58
|
+
export type ProductDetailsData = ProductCalEventData;
|
|
59
|
+
export type ProductDetailsGQL = ProductCalEventGQL;
|
|
149
60
|
|
|
150
61
|
/**
|
|
151
62
|
* Product data objects
|