@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
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { OrganizationData } from './organization.d.ts';
|
|
2
|
+
import type { INBOUND_CONTACT_SORT_ENUMS } from '../constants/inboundContact.ts';
|
|
3
|
+
|
|
4
|
+
export type InboundContactsSortEnum = typeof INBOUND_CONTACT_SORT_ENUMS[number];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Inbound contact relationship to one organization.
|
|
8
|
+
*/
|
|
9
|
+
export interface InboundContactOrgData {
|
|
10
|
+
__table: 'inbound_contact_orgs';
|
|
11
|
+
inboundContactId: bigint;
|
|
12
|
+
organizationId: bigint;
|
|
13
|
+
organization?: OrganizationData | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Inbound contact memory record owned by one organization.
|
|
18
|
+
*/
|
|
19
|
+
export interface InboundContactData {
|
|
20
|
+
__table: 'inbound_contacts';
|
|
21
|
+
id: bigint;
|
|
22
|
+
organizationId: bigint;
|
|
23
|
+
personName: string | null;
|
|
24
|
+
email: string | null;
|
|
25
|
+
phone: string | null;
|
|
26
|
+
memory: string | null;
|
|
27
|
+
orgs?: InboundContactOrgData[] | null;
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
updatedAt: Date;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* GraphQL inbound contact relationship to one organization.
|
|
34
|
+
*/
|
|
35
|
+
export interface InboundContactOrgGQL {
|
|
36
|
+
organizationId: string;
|
|
37
|
+
name: string | null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* GraphQL inbound contact memory record.
|
|
42
|
+
*/
|
|
43
|
+
export interface InboundContactGQL {
|
|
44
|
+
__deleted?: boolean;
|
|
45
|
+
|
|
46
|
+
id: string;
|
|
47
|
+
organizationId: string;
|
|
48
|
+
cursor: string;
|
|
49
|
+
personName: string | null;
|
|
50
|
+
email: string | null;
|
|
51
|
+
phone: string | null;
|
|
52
|
+
memory: string | null;
|
|
53
|
+
associated?: InboundContactOrgGQL[] | null;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { IntegrationConnectionStatusEnum } from '../constants/integration.ts';
|
|
2
|
+
import type { SquareConnectionCapabilities } from '../utils/square.ts';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Integration connection database object.
|
|
6
|
+
*/
|
|
7
|
+
export interface IntegrationConnectionData {
|
|
8
|
+
__table: 'integrations';
|
|
9
|
+
id: bigint;
|
|
10
|
+
organizationId: bigint;
|
|
11
|
+
provider: 'SQUARE';
|
|
12
|
+
externalAccountId: string | null;
|
|
13
|
+
scopes: string[];
|
|
14
|
+
status: IntegrationConnectionStatusEnum;
|
|
15
|
+
expiresAt: Date | null;
|
|
16
|
+
refreshTokenExpiresAt: Date | null;
|
|
17
|
+
lastSyncedAt: Date | null;
|
|
18
|
+
lastTokenRefreshAt: Date | null;
|
|
19
|
+
lastError: string | null;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
updatedAt: Date;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* GraphQL data for integration connection types.
|
|
26
|
+
*/
|
|
27
|
+
export interface IntegrationConnectionGQL {
|
|
28
|
+
id: string;
|
|
29
|
+
organizationId: string;
|
|
30
|
+
provider: 'SQUARE';
|
|
31
|
+
externalAccountId: string | null;
|
|
32
|
+
scopes: string[];
|
|
33
|
+
status: IntegrationConnectionStatusEnum;
|
|
34
|
+
expiresAt: string | null;
|
|
35
|
+
refreshTokenExpiresAt: string | null;
|
|
36
|
+
lastSyncedAt: string | null;
|
|
37
|
+
lastTokenRefreshAt: string | null;
|
|
38
|
+
lastError: string | null;
|
|
39
|
+
capabilities: SquareConnectionCapabilities;
|
|
40
|
+
createdAt: string | null;
|
|
41
|
+
updatedAt: string | null;
|
|
42
|
+
}
|
package/src/types/log.d.ts
CHANGED
|
@@ -1,254 +1,366 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import type { OrganizationOperationEnum } from '../types/organization.d';
|
|
1
|
+
import { REQUEST_SOURCE_ENUMS } from '@jsb188/app/constants/agent.ts';
|
|
2
|
+
import type { LabelAndValue } from '@jsb188/app/types/other.d.ts';
|
|
4
3
|
import {
|
|
5
|
-
LOG_ACTION_STATUS_ENUMS,
|
|
6
4
|
LOG_ARABLE_ACTIVITY_ENUMS,
|
|
7
5
|
LOG_FARMERS_MARKET_ACTIVITY_ENUMS,
|
|
6
|
+
LOG_GROWER_NETWORK_ACTIVITY_ENUMS,
|
|
8
7
|
LOG_LIVESTOCK_ACTIVITY_ENUMS,
|
|
9
8
|
LOG_SORT_ENUMS
|
|
10
|
-
} from '../constants/log';
|
|
9
|
+
} from '../constants/log.ts';
|
|
10
|
+
import type { OrganizationOperationEnum } from '../types/organization.d.ts';
|
|
11
|
+
import type { AccountObj } from './account.d.ts';
|
|
12
|
+
import type { StorageGQL } from './storage.d.ts';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Enums
|
|
14
16
|
*/
|
|
15
17
|
|
|
16
|
-
export type
|
|
17
|
-
export type LogContentName = 'log' | 'ai_task' | 'invoice' | 'receipt'; // For UI visuals, client-side only
|
|
18
|
+
export type LogContentName = 'log' | 'invoice' | 'receipt'; // For UI visuals, client-side only
|
|
18
19
|
export type LogSortEnum = typeof LOG_SORT_ENUMS[number];
|
|
20
|
+
export type RequestSourceEnum = typeof REQUEST_SOURCE_ENUMS[number];
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* Arable
|
|
22
24
|
*/
|
|
23
25
|
|
|
24
26
|
export type LogArableTypeEnum =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
| 'SEED'
|
|
28
|
+
| 'PLANTING'
|
|
29
|
+
| 'FIELD'
|
|
30
|
+
| 'HARVEST'
|
|
31
|
+
| 'POST_HARVEST'
|
|
32
|
+
| 'SALES'
|
|
33
|
+
| 'WATER'
|
|
34
|
+
| 'HYGIENE'
|
|
35
|
+
| 'SANITATION'
|
|
36
|
+
| 'EQUIPMENT'
|
|
37
|
+
| 'BIOSECURITY'
|
|
38
|
+
| 'EMPLOYEE';
|
|
37
39
|
export type LogArableActivityEnum = typeof LOG_ARABLE_ACTIVITY_ENUMS[number];
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
42
|
* Farmers Market
|
|
41
43
|
*/
|
|
42
44
|
|
|
43
|
-
export type LogFarmersMarketTypeEnum = '
|
|
44
|
-
export type LogFarmersMarketActivityEnum =
|
|
45
|
+
export type LogFarmersMarketTypeEnum = 'MARKET_RECEIPT' | 'MARKET_OPERATION';
|
|
46
|
+
export type LogFarmersMarketActivityEnum =
|
|
47
|
+
typeof LOG_FARMERS_MARKET_ACTIVITY_ENUMS[number];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Grower Network
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
export type LogGrowerNetworkTypeEnum =
|
|
54
|
+
| 'WORKER_PRACTICE'
|
|
55
|
+
| 'EQUIPMENT'
|
|
56
|
+
| 'FIELD'
|
|
57
|
+
| 'PRODUCTION_INPUT'
|
|
58
|
+
| 'OPERATION';
|
|
59
|
+
export type LogGrowerNetworkActivityEnum =
|
|
60
|
+
typeof LOG_GROWER_NETWORK_ACTIVITY_ENUMS[number];
|
|
45
61
|
|
|
46
62
|
/**
|
|
47
63
|
* Livestock
|
|
48
64
|
*/
|
|
49
65
|
|
|
50
66
|
export type LogLivestockTypeEnum =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
export type LogLivestockActivityEnum =
|
|
67
|
+
| 'SUPPLY_PURCHASE'
|
|
68
|
+
| 'LIVESTOCK_LIFE_CYCLE'
|
|
69
|
+
| 'LIVESTOCK_TRACKING'
|
|
70
|
+
| 'PASTURE_LAND_MANAGEMENT'
|
|
71
|
+
| 'LIVESTOCK_HEALTHCARE'
|
|
72
|
+
| 'LIVESTOCK_SALE';
|
|
73
|
+
export type LogLivestockActivityEnum =
|
|
74
|
+
typeof LOG_LIVESTOCK_ACTIVITY_ENUMS[number];
|
|
58
75
|
|
|
59
76
|
/**
|
|
60
77
|
* All log types/activities Union
|
|
61
78
|
*/
|
|
62
79
|
|
|
63
|
-
export type LogTypeEnum =
|
|
64
|
-
|
|
80
|
+
export type LogTypeEnum =
|
|
81
|
+
| LogArableTypeEnum
|
|
82
|
+
| LogFarmersMarketTypeEnum
|
|
83
|
+
| LogGrowerNetworkTypeEnum
|
|
84
|
+
| LogLivestockTypeEnum;
|
|
85
|
+
|
|
86
|
+
export type LogActivityEnum =
|
|
87
|
+
| LogArableActivityEnum
|
|
88
|
+
| LogFarmersMarketActivityEnum
|
|
89
|
+
| LogGrowerNetworkActivityEnum
|
|
90
|
+
| LogLivestockActivityEnum;
|
|
65
91
|
|
|
66
92
|
/**
|
|
67
93
|
* Log metadata
|
|
68
94
|
*/
|
|
69
95
|
|
|
70
|
-
interface
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
96
|
+
interface LogMetadataBase {
|
|
97
|
+
__before: any;
|
|
98
|
+
item: string;
|
|
99
|
+
date: string;
|
|
100
|
+
time: string;
|
|
101
|
+
otherParty?: string;
|
|
102
|
+
referenceNumber?: string;
|
|
103
|
+
|
|
104
|
+
// Interface specific
|
|
105
|
+
values?: LabelAndValue[];
|
|
106
|
+
voided?: boolean;
|
|
107
|
+
|
|
108
|
+
summary?: string;
|
|
109
|
+
location?: string;
|
|
110
|
+
tax?: number; // Need to be removed and replaced by values[#].tax -- but this will require some logic changes
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface LogArableMetadata extends LogMetadataBase {
|
|
114
|
+
fieldLocation?: string;
|
|
115
|
+
quantity: number;
|
|
116
|
+
unit: string;
|
|
117
|
+
concentration: number;
|
|
118
|
+
concentrationUnit: string;
|
|
76
119
|
}
|
|
77
120
|
|
|
78
|
-
interface LogMetadataBase {
|
|
79
|
-
|
|
80
|
-
childOrg: never;
|
|
81
|
-
childOrgId: never;
|
|
82
|
-
referenceNumber: never;
|
|
83
|
-
|
|
84
|
-
recurFromLogId?: number;
|
|
85
|
-
recurredCount?: number;
|
|
86
|
-
summary?: string;
|
|
121
|
+
export interface LogFarmersMarketMetadata extends LogMetadataBase {
|
|
122
|
+
values: LabelAndValue[];
|
|
87
123
|
}
|
|
88
124
|
|
|
89
|
-
interface
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
125
|
+
export interface LogGrowerNetworkMetadata extends LogMetadataBase {
|
|
126
|
+
fieldLocation?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface LogLivestockMetadata extends LogMetadataBase {
|
|
130
|
+
fieldLocation?: string;
|
|
93
131
|
}
|
|
94
132
|
|
|
95
133
|
/**
|
|
96
|
-
* Log
|
|
134
|
+
* Log *_details table
|
|
97
135
|
*/
|
|
98
136
|
|
|
99
|
-
export
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
137
|
+
export interface LogDetailsBase {
|
|
138
|
+
id: number | bigint;
|
|
139
|
+
childOrg?: {
|
|
140
|
+
id: number | bigint;
|
|
141
|
+
name: string;
|
|
142
|
+
operation?: OrganizationOperationEnum | null;
|
|
143
|
+
};
|
|
144
|
+
childOrgId?: number | bigint | null;
|
|
145
|
+
reportId?: number | bigint | null;
|
|
146
|
+
reportSubmissionId?: number | bigint | null;
|
|
147
|
+
siteId?: number | bigint | null;
|
|
148
|
+
site?: {
|
|
149
|
+
id: number | bigint;
|
|
150
|
+
name: string;
|
|
151
|
+
};
|
|
152
|
+
location?: {
|
|
153
|
+
name: string;
|
|
154
|
+
} | null;
|
|
155
|
+
notes: string | null;
|
|
156
|
+
translation: string | null;
|
|
119
157
|
}
|
|
120
158
|
|
|
121
|
-
export interface
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
159
|
+
export interface LogArableDetailsData extends LogDetailsBase {
|
|
160
|
+
__table: 'logs_arable';
|
|
161
|
+
activity: LogArableActivityEnum;
|
|
162
|
+
metadata?: Partial<LogArableMetadata> | null;
|
|
125
163
|
}
|
|
126
164
|
|
|
127
|
-
export
|
|
165
|
+
export interface LogFarmersMarketDetailsData extends LogDetailsBase {
|
|
166
|
+
__table: 'logs_farmers_market';
|
|
167
|
+
activity: LogFarmersMarketActivityEnum;
|
|
168
|
+
metadata?: Partial<LogFarmersMarketMetadata> | null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface LogGrowerNetworkDetailsData extends LogDetailsBase {
|
|
172
|
+
__table: 'logs_grower_network';
|
|
173
|
+
activity: LogGrowerNetworkActivityEnum;
|
|
174
|
+
animalRisk: boolean;
|
|
175
|
+
equipmentRisk: boolean;
|
|
176
|
+
fieldRisk: boolean;
|
|
177
|
+
contaminationRisk: boolean;
|
|
178
|
+
hygieneRisk: boolean;
|
|
179
|
+
pestsRisk: boolean;
|
|
180
|
+
sanitationRisk: boolean;
|
|
181
|
+
metadata?: Partial<LogGrowerNetworkMetadata> | null;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface LogLivestockDetailsData extends LogDetailsBase {
|
|
185
|
+
__table: 'logs_livestock';
|
|
186
|
+
activity: LogLivestockActivityEnum;
|
|
187
|
+
metadata?: Partial<LogLivestockMetadata> | null;
|
|
188
|
+
}
|
|
128
189
|
|
|
129
190
|
/**
|
|
130
|
-
* Log details -
|
|
191
|
+
* Log details union - GraphQL
|
|
131
192
|
*/
|
|
132
193
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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;
|
|
194
|
+
interface LogDetailsBaseGQL {
|
|
195
|
+
id: string;
|
|
196
|
+
type: LogTypeEnum;
|
|
197
|
+
activity: LogActivityEnum;
|
|
198
|
+
summary: string | null;
|
|
199
|
+
notes: string;
|
|
147
200
|
}
|
|
148
201
|
|
|
149
|
-
export interface
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
202
|
+
export interface LogArableDetailsGQL extends LogDetailsBaseGQL {
|
|
203
|
+
__typename: 'LogArable';
|
|
204
|
+
|
|
205
|
+
item: string | null;
|
|
206
|
+
quantity: number | null;
|
|
207
|
+
unit: string | null;
|
|
208
|
+
concentration: number | null;
|
|
209
|
+
concentrationUnit: string | null;
|
|
210
|
+
fieldLocation: string | null;
|
|
211
|
+
otherParty: string | null;
|
|
212
|
+
referenceNumber: string | null;
|
|
213
|
+
values: LabelAndValue[] | null;
|
|
214
|
+
tax: number | null;
|
|
215
|
+
voided: boolean | null;
|
|
156
216
|
}
|
|
157
217
|
|
|
158
|
-
export
|
|
218
|
+
export interface LogFarmersMarketDetailsGQL extends LogDetailsBaseGQL {
|
|
219
|
+
__typename: 'LogFarmersMarket';
|
|
159
220
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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;
|
|
221
|
+
item: string | null;
|
|
222
|
+
otherParty: string | null;
|
|
223
|
+
referenceNumber: string | null;
|
|
224
|
+
values: LabelAndValue[] | null;
|
|
225
|
+
tax: number | null;
|
|
226
|
+
voided: boolean | null;
|
|
190
227
|
}
|
|
191
228
|
|
|
192
|
-
export interface
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
229
|
+
export interface LogGrowerNetworkDetailsGQL extends LogDetailsBaseGQL {
|
|
230
|
+
__typename: 'LogGrowerNetwork';
|
|
231
|
+
|
|
232
|
+
animalRisk: boolean;
|
|
233
|
+
equipmentRisk: boolean;
|
|
234
|
+
fieldRisk: boolean;
|
|
235
|
+
contaminationRisk: boolean;
|
|
236
|
+
hygieneRisk: boolean;
|
|
237
|
+
pestsRisk: boolean;
|
|
238
|
+
sanitationRisk: boolean;
|
|
239
|
+
otherParty: string | null;
|
|
240
|
+
item: string | null;
|
|
241
|
+
fieldLocation: string | null;
|
|
196
242
|
}
|
|
197
243
|
|
|
198
|
-
export
|
|
244
|
+
export interface LogLivestockDetailsGQL extends LogDetailsBaseGQL {
|
|
245
|
+
__typename: 'LogLivestock';
|
|
246
|
+
|
|
247
|
+
livestock: string | null;
|
|
248
|
+
livestockIdentifiers: string[] | null;
|
|
249
|
+
livestockGroup: string | null;
|
|
250
|
+
damIdentifier: string | null;
|
|
251
|
+
otherParty: string | null;
|
|
252
|
+
referenceNumber: string | null;
|
|
253
|
+
values: LabelAndValue[] | null;
|
|
254
|
+
tax: number | null;
|
|
255
|
+
voided: boolean | null;
|
|
256
|
+
item: string | null;
|
|
257
|
+
quantity: number | null;
|
|
258
|
+
unit: string | null;
|
|
259
|
+
price: number | null;
|
|
260
|
+
fieldLocation: string | null;
|
|
261
|
+
}
|
|
199
262
|
|
|
200
263
|
/**
|
|
201
264
|
* Union type for log details
|
|
202
265
|
*/
|
|
203
266
|
|
|
204
|
-
export type
|
|
205
|
-
|
|
267
|
+
export type LogMetadataGQL =
|
|
268
|
+
| LogArableDetailsGQL
|
|
269
|
+
| LogFarmersMarketDetailsGQL
|
|
270
|
+
| LogGrowerNetworkDetailsGQL
|
|
271
|
+
| LogLivestockDetailsGQL;
|
|
206
272
|
|
|
207
273
|
/**
|
|
208
274
|
* GQL data interfaces
|
|
209
275
|
*/
|
|
210
276
|
|
|
211
277
|
export interface LogEntryGQL {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
278
|
+
__typename: string;
|
|
279
|
+
__deleted?: boolean;
|
|
280
|
+
|
|
281
|
+
id: string;
|
|
282
|
+
accountId: string;
|
|
283
|
+
organizationId: string;
|
|
284
|
+
childOrgId: string | null;
|
|
285
|
+
childOrgName: string | null;
|
|
286
|
+
inboundContactId: string | null;
|
|
287
|
+
inboundContactName: string | null;
|
|
288
|
+
reportId: string | null;
|
|
289
|
+
reportSubmissionId: string | null;
|
|
290
|
+
siteId: string | null;
|
|
291
|
+
location: string | null;
|
|
292
|
+
details: LogMetadataGQL;
|
|
293
|
+
summary: string;
|
|
294
|
+
source?: RequestSourceEnum | null;
|
|
295
|
+
confidence?: number | null;
|
|
296
|
+
originalMessage?: string | null;
|
|
297
|
+
flagColor?: string | null;
|
|
298
|
+
|
|
299
|
+
account: any;
|
|
300
|
+
files: StorageGQL[];
|
|
301
|
+
|
|
302
|
+
date: string; // ISO date string
|
|
303
|
+
createdAt: string; // ISO date string
|
|
304
|
+
updatedAt: string; // ISO date string
|
|
226
305
|
}
|
|
227
306
|
|
|
228
307
|
export interface LogEntryInsertObj {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
308
|
+
id?: number | bigint; // Only for edits
|
|
309
|
+
accountId: number | bigint | null;
|
|
310
|
+
organizationId: number | bigint;
|
|
311
|
+
childOrgId?: number | bigint | null;
|
|
312
|
+
inboundContactId?: number | bigint | null;
|
|
313
|
+
emailId?: number | bigint | null;
|
|
314
|
+
reportId?: number | bigint | null;
|
|
315
|
+
reportSubmissionId?: number | bigint | null;
|
|
316
|
+
siteId?: number | bigint | null;
|
|
317
|
+
summary: string;
|
|
318
|
+
source?: RequestSourceEnum | null;
|
|
319
|
+
confidence?: number | null;
|
|
320
|
+
originalMessage?: string | null;
|
|
321
|
+
details: any;
|
|
322
|
+
date: Date;
|
|
235
323
|
}
|
|
236
324
|
|
|
237
325
|
export interface LogEntryData {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
326
|
+
__table: 'logs';
|
|
327
|
+
id: number | bigint;
|
|
328
|
+
accountId: number | bigint;
|
|
329
|
+
organizationId: number | bigint;
|
|
330
|
+
childOrgId?: number | bigint | null;
|
|
331
|
+
inboundContactId?: number | bigint | null;
|
|
332
|
+
emailId?: number | bigint | null;
|
|
333
|
+
inboundContact?: {
|
|
334
|
+
id: number | bigint;
|
|
335
|
+
personName?: string | null;
|
|
336
|
+
} | null;
|
|
337
|
+
childOrg?: {
|
|
338
|
+
id: number | bigint;
|
|
339
|
+
name: string;
|
|
340
|
+
operation?: OrganizationOperationEnum | null;
|
|
341
|
+
} | null;
|
|
342
|
+
reportId?: number | bigint | null;
|
|
343
|
+
reportSubmissionId?: number | bigint | null;
|
|
344
|
+
siteId?: number | bigint | null;
|
|
345
|
+
summary: string;
|
|
346
|
+
source?: RequestSourceEnum | null;
|
|
347
|
+
confidence?: number | null;
|
|
348
|
+
originalMessage?: string | null;
|
|
349
|
+
location?: {
|
|
350
|
+
name: string;
|
|
351
|
+
} | null;
|
|
352
|
+
distance?: number; // For vector search
|
|
353
|
+
details:
|
|
354
|
+
| LogArableDetailsData
|
|
355
|
+
| LogFarmersMarketDetailsData
|
|
356
|
+
| LogGrowerNetworkDetailsData
|
|
357
|
+
| LogLivestockDetailsData;
|
|
358
|
+
date: Date;
|
|
359
|
+
createdAt: Date;
|
|
360
|
+
updatedAt: Date;
|
|
361
|
+
|
|
362
|
+
// This is for outputs, but will never be set for inserts
|
|
363
|
+
account?: AccountObj;
|
|
252
364
|
}
|
|
253
365
|
|
|
254
366
|
/**
|
|
@@ -256,13 +368,12 @@ export interface LogEntryData {
|
|
|
256
368
|
*/
|
|
257
369
|
|
|
258
370
|
export interface FilterLogEntriesArgs {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
query?: string | null;
|
|
371
|
+
accountId?: string | null; // Account ID to filter logs by account
|
|
372
|
+
siteId?: string | number | bigint | null; // Site ID to filter logs by site
|
|
373
|
+
preset?: 'WEEKS_5' | null;
|
|
374
|
+
types?: LogTypeEnum[] | null;
|
|
375
|
+
activities?: LogActivityEnum[] | null;
|
|
376
|
+
startDate?: string | null; // CalDate, with dashes (YYYY-MM-DD)
|
|
377
|
+
endDate?: string | null; // CalDate, with dashes (YYYY-MM-DD)
|
|
378
|
+
query?: string | null;
|
|
268
379
|
}
|