@jsb188/mday 1.1.5 → 1.1.7
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 +18 -5
- package/src/constants/log-activityTexts.ts +163 -23
- package/src/constants/log.ts +284 -56
- package/src/constants/organization.ts +54 -0
- package/src/constants/product.ts +66 -0
- package/src/constants/report.ts +25 -0
- package/src/schemas/childOrganizationsQuery.ts +44 -0
- package/src/schemas/editLogEntry.ts +604 -104
- package/src/schemas/{logsQueryParam.ts → logsQuery.ts} +104 -23
- package/src/schemas/organization.ts +228 -0
- package/src/schemas/productsQuery.ts +145 -0
- package/src/schemas/reportsQuery.ts +107 -0
- package/src/types/action.d.ts +42 -0
- package/src/types/log.d.ts +204 -28
- package/src/types/organization.d.ts +246 -0
- package/src/types/product.d.ts +173 -0
- package/src/types/report.d.ts +203 -0
- package/src/utils/log.ts +784 -28
- package/src/utils/organization.ts +233 -0
- package/src/utils/product-calEvent.ts +508 -0
- package/src/utils/route-helpers.ts +583 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actions data object
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface ActionTaskObj {
|
|
6
|
+
id?: number | bigint; // Optional for updates/inserts
|
|
7
|
+
logId: number | bigint;
|
|
8
|
+
queue?: string | null;
|
|
9
|
+
|
|
10
|
+
title: string;
|
|
11
|
+
instruction: string;
|
|
12
|
+
message?: string | null;
|
|
13
|
+
|
|
14
|
+
scheduledAt: Date | null;
|
|
15
|
+
delay: number | null; // seconds
|
|
16
|
+
completed: boolean;
|
|
17
|
+
|
|
18
|
+
createdAt?: Date;
|
|
19
|
+
updatedAt?: Date;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Actions GraphQL data
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export interface ActionTaskGQL {
|
|
27
|
+
__deleted?: boolean;
|
|
28
|
+
|
|
29
|
+
id: string;
|
|
30
|
+
logId: string;
|
|
31
|
+
|
|
32
|
+
title: string;
|
|
33
|
+
instruction: string;
|
|
34
|
+
message: string | null;
|
|
35
|
+
|
|
36
|
+
scheduledAt: string; // ISO date string
|
|
37
|
+
delay: number; // seconds
|
|
38
|
+
completed: boolean;
|
|
39
|
+
|
|
40
|
+
createdAt?: string; // ISO date string
|
|
41
|
+
updatedAt?: string; // ISO date string
|
|
42
|
+
}
|
package/src/types/log.d.ts
CHANGED
|
@@ -1,16 +1,71 @@
|
|
|
1
|
-
import type { OrganizationOperationEnum } from '@jsb188/app/types/organization.d';
|
|
2
1
|
import type { AccountObj } from '@jsb188/app/types/account.d';
|
|
3
|
-
import {
|
|
2
|
+
import type { ActionTaskGQL, ActionTaskObj } from '@jsb188/mday/types/action.d';
|
|
3
|
+
import type { OrganizationOperationEnum } from '../types/organization.d';
|
|
4
|
+
import {
|
|
5
|
+
LOG_ACTION_STATUS_ENUMS,
|
|
6
|
+
LOG_ARABLE_ACTIVITY_ENUMS,
|
|
7
|
+
LOG_FARMERS_MARKET_ACTIVITY_ENUMS,
|
|
8
|
+
LOG_LIVESTOCK_ACTIVITY_ENUMS,
|
|
9
|
+
LOG_SORT_ENUMS
|
|
10
|
+
} from '../constants/log';
|
|
4
11
|
|
|
5
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Enums
|
|
14
|
+
*/
|
|
6
15
|
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
16
|
+
export type LogActionStatusEnum = (typeof LOG_ACTION_STATUS_ENUMS)[number];
|
|
17
|
+
export type LogContentName = 'log' | 'ai_task' | 'invoice' | 'receipt'; // For UI visuals, client-side only
|
|
18
|
+
export type LogSortEnum = typeof LOG_SORT_ENUMS[number];
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Arable
|
|
22
|
+
*/
|
|
11
23
|
|
|
24
|
+
export type LogArableTypeEnum =
|
|
25
|
+
| 'SEED'
|
|
26
|
+
| 'PLANTING'
|
|
27
|
+
| 'FIELD'
|
|
28
|
+
| 'HARVEST'
|
|
29
|
+
| 'POST_HARVEST'
|
|
30
|
+
| 'SALES'
|
|
31
|
+
| 'WATER'
|
|
32
|
+
| 'HYGIENE'
|
|
33
|
+
| 'SANITATION'
|
|
34
|
+
| 'EQUIPMENTS'
|
|
35
|
+
| 'BIOSECURITY'
|
|
36
|
+
| 'EMPLOYEES';
|
|
12
37
|
export type LogArableActivityEnum = typeof LOG_ARABLE_ACTIVITY_ENUMS[number];
|
|
13
|
-
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Farmers Market
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
export type LogFarmersMarketTypeEnum = 'MARKET_RECEIPTS' | 'MARKET_OPERATIONS';
|
|
44
|
+
export type LogFarmersMarketActivityEnum = typeof LOG_FARMERS_MARKET_ACTIVITY_ENUMS[number];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Livestock
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
export type LogLivestockTypeEnum =
|
|
51
|
+
| 'SUPPLY_PURCHASE'
|
|
52
|
+
| 'LIVESTOCK_LIFE_CYCLE'
|
|
53
|
+
| 'LIVESTOCK_TRACKING'
|
|
54
|
+
| 'PASTURE_LAND_MANAGEMENT'
|
|
55
|
+
| 'LIVESTOCK_HEALTHCARE'
|
|
56
|
+
| 'LIVESTOCK_SALE';
|
|
57
|
+
export type LogLivestockActivityEnum = typeof LOG_LIVESTOCK_ACTIVITY_ENUMS[number];
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* All log types/activities Union
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
export type LogTypeEnum = LogArableTypeEnum | LogFarmersMarketTypeEnum | LogLivestockTypeEnum | 'AI_TASK';
|
|
64
|
+
export type LogActivityEnum = LogArableActivityEnum | LogFarmersMarketActivityEnum | LogLivestockActivityEnum;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Log metadata
|
|
68
|
+
*/
|
|
14
69
|
|
|
15
70
|
interface LogDetailsGQLBase {
|
|
16
71
|
__typename: string;
|
|
@@ -20,71 +75,192 @@ interface LogDetailsGQLBase {
|
|
|
20
75
|
notes: string;
|
|
21
76
|
}
|
|
22
77
|
|
|
23
|
-
|
|
78
|
+
interface LogMetadataBase {
|
|
79
|
+
__before: any;
|
|
80
|
+
childOrg: never;
|
|
81
|
+
childOrgId: never;
|
|
82
|
+
referenceNumber: never;
|
|
24
83
|
|
|
25
|
-
|
|
26
|
-
|
|
84
|
+
recurFromLogId?: number;
|
|
85
|
+
recurredCount?: number;
|
|
86
|
+
summary?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface LabelValueObj {
|
|
90
|
+
label: string;
|
|
91
|
+
value: string;
|
|
92
|
+
quantity?: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Log details - Arable
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
export type LogArableMetadata = LogMetadataBase & {
|
|
100
|
+
item: string;
|
|
27
101
|
quantity: number;
|
|
28
102
|
unit: string;
|
|
29
103
|
concentration: number;
|
|
30
104
|
concentrationUnit: string;
|
|
31
|
-
|
|
32
|
-
|
|
105
|
+
location: string;
|
|
106
|
+
fieldLocation?: string;
|
|
107
|
+
otherParty?: string;
|
|
108
|
+
referenceNumber?: string;
|
|
109
|
+
values?: LabelValueObj[];
|
|
110
|
+
tax: number;
|
|
111
|
+
};
|
|
33
112
|
|
|
34
|
-
interface LogArableObj {
|
|
113
|
+
export interface LogArableObj {
|
|
35
114
|
type?: LogArableTypeEnum; // Only set in server if manually extended
|
|
36
115
|
activity: LogArableActivityEnum;
|
|
37
116
|
notes: string | null;
|
|
117
|
+
translation?: string | null;
|
|
38
118
|
metadata?: Partial<LogArableMetadata> | null;
|
|
39
119
|
}
|
|
40
120
|
|
|
41
|
-
interface LogArableDetailsObj extends LogArableObj {
|
|
121
|
+
export interface LogArableDetailsObj extends LogArableObj {
|
|
42
122
|
__table: 'logs_arable';
|
|
43
|
-
id: number;
|
|
123
|
+
id: number | bigint;
|
|
124
|
+
childOrg: never;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export type LogArableMetadataGQL = LogArableMetadata & LogDetailsGQLBase;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Log details - Farmers Market
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
export type LogFarmersMarketMetadata = LogMetadataBase & {
|
|
134
|
+
referenceNumber: string;
|
|
135
|
+
voided: boolean;
|
|
136
|
+
childOrgId?: number;
|
|
137
|
+
values: LabelValueObj[];
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export interface LogFarmersMarketObj {
|
|
141
|
+
childOrgId: number | bigint;
|
|
142
|
+
type?: LogFarmersMarketTypeEnum; // Only set in server if manually extended
|
|
143
|
+
activity: LogFarmersMarketActivityEnum;
|
|
144
|
+
notes: string | null;
|
|
145
|
+
translation?: string | null;
|
|
146
|
+
metadata?: Partial<LogFarmersMarketMetadata> | null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface LogFarmersMarketDetailsObj extends LogFarmersMarketObj {
|
|
150
|
+
__table: 'logs_farmers_market';
|
|
151
|
+
id: number | bigint;
|
|
152
|
+
childOrg: {
|
|
153
|
+
id: number | bigint;
|
|
154
|
+
name: string;
|
|
155
|
+
};
|
|
44
156
|
}
|
|
45
157
|
|
|
46
|
-
export type
|
|
158
|
+
export type LogFarmersMarketMetadataGQL = LogFarmersMarketMetadata & LogDetailsGQLBase;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Log details - Livestock
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
export type LogLivestockMetadata = LogMetadataBase & {
|
|
165
|
+
damIdentifier?: string;
|
|
166
|
+
livestockIdentifiers: string[];
|
|
167
|
+
livestockGroup?: string;
|
|
168
|
+
livestock: string;
|
|
169
|
+
otherParty?: string;
|
|
170
|
+
referenceNumber?: string;
|
|
171
|
+
values?: LabelValueObj[];
|
|
172
|
+
item: string;
|
|
173
|
+
quantity: number;
|
|
174
|
+
unit: string;
|
|
175
|
+
location: string;
|
|
176
|
+
fieldLocation?: string;
|
|
177
|
+
price: number;
|
|
178
|
+
tax: number;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export interface LogLivestockObj {
|
|
182
|
+
type?: LogLivestockTypeEnum; // Only set in server if manually extended
|
|
183
|
+
activity: LogLivestockActivityEnum;
|
|
184
|
+
notes: string | null;
|
|
185
|
+
translation?: string | null;
|
|
186
|
+
damIdentifier?: string;
|
|
187
|
+
livestockIdentifiers: string[];
|
|
188
|
+
livestockGroup?: string;
|
|
189
|
+
metadata?: Partial<LogLivestockMetadata> | null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface LogLivestockDetailsObj extends LogLivestockObj {
|
|
193
|
+
__table: 'logs_livestock';
|
|
194
|
+
id: number | bigint;
|
|
195
|
+
childOrg: never;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export type LogLivestockMetadataGQL = LogLivestockMetadata & LogDetailsGQLBase;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Union type for log details
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
export type LogDetailsObj = LogArableObj | LogFarmersMarketObj | LogLivestockObj;
|
|
205
|
+
export type LogMetadataGQL = LogArableMetadataGQL | LogFarmersMarketMetadataGQL | LogLivestockMetadataGQL;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* GQL data interfaces
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
export interface LogEntryGQL {
|
|
212
|
+
__deleted?: boolean;
|
|
47
213
|
|
|
48
|
-
export interface LogEntryGQLData {
|
|
49
214
|
id: string;
|
|
50
215
|
accountId: string;
|
|
51
216
|
organizationId: string;
|
|
52
|
-
details:
|
|
217
|
+
details: LogMetadataGQL;
|
|
218
|
+
status: LogActionStatusEnum | null;
|
|
53
219
|
|
|
54
220
|
account: any;
|
|
221
|
+
actions?: ActionTaskGQL[];
|
|
222
|
+
|
|
55
223
|
date: string; // ISO date string
|
|
56
224
|
createdAt: string; // ISO date string
|
|
57
225
|
updatedAt: string; // ISO date string
|
|
58
226
|
}
|
|
59
227
|
|
|
60
228
|
export interface LogEntryInsertObj {
|
|
61
|
-
id?: number; // Only for edits
|
|
62
|
-
accountId: number;
|
|
63
|
-
organizationId: number;
|
|
64
|
-
|
|
229
|
+
id?: number | bigint; // Only for edits
|
|
230
|
+
accountId: number | bigint;
|
|
231
|
+
organizationId: number | bigint;
|
|
232
|
+
status?: LogActionStatusEnum | null;
|
|
233
|
+
details: any;
|
|
65
234
|
date: Date;
|
|
66
235
|
}
|
|
67
236
|
|
|
68
|
-
export interface
|
|
237
|
+
export interface LogEntryData {
|
|
69
238
|
__table: 'logs';
|
|
70
|
-
id: number;
|
|
71
|
-
accountId: number;
|
|
72
|
-
organizationId: number;
|
|
73
|
-
|
|
239
|
+
id: number | bigint;
|
|
240
|
+
accountId: number | bigint;
|
|
241
|
+
organizationId: number | bigint;
|
|
242
|
+
status: LogActionStatusEnum | null;
|
|
243
|
+
distance?: number; // For vector search
|
|
244
|
+
details: LogArableDetailsObj | LogFarmersMarketDetailsObj | LogLivestockDetailsObj;
|
|
74
245
|
date: Date;
|
|
75
246
|
createdAt: Date;
|
|
76
247
|
updatedAt: Date;
|
|
77
248
|
|
|
78
249
|
// This is for outputs, but will never be set for inserts
|
|
79
250
|
account?: AccountObj;
|
|
251
|
+
actions?: ActionTaskObj[];
|
|
80
252
|
}
|
|
81
253
|
|
|
82
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Filters for search for client-side
|
|
256
|
+
*/
|
|
83
257
|
|
|
84
258
|
export interface FilterLogEntriesArgs {
|
|
85
259
|
operation: OrganizationOperationEnum;
|
|
86
260
|
accountId?: string | null; // Account ID to filter logs by account
|
|
261
|
+
preset?: 'WEEKS_5' | 'AI_TASKS' | 'INCLUDE_AI_TASKS' | 'HIDE_AI_TASKS' | null;
|
|
87
262
|
types?: LogTypeEnum[] | null;
|
|
263
|
+
activities?: LogActivityEnum[] | null;
|
|
88
264
|
startDate?: string | null; // CalDate, with dashes (YYYY-MM-DD)
|
|
89
265
|
endDate?: string | null; // CalDate, with dashes (YYYY-MM-DD)
|
|
90
266
|
timeZone?: string | null; // Timezone string, e.g., 'America/New_York'
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPLIANCE_DOCUMENT_TYPE_ENUMS,
|
|
3
|
+
OPERATION_ENUMS,
|
|
4
|
+
ORG_CONTACTS,
|
|
5
|
+
ROLE_CATEGORY_ENUMS,
|
|
6
|
+
ROLE_ENUMS
|
|
7
|
+
} from '../constants/organization.ts';
|
|
8
|
+
import { PRODUCT_FEATURES } from '../constants/product.ts';
|
|
9
|
+
|
|
10
|
+
import type { AddressObj } from '@jsb188/app/types/other.d';
|
|
11
|
+
import type { StorageData } from '@jsb188/app/types/storage.d';
|
|
12
|
+
import type { LogTypeEnum } from '../types/log.d';
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Enums
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export type OrganizationFeatureEnum = typeof PRODUCT_FEATURES[number];
|
|
19
|
+
export type OrganizationRoleEnum = typeof ROLE_ENUMS[number];
|
|
20
|
+
export type OrganizationOperationEnum = typeof OPERATION_ENUMS[number];
|
|
21
|
+
export type OrganizationDepartmentEnum = typeof ORG_CONTACTS[number];
|
|
22
|
+
export type OrganizationRoleCategoryEnum = typeof ROLE_CATEGORY_ENUMS[number];
|
|
23
|
+
export type OrganizationComplianceType = typeof COMPLIANCE_DOCUMENT_TYPE_ENUMS[number];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Query filters
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export interface ChildOrgsFilterArgs {
|
|
30
|
+
internationalOnly?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* ACL
|
|
35
|
+
*/
|
|
36
|
+
|
|
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
|
+
|
|
40
|
+
export interface OrganizationACL {
|
|
41
|
+
billing: ACLPermission;
|
|
42
|
+
logs: ACLPermission;
|
|
43
|
+
members: ACLPermission;
|
|
44
|
+
finances: ACLPermission;
|
|
45
|
+
settings: ACLPermission;
|
|
46
|
+
integrations: ACLPermission;
|
|
47
|
+
digests: ACLPermission;
|
|
48
|
+
reminders: ACLPermission;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface OrganizationACLGQLData {
|
|
52
|
+
billing: ACLPermissionEnum;
|
|
53
|
+
logs: ACLPermissionEnum;
|
|
54
|
+
members: ACLPermissionEnum;
|
|
55
|
+
finances: ACLPermissionEnum;
|
|
56
|
+
settings: ACLPermissionEnum;
|
|
57
|
+
integrations: ACLPermissionEnum;
|
|
58
|
+
digests: ACLPermissionEnum;
|
|
59
|
+
reminders: ACLPermissionEnum;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Organization object
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
export interface OrganizationShortData {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
primary: boolean;
|
|
70
|
+
acl: OrganizationACL;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface OrganizationData {
|
|
74
|
+
__table: 'organizations';
|
|
75
|
+
id: bigint;
|
|
76
|
+
stripeCustomerId: string | null;
|
|
77
|
+
name: string;
|
|
78
|
+
commodities: string[] | null;
|
|
79
|
+
operation: OrganizationOperationEnum;
|
|
80
|
+
dailyDigestTime: string | null;
|
|
81
|
+
features: OrganizationFeatureEnum[];
|
|
82
|
+
settings?: OrganizationSettingsObj | null;
|
|
83
|
+
address?:
|
|
84
|
+
| null
|
|
85
|
+
| AddressObj & {
|
|
86
|
+
__table: 'organization_addresses';
|
|
87
|
+
organizationId: bigint;
|
|
88
|
+
};
|
|
89
|
+
activated: boolean;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface OrganizationContact {
|
|
93
|
+
department: OrganizationDepartmentEnum;
|
|
94
|
+
name?: string | null;
|
|
95
|
+
phoneNumber?: string | null;
|
|
96
|
+
emailAddress?: string | null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface OrganizationSettingsObj {
|
|
100
|
+
timeZone: string | null;
|
|
101
|
+
language: string | null;
|
|
102
|
+
color: string | null;
|
|
103
|
+
priorityService: boolean;
|
|
104
|
+
directory?: OrganizationContact[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface OrganizationChildData {
|
|
108
|
+
__table: 'organization_rels';
|
|
109
|
+
parentId: number | bigint | null;
|
|
110
|
+
childId: number | bigint;
|
|
111
|
+
organization: OrganizationData;
|
|
112
|
+
preferredContacts?: {
|
|
113
|
+
[key: OrganizationDepartmentEnum]: Partial<{
|
|
114
|
+
name: string | null;
|
|
115
|
+
phoneNumber: string | null;
|
|
116
|
+
emailAddress: string | null;
|
|
117
|
+
}>;
|
|
118
|
+
};
|
|
119
|
+
addedAt: Date;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Full organization object with relationship
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
export interface OrganizationRelData {
|
|
127
|
+
id: string;
|
|
128
|
+
primary: boolean;
|
|
129
|
+
role: OrganizationRoleEnum;
|
|
130
|
+
acl: OrganizationACL;
|
|
131
|
+
organization: OrganizationData;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* GraphQL data for organization types
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
export interface OrganizationComplianceGQL {
|
|
139
|
+
__deleted?: boolean;
|
|
140
|
+
|
|
141
|
+
id: string;
|
|
142
|
+
number: string;
|
|
143
|
+
name: string;
|
|
144
|
+
type: OrganizationComplianceType;
|
|
145
|
+
expirationDate: string; // YYYY-MM-DD
|
|
146
|
+
notes: string;
|
|
147
|
+
createdAt: string; // ISO date string
|
|
148
|
+
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
|
+
}[];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface OrganizationGQL {
|
|
161
|
+
id: string;
|
|
162
|
+
stripeCustomerId: string | null;
|
|
163
|
+
name: string;
|
|
164
|
+
commodities: string[] | null;
|
|
165
|
+
address: AddressObj;
|
|
166
|
+
operation: OrganizationOperationEnum;
|
|
167
|
+
compliance: OrganizationComplianceGQL[] | null;
|
|
168
|
+
features: OrganizationFeatureEnum[];
|
|
169
|
+
settings?: OrganizationSettingsObj | null;
|
|
170
|
+
directory: OrganizationContact[];
|
|
171
|
+
activated: boolean;
|
|
172
|
+
membersCount: number;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface OrganizationRelGQL {
|
|
176
|
+
id: string;
|
|
177
|
+
primary: boolean;
|
|
178
|
+
role: OrganizationRoleEnum;
|
|
179
|
+
acl: OrganizationACLGQLData;
|
|
180
|
+
organization: OrganizationGQL;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface OrganizationChildGQL {
|
|
184
|
+
id: string;
|
|
185
|
+
organization: OrganizationGQL;
|
|
186
|
+
addedAt: Date;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Compliances
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
export interface OrganizationComplianceFileData {
|
|
194
|
+
__table: 'organization_compliance_files';
|
|
195
|
+
id: number;
|
|
196
|
+
complianceId: number;
|
|
197
|
+
storageId: number;
|
|
198
|
+
order: number;
|
|
199
|
+
file: StorageData;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface OrganizationComplianceObj {
|
|
203
|
+
storageIds: number[] | null;
|
|
204
|
+
number: string;
|
|
205
|
+
name: string;
|
|
206
|
+
type: OrganizationComplianceType;
|
|
207
|
+
expirationDate: string; // cast as date: "YYYY-MM-DD" format (in database)
|
|
208
|
+
notes?: string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface OrganizationComplianceData extends Omit<OrganizationComplianceObj, 'expirationDate'> {
|
|
212
|
+
__table: 'organization_compliances';
|
|
213
|
+
id: number;
|
|
214
|
+
organizationId: number;
|
|
215
|
+
expirationDate: Date; // in runtime deno-postgres converts it into JS Date (apparently because it has to)
|
|
216
|
+
documents: OrganizationComplianceFileData[] | null;
|
|
217
|
+
createdAt: Date;
|
|
218
|
+
updatedAt: Date;
|
|
219
|
+
}
|
|
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
|
+
}
|