@deepintel-ltd/farmpro-contracts 1.3.4 → 1.4.1

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.
@@ -460,8 +460,12 @@ export declare const documentsRouter: {
460
460
  description: "Upload a file and get back the file URL in JSON:API format";
461
461
  method: "POST";
462
462
  contentType: "multipart/form-data";
463
- body: import("@ts-rest/core").ContractPlainType<{
464
- file: File;
463
+ body: z.ZodObject<{
464
+ file: z.ZodType<import("buffer").File, z.ZodTypeDef, import("buffer").File>;
465
+ }, "strip", z.ZodTypeAny, {
466
+ file: import("buffer").File;
467
+ }, {
468
+ file: import("buffer").File;
465
469
  }>;
466
470
  path: "/farms/:farmId/documents/upload";
467
471
  responses: {
@@ -865,6 +869,514 @@ export declare const documentsRouter: {
865
869
  }>;
866
870
  };
867
871
  };
872
+ uploadFileToDocument: {
873
+ pathParams: z.ZodObject<{
874
+ farmId: z.ZodString;
875
+ id: z.ZodString;
876
+ }, "strip", z.ZodTypeAny, {
877
+ id: string;
878
+ farmId: string;
879
+ }, {
880
+ id: string;
881
+ farmId: string;
882
+ }>;
883
+ summary: "Upload file to existing document";
884
+ description: "Upload a file to an existing document record and update it with the file URL";
885
+ method: "POST";
886
+ contentType: "multipart/form-data";
887
+ body: z.ZodObject<{
888
+ file: z.ZodType<import("buffer").File, z.ZodTypeDef, import("buffer").File>;
889
+ }, "strip", z.ZodTypeAny, {
890
+ file: import("buffer").File;
891
+ }, {
892
+ file: import("buffer").File;
893
+ }>;
894
+ path: "/farms/:farmId/documents/:id/upload";
895
+ responses: {
896
+ 200: z.ZodObject<{
897
+ data: z.ZodObject<{
898
+ type: z.ZodLiteral<string>;
899
+ id: z.ZodString;
900
+ attributes: z.ZodObject<{
901
+ farmId: z.ZodString;
902
+ name: z.ZodString;
903
+ type: z.ZodEnum<["receipt", "certificate", "land-document", "insurance", "contract", "invoice", "other"]>;
904
+ category: z.ZodNullable<z.ZodString>;
905
+ fileUrl: z.ZodString;
906
+ fileSize: z.ZodNullable<z.ZodNumber>;
907
+ uploadedDate: z.ZodString;
908
+ uploadedBy: z.ZodNullable<z.ZodString>;
909
+ relatedTo: z.ZodNullable<z.ZodObject<{
910
+ type: z.ZodEnum<["farm", "field", "purchase", "expense", "equipment", "other"]>;
911
+ id: z.ZodString;
912
+ }, "strip", z.ZodTypeAny, {
913
+ type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
914
+ id: string;
915
+ }, {
916
+ type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
917
+ id: string;
918
+ }>>;
919
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
920
+ description: z.ZodNullable<z.ZodString>;
921
+ } & {
922
+ createdAt: z.ZodString;
923
+ updatedAt: z.ZodString;
924
+ }, "strip", z.ZodTypeAny, {
925
+ type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
926
+ createdAt: string;
927
+ updatedAt: string;
928
+ name: string;
929
+ description: string | null;
930
+ farmId: string;
931
+ category: string | null;
932
+ fileUrl: string;
933
+ fileSize: number | null;
934
+ uploadedDate: string;
935
+ uploadedBy: string | null;
936
+ relatedTo: {
937
+ type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
938
+ id: string;
939
+ } | null;
940
+ tags?: string[] | undefined;
941
+ }, {
942
+ type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
943
+ createdAt: string;
944
+ updatedAt: string;
945
+ name: string;
946
+ description: string | null;
947
+ farmId: string;
948
+ category: string | null;
949
+ fileUrl: string;
950
+ fileSize: number | null;
951
+ uploadedDate: string;
952
+ uploadedBy: string | null;
953
+ relatedTo: {
954
+ type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
955
+ id: string;
956
+ } | null;
957
+ tags?: string[] | undefined;
958
+ }>;
959
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
960
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
961
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
962
+ }, "strip", z.ZodTypeAny, {
963
+ type: string;
964
+ id: string;
965
+ attributes: {
966
+ type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
967
+ createdAt: string;
968
+ updatedAt: string;
969
+ name: string;
970
+ description: string | null;
971
+ farmId: string;
972
+ category: string | null;
973
+ fileUrl: string;
974
+ fileSize: number | null;
975
+ uploadedDate: string;
976
+ uploadedBy: string | null;
977
+ relatedTo: {
978
+ type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
979
+ id: string;
980
+ } | null;
981
+ tags?: string[] | undefined;
982
+ };
983
+ relationships?: Record<string, unknown> | undefined;
984
+ links?: Record<string, string> | undefined;
985
+ meta?: Record<string, unknown> | undefined;
986
+ }, {
987
+ type: string;
988
+ id: string;
989
+ attributes: {
990
+ type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
991
+ createdAt: string;
992
+ updatedAt: string;
993
+ name: string;
994
+ description: string | null;
995
+ farmId: string;
996
+ category: string | null;
997
+ fileUrl: string;
998
+ fileSize: number | null;
999
+ uploadedDate: string;
1000
+ uploadedBy: string | null;
1001
+ relatedTo: {
1002
+ type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
1003
+ id: string;
1004
+ } | null;
1005
+ tags?: string[] | undefined;
1006
+ };
1007
+ relationships?: Record<string, unknown> | undefined;
1008
+ links?: Record<string, string> | undefined;
1009
+ meta?: Record<string, unknown> | undefined;
1010
+ }>;
1011
+ included: z.ZodOptional<z.ZodArray<z.ZodObject<{
1012
+ type: z.ZodString;
1013
+ id: z.ZodString;
1014
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1015
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1016
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1017
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1018
+ }, "strip", z.ZodTypeAny, {
1019
+ type: string;
1020
+ id: string;
1021
+ attributes?: Record<string, unknown> | undefined;
1022
+ relationships?: Record<string, unknown> | undefined;
1023
+ links?: Record<string, string> | undefined;
1024
+ meta?: Record<string, unknown> | undefined;
1025
+ }, {
1026
+ type: string;
1027
+ id: string;
1028
+ attributes?: Record<string, unknown> | undefined;
1029
+ relationships?: Record<string, unknown> | undefined;
1030
+ links?: Record<string, string> | undefined;
1031
+ meta?: Record<string, unknown> | undefined;
1032
+ }>, "many">>;
1033
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1034
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1035
+ }, "strip", z.ZodTypeAny, {
1036
+ data: {
1037
+ type: string;
1038
+ id: string;
1039
+ attributes: {
1040
+ type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
1041
+ createdAt: string;
1042
+ updatedAt: string;
1043
+ name: string;
1044
+ description: string | null;
1045
+ farmId: string;
1046
+ category: string | null;
1047
+ fileUrl: string;
1048
+ fileSize: number | null;
1049
+ uploadedDate: string;
1050
+ uploadedBy: string | null;
1051
+ relatedTo: {
1052
+ type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
1053
+ id: string;
1054
+ } | null;
1055
+ tags?: string[] | undefined;
1056
+ };
1057
+ relationships?: Record<string, unknown> | undefined;
1058
+ links?: Record<string, string> | undefined;
1059
+ meta?: Record<string, unknown> | undefined;
1060
+ };
1061
+ links?: Record<string, string> | undefined;
1062
+ meta?: Record<string, unknown> | undefined;
1063
+ included?: {
1064
+ type: string;
1065
+ id: string;
1066
+ attributes?: Record<string, unknown> | undefined;
1067
+ relationships?: Record<string, unknown> | undefined;
1068
+ links?: Record<string, string> | undefined;
1069
+ meta?: Record<string, unknown> | undefined;
1070
+ }[] | undefined;
1071
+ }, {
1072
+ data: {
1073
+ type: string;
1074
+ id: string;
1075
+ attributes: {
1076
+ type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
1077
+ createdAt: string;
1078
+ updatedAt: string;
1079
+ name: string;
1080
+ description: string | null;
1081
+ farmId: string;
1082
+ category: string | null;
1083
+ fileUrl: string;
1084
+ fileSize: number | null;
1085
+ uploadedDate: string;
1086
+ uploadedBy: string | null;
1087
+ relatedTo: {
1088
+ type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
1089
+ id: string;
1090
+ } | null;
1091
+ tags?: string[] | undefined;
1092
+ };
1093
+ relationships?: Record<string, unknown> | undefined;
1094
+ links?: Record<string, string> | undefined;
1095
+ meta?: Record<string, unknown> | undefined;
1096
+ };
1097
+ links?: Record<string, string> | undefined;
1098
+ meta?: Record<string, unknown> | undefined;
1099
+ included?: {
1100
+ type: string;
1101
+ id: string;
1102
+ attributes?: Record<string, unknown> | undefined;
1103
+ relationships?: Record<string, unknown> | undefined;
1104
+ links?: Record<string, string> | undefined;
1105
+ meta?: Record<string, unknown> | undefined;
1106
+ }[] | undefined;
1107
+ }>;
1108
+ 400: z.ZodObject<{
1109
+ errors: z.ZodArray<z.ZodObject<{
1110
+ id: z.ZodOptional<z.ZodString>;
1111
+ links: z.ZodOptional<z.ZodObject<{
1112
+ about: z.ZodOptional<z.ZodString>;
1113
+ }, "strip", z.ZodTypeAny, {
1114
+ about?: string | undefined;
1115
+ }, {
1116
+ about?: string | undefined;
1117
+ }>>;
1118
+ status: z.ZodOptional<z.ZodString>;
1119
+ code: z.ZodOptional<z.ZodString>;
1120
+ title: z.ZodOptional<z.ZodString>;
1121
+ detail: z.ZodOptional<z.ZodString>;
1122
+ source: z.ZodOptional<z.ZodObject<{
1123
+ pointer: z.ZodOptional<z.ZodString>;
1124
+ parameter: z.ZodOptional<z.ZodString>;
1125
+ }, "strip", z.ZodTypeAny, {
1126
+ pointer?: string | undefined;
1127
+ parameter?: string | undefined;
1128
+ }, {
1129
+ pointer?: string | undefined;
1130
+ parameter?: string | undefined;
1131
+ }>>;
1132
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1133
+ }, "strip", z.ZodTypeAny, {
1134
+ status?: string | undefined;
1135
+ code?: string | undefined;
1136
+ id?: string | undefined;
1137
+ links?: {
1138
+ about?: string | undefined;
1139
+ } | undefined;
1140
+ meta?: Record<string, unknown> | undefined;
1141
+ title?: string | undefined;
1142
+ detail?: string | undefined;
1143
+ source?: {
1144
+ pointer?: string | undefined;
1145
+ parameter?: string | undefined;
1146
+ } | undefined;
1147
+ }, {
1148
+ status?: string | undefined;
1149
+ code?: string | undefined;
1150
+ id?: string | undefined;
1151
+ links?: {
1152
+ about?: string | undefined;
1153
+ } | undefined;
1154
+ meta?: Record<string, unknown> | undefined;
1155
+ title?: string | undefined;
1156
+ detail?: string | undefined;
1157
+ source?: {
1158
+ pointer?: string | undefined;
1159
+ parameter?: string | undefined;
1160
+ } | undefined;
1161
+ }>, "many">;
1162
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1163
+ }, "strip", z.ZodTypeAny, {
1164
+ errors: {
1165
+ status?: string | undefined;
1166
+ code?: string | undefined;
1167
+ id?: string | undefined;
1168
+ links?: {
1169
+ about?: string | undefined;
1170
+ } | undefined;
1171
+ meta?: Record<string, unknown> | undefined;
1172
+ title?: string | undefined;
1173
+ detail?: string | undefined;
1174
+ source?: {
1175
+ pointer?: string | undefined;
1176
+ parameter?: string | undefined;
1177
+ } | undefined;
1178
+ }[];
1179
+ meta?: Record<string, unknown> | undefined;
1180
+ }, {
1181
+ errors: {
1182
+ status?: string | undefined;
1183
+ code?: string | undefined;
1184
+ id?: string | undefined;
1185
+ links?: {
1186
+ about?: string | undefined;
1187
+ } | undefined;
1188
+ meta?: Record<string, unknown> | undefined;
1189
+ title?: string | undefined;
1190
+ detail?: string | undefined;
1191
+ source?: {
1192
+ pointer?: string | undefined;
1193
+ parameter?: string | undefined;
1194
+ } | undefined;
1195
+ }[];
1196
+ meta?: Record<string, unknown> | undefined;
1197
+ }>;
1198
+ 404: z.ZodObject<{
1199
+ errors: z.ZodArray<z.ZodObject<{
1200
+ id: z.ZodOptional<z.ZodString>;
1201
+ links: z.ZodOptional<z.ZodObject<{
1202
+ about: z.ZodOptional<z.ZodString>;
1203
+ }, "strip", z.ZodTypeAny, {
1204
+ about?: string | undefined;
1205
+ }, {
1206
+ about?: string | undefined;
1207
+ }>>;
1208
+ status: z.ZodOptional<z.ZodString>;
1209
+ code: z.ZodOptional<z.ZodString>;
1210
+ title: z.ZodOptional<z.ZodString>;
1211
+ detail: z.ZodOptional<z.ZodString>;
1212
+ source: z.ZodOptional<z.ZodObject<{
1213
+ pointer: z.ZodOptional<z.ZodString>;
1214
+ parameter: z.ZodOptional<z.ZodString>;
1215
+ }, "strip", z.ZodTypeAny, {
1216
+ pointer?: string | undefined;
1217
+ parameter?: string | undefined;
1218
+ }, {
1219
+ pointer?: string | undefined;
1220
+ parameter?: string | undefined;
1221
+ }>>;
1222
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1223
+ }, "strip", z.ZodTypeAny, {
1224
+ status?: string | undefined;
1225
+ code?: string | undefined;
1226
+ id?: string | undefined;
1227
+ links?: {
1228
+ about?: string | undefined;
1229
+ } | undefined;
1230
+ meta?: Record<string, unknown> | undefined;
1231
+ title?: string | undefined;
1232
+ detail?: string | undefined;
1233
+ source?: {
1234
+ pointer?: string | undefined;
1235
+ parameter?: string | undefined;
1236
+ } | undefined;
1237
+ }, {
1238
+ status?: string | undefined;
1239
+ code?: string | undefined;
1240
+ id?: string | undefined;
1241
+ links?: {
1242
+ about?: string | undefined;
1243
+ } | undefined;
1244
+ meta?: Record<string, unknown> | undefined;
1245
+ title?: string | undefined;
1246
+ detail?: string | undefined;
1247
+ source?: {
1248
+ pointer?: string | undefined;
1249
+ parameter?: string | undefined;
1250
+ } | undefined;
1251
+ }>, "many">;
1252
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1253
+ }, "strip", z.ZodTypeAny, {
1254
+ errors: {
1255
+ status?: string | undefined;
1256
+ code?: string | undefined;
1257
+ id?: string | undefined;
1258
+ links?: {
1259
+ about?: string | undefined;
1260
+ } | undefined;
1261
+ meta?: Record<string, unknown> | undefined;
1262
+ title?: string | undefined;
1263
+ detail?: string | undefined;
1264
+ source?: {
1265
+ pointer?: string | undefined;
1266
+ parameter?: string | undefined;
1267
+ } | undefined;
1268
+ }[];
1269
+ meta?: Record<string, unknown> | undefined;
1270
+ }, {
1271
+ errors: {
1272
+ status?: string | undefined;
1273
+ code?: string | undefined;
1274
+ id?: string | undefined;
1275
+ links?: {
1276
+ about?: string | undefined;
1277
+ } | undefined;
1278
+ meta?: Record<string, unknown> | undefined;
1279
+ title?: string | undefined;
1280
+ detail?: string | undefined;
1281
+ source?: {
1282
+ pointer?: string | undefined;
1283
+ parameter?: string | undefined;
1284
+ } | undefined;
1285
+ }[];
1286
+ meta?: Record<string, unknown> | undefined;
1287
+ }>;
1288
+ 401: z.ZodObject<{
1289
+ errors: z.ZodArray<z.ZodObject<{
1290
+ id: z.ZodOptional<z.ZodString>;
1291
+ links: z.ZodOptional<z.ZodObject<{
1292
+ about: z.ZodOptional<z.ZodString>;
1293
+ }, "strip", z.ZodTypeAny, {
1294
+ about?: string | undefined;
1295
+ }, {
1296
+ about?: string | undefined;
1297
+ }>>;
1298
+ status: z.ZodOptional<z.ZodString>;
1299
+ code: z.ZodOptional<z.ZodString>;
1300
+ title: z.ZodOptional<z.ZodString>;
1301
+ detail: z.ZodOptional<z.ZodString>;
1302
+ source: z.ZodOptional<z.ZodObject<{
1303
+ pointer: z.ZodOptional<z.ZodString>;
1304
+ parameter: z.ZodOptional<z.ZodString>;
1305
+ }, "strip", z.ZodTypeAny, {
1306
+ pointer?: string | undefined;
1307
+ parameter?: string | undefined;
1308
+ }, {
1309
+ pointer?: string | undefined;
1310
+ parameter?: string | undefined;
1311
+ }>>;
1312
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1313
+ }, "strip", z.ZodTypeAny, {
1314
+ status?: string | undefined;
1315
+ code?: string | undefined;
1316
+ id?: string | undefined;
1317
+ links?: {
1318
+ about?: string | undefined;
1319
+ } | undefined;
1320
+ meta?: Record<string, unknown> | undefined;
1321
+ title?: string | undefined;
1322
+ detail?: string | undefined;
1323
+ source?: {
1324
+ pointer?: string | undefined;
1325
+ parameter?: string | undefined;
1326
+ } | undefined;
1327
+ }, {
1328
+ status?: string | undefined;
1329
+ code?: string | undefined;
1330
+ id?: string | undefined;
1331
+ links?: {
1332
+ about?: string | undefined;
1333
+ } | undefined;
1334
+ meta?: Record<string, unknown> | undefined;
1335
+ title?: string | undefined;
1336
+ detail?: string | undefined;
1337
+ source?: {
1338
+ pointer?: string | undefined;
1339
+ parameter?: string | undefined;
1340
+ } | undefined;
1341
+ }>, "many">;
1342
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1343
+ }, "strip", z.ZodTypeAny, {
1344
+ errors: {
1345
+ status?: string | undefined;
1346
+ code?: string | undefined;
1347
+ id?: string | undefined;
1348
+ links?: {
1349
+ about?: string | undefined;
1350
+ } | undefined;
1351
+ meta?: Record<string, unknown> | undefined;
1352
+ title?: string | undefined;
1353
+ detail?: string | undefined;
1354
+ source?: {
1355
+ pointer?: string | undefined;
1356
+ parameter?: string | undefined;
1357
+ } | undefined;
1358
+ }[];
1359
+ meta?: Record<string, unknown> | undefined;
1360
+ }, {
1361
+ errors: {
1362
+ status?: string | undefined;
1363
+ code?: string | undefined;
1364
+ id?: string | undefined;
1365
+ links?: {
1366
+ about?: string | undefined;
1367
+ } | undefined;
1368
+ meta?: Record<string, unknown> | undefined;
1369
+ title?: string | undefined;
1370
+ detail?: string | undefined;
1371
+ source?: {
1372
+ pointer?: string | undefined;
1373
+ parameter?: string | undefined;
1374
+ } | undefined;
1375
+ }[];
1376
+ meta?: Record<string, unknown> | undefined;
1377
+ }>;
1378
+ };
1379
+ };
868
1380
  createDocument: {
869
1381
  pathParams: z.ZodObject<{
870
1382
  farmId: z.ZodString;
@@ -883,7 +1395,7 @@ export declare const documentsRouter: {
883
1395
  name: z.ZodString;
884
1396
  type: z.ZodEnum<["receipt", "certificate", "land-document", "insurance", "contract", "invoice", "other"]>;
885
1397
  category: z.ZodOptional<z.ZodString>;
886
- fileUrl: z.ZodString;
1398
+ fileUrl: z.ZodOptional<z.ZodString>;
887
1399
  fileSize: z.ZodOptional<z.ZodNumber>;
888
1400
  relatedTo: z.ZodOptional<z.ZodObject<{
889
1401
  type: z.ZodEnum<["farm", "field", "purchase", "expense", "equipment", "other"]>;
@@ -900,9 +1412,9 @@ export declare const documentsRouter: {
900
1412
  }, "strip", z.ZodTypeAny, {
901
1413
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
902
1414
  name: string;
903
- fileUrl: string;
904
1415
  description?: string | undefined;
905
1416
  category?: string | undefined;
1417
+ fileUrl?: string | undefined;
906
1418
  fileSize?: number | undefined;
907
1419
  relatedTo?: {
908
1420
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -912,9 +1424,9 @@ export declare const documentsRouter: {
912
1424
  }, {
913
1425
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
914
1426
  name: string;
915
- fileUrl: string;
916
1427
  description?: string | undefined;
917
1428
  category?: string | undefined;
1429
+ fileUrl?: string | undefined;
918
1430
  fileSize?: number | undefined;
919
1431
  relatedTo?: {
920
1432
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -927,9 +1439,9 @@ export declare const documentsRouter: {
927
1439
  attributes: {
928
1440
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
929
1441
  name: string;
930
- fileUrl: string;
931
1442
  description?: string | undefined;
932
1443
  category?: string | undefined;
1444
+ fileUrl?: string | undefined;
933
1445
  fileSize?: number | undefined;
934
1446
  relatedTo?: {
935
1447
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -942,9 +1454,9 @@ export declare const documentsRouter: {
942
1454
  attributes: {
943
1455
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
944
1456
  name: string;
945
- fileUrl: string;
946
1457
  description?: string | undefined;
947
1458
  category?: string | undefined;
1459
+ fileUrl?: string | undefined;
948
1460
  fileSize?: number | undefined;
949
1461
  relatedTo?: {
950
1462
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -959,9 +1471,9 @@ export declare const documentsRouter: {
959
1471
  attributes: {
960
1472
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
961
1473
  name: string;
962
- fileUrl: string;
963
1474
  description?: string | undefined;
964
1475
  category?: string | undefined;
1476
+ fileUrl?: string | undefined;
965
1477
  fileSize?: number | undefined;
966
1478
  relatedTo?: {
967
1479
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -976,9 +1488,9 @@ export declare const documentsRouter: {
976
1488
  attributes: {
977
1489
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
978
1490
  name: string;
979
- fileUrl: string;
980
1491
  description?: string | undefined;
981
1492
  category?: string | undefined;
1493
+ fileUrl?: string | undefined;
982
1494
  fileSize?: number | undefined;
983
1495
  relatedTo?: {
984
1496
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -2003,6 +2515,8 @@ export declare const documentsRouter: {
2003
2515
  name: z.ZodOptional<z.ZodString>;
2004
2516
  type: z.ZodOptional<z.ZodEnum<["receipt", "certificate", "land-document", "insurance", "contract", "invoice", "other"]>>;
2005
2517
  category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2518
+ fileUrl: z.ZodOptional<z.ZodString>;
2519
+ fileSize: z.ZodOptional<z.ZodNumber>;
2006
2520
  relatedTo: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2007
2521
  type: z.ZodEnum<["farm", "field", "purchase", "expense", "equipment", "other"]>;
2008
2522
  id: z.ZodString;
@@ -2020,6 +2534,8 @@ export declare const documentsRouter: {
2020
2534
  name?: string | undefined;
2021
2535
  description?: string | null | undefined;
2022
2536
  category?: string | null | undefined;
2537
+ fileUrl?: string | undefined;
2538
+ fileSize?: number | undefined;
2023
2539
  relatedTo?: {
2024
2540
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
2025
2541
  id: string;
@@ -2030,6 +2546,8 @@ export declare const documentsRouter: {
2030
2546
  name?: string | undefined;
2031
2547
  description?: string | null | undefined;
2032
2548
  category?: string | null | undefined;
2549
+ fileUrl?: string | undefined;
2550
+ fileSize?: number | undefined;
2033
2551
  relatedTo?: {
2034
2552
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
2035
2553
  id: string;
@@ -2044,6 +2562,8 @@ export declare const documentsRouter: {
2044
2562
  name?: string | undefined;
2045
2563
  description?: string | null | undefined;
2046
2564
  category?: string | null | undefined;
2565
+ fileUrl?: string | undefined;
2566
+ fileSize?: number | undefined;
2047
2567
  relatedTo?: {
2048
2568
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
2049
2569
  id: string;
@@ -2058,6 +2578,8 @@ export declare const documentsRouter: {
2058
2578
  name?: string | undefined;
2059
2579
  description?: string | null | undefined;
2060
2580
  category?: string | null | undefined;
2581
+ fileUrl?: string | undefined;
2582
+ fileSize?: number | undefined;
2061
2583
  relatedTo?: {
2062
2584
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
2063
2585
  id: string;
@@ -2074,6 +2596,8 @@ export declare const documentsRouter: {
2074
2596
  name?: string | undefined;
2075
2597
  description?: string | null | undefined;
2076
2598
  category?: string | null | undefined;
2599
+ fileUrl?: string | undefined;
2600
+ fileSize?: number | undefined;
2077
2601
  relatedTo?: {
2078
2602
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
2079
2603
  id: string;
@@ -2090,6 +2614,8 @@ export declare const documentsRouter: {
2090
2614
  name?: string | undefined;
2091
2615
  description?: string | null | undefined;
2092
2616
  category?: string | null | undefined;
2617
+ fileUrl?: string | undefined;
2618
+ fileSize?: number | undefined;
2093
2619
  relatedTo?: {
2094
2620
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
2095
2621
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"documents.routes.d.ts","sourceRoot":"","sources":["../../src/routes/documents.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8BH,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoI1B,CAAC"}
@@ -29,13 +29,13 @@ exports.documentsRouter = c.router({
29
29
  summary: 'List documents',
30
30
  description: 'Get all documents for a farm with optional filtering',
31
31
  },
32
- // Upload document file
32
+ // Upload document file (standalone - returns fileUrl)
33
33
  uploadDocumentFile: {
34
34
  method: 'POST',
35
35
  path: '/farms/:farmId/documents/upload',
36
36
  contentType: 'multipart/form-data',
37
37
  pathParams: zod_1.z.object({ farmId: zod_1.z.string().uuid() }),
38
- body: c.type(),
38
+ body: documents_schemas_1.uploadFileBodySchema,
39
39
  responses: {
40
40
  200: documents_schemas_1.uploadedFileResponseSchema,
41
41
  400: common_schemas_1.jsonApiErrorResponseSchema,
@@ -45,6 +45,25 @@ exports.documentsRouter = c.router({
45
45
  summary: 'Upload document file',
46
46
  description: 'Upload a file and get back the file URL in JSON:API format',
47
47
  },
48
+ // Upload file to existing document
49
+ uploadFileToDocument: {
50
+ method: 'POST',
51
+ path: '/farms/:farmId/documents/:id/upload',
52
+ contentType: 'multipart/form-data',
53
+ pathParams: zod_1.z.object({
54
+ farmId: zod_1.z.string().uuid(),
55
+ id: zod_1.z.string().uuid(),
56
+ }),
57
+ body: documents_schemas_1.uploadFileBodySchema,
58
+ responses: {
59
+ 200: documents_schemas_1.documentResponseSchema,
60
+ 400: common_schemas_1.jsonApiErrorResponseSchema,
61
+ 404: common_schemas_1.jsonApiErrorResponseSchema,
62
+ 401: common_schemas_1.jsonApiErrorResponseSchema,
63
+ },
64
+ summary: 'Upload file to existing document',
65
+ description: 'Upload a file to an existing document record and update it with the file URL',
66
+ },
48
67
  // Create document
49
68
  createDocument: {
50
69
  method: 'POST',
@@ -77,7 +77,7 @@ export declare const createDocumentAttributesSchema: z.ZodObject<{
77
77
  name: z.ZodString;
78
78
  type: z.ZodEnum<["receipt", "certificate", "land-document", "insurance", "contract", "invoice", "other"]>;
79
79
  category: z.ZodOptional<z.ZodString>;
80
- fileUrl: z.ZodString;
80
+ fileUrl: z.ZodOptional<z.ZodString>;
81
81
  fileSize: z.ZodOptional<z.ZodNumber>;
82
82
  relatedTo: z.ZodOptional<z.ZodObject<{
83
83
  type: z.ZodEnum<["farm", "field", "purchase", "expense", "equipment", "other"]>;
@@ -94,9 +94,9 @@ export declare const createDocumentAttributesSchema: z.ZodObject<{
94
94
  }, "strip", z.ZodTypeAny, {
95
95
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
96
96
  name: string;
97
- fileUrl: string;
98
97
  description?: string | undefined;
99
98
  category?: string | undefined;
99
+ fileUrl?: string | undefined;
100
100
  fileSize?: number | undefined;
101
101
  relatedTo?: {
102
102
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -106,9 +106,9 @@ export declare const createDocumentAttributesSchema: z.ZodObject<{
106
106
  }, {
107
107
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
108
108
  name: string;
109
- fileUrl: string;
110
109
  description?: string | undefined;
111
110
  category?: string | undefined;
111
+ fileUrl?: string | undefined;
112
112
  fileSize?: number | undefined;
113
113
  relatedTo?: {
114
114
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -120,6 +120,8 @@ export declare const updateDocumentAttributesSchema: z.ZodObject<{
120
120
  name: z.ZodOptional<z.ZodString>;
121
121
  type: z.ZodOptional<z.ZodEnum<["receipt", "certificate", "land-document", "insurance", "contract", "invoice", "other"]>>;
122
122
  category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
+ fileUrl: z.ZodOptional<z.ZodString>;
124
+ fileSize: z.ZodOptional<z.ZodNumber>;
123
125
  relatedTo: z.ZodOptional<z.ZodNullable<z.ZodObject<{
124
126
  type: z.ZodEnum<["farm", "field", "purchase", "expense", "equipment", "other"]>;
125
127
  id: z.ZodString;
@@ -137,6 +139,8 @@ export declare const updateDocumentAttributesSchema: z.ZodObject<{
137
139
  name?: string | undefined;
138
140
  description?: string | null | undefined;
139
141
  category?: string | null | undefined;
142
+ fileUrl?: string | undefined;
143
+ fileSize?: number | undefined;
140
144
  relatedTo?: {
141
145
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
142
146
  id: string;
@@ -147,6 +151,8 @@ export declare const updateDocumentAttributesSchema: z.ZodObject<{
147
151
  name?: string | undefined;
148
152
  description?: string | null | undefined;
149
153
  category?: string | null | undefined;
154
+ fileUrl?: string | undefined;
155
+ fileSize?: number | undefined;
150
156
  relatedTo?: {
151
157
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
152
158
  id: string;
@@ -159,7 +165,7 @@ export declare const createDocumentSchema: z.ZodObject<{
159
165
  name: z.ZodString;
160
166
  type: z.ZodEnum<["receipt", "certificate", "land-document", "insurance", "contract", "invoice", "other"]>;
161
167
  category: z.ZodOptional<z.ZodString>;
162
- fileUrl: z.ZodString;
168
+ fileUrl: z.ZodOptional<z.ZodString>;
163
169
  fileSize: z.ZodOptional<z.ZodNumber>;
164
170
  relatedTo: z.ZodOptional<z.ZodObject<{
165
171
  type: z.ZodEnum<["farm", "field", "purchase", "expense", "equipment", "other"]>;
@@ -176,9 +182,9 @@ export declare const createDocumentSchema: z.ZodObject<{
176
182
  }, "strip", z.ZodTypeAny, {
177
183
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
178
184
  name: string;
179
- fileUrl: string;
180
185
  description?: string | undefined;
181
186
  category?: string | undefined;
187
+ fileUrl?: string | undefined;
182
188
  fileSize?: number | undefined;
183
189
  relatedTo?: {
184
190
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -188,9 +194,9 @@ export declare const createDocumentSchema: z.ZodObject<{
188
194
  }, {
189
195
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
190
196
  name: string;
191
- fileUrl: string;
192
197
  description?: string | undefined;
193
198
  category?: string | undefined;
199
+ fileUrl?: string | undefined;
194
200
  fileSize?: number | undefined;
195
201
  relatedTo?: {
196
202
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -203,9 +209,9 @@ export declare const createDocumentSchema: z.ZodObject<{
203
209
  attributes: {
204
210
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
205
211
  name: string;
206
- fileUrl: string;
207
212
  description?: string | undefined;
208
213
  category?: string | undefined;
214
+ fileUrl?: string | undefined;
209
215
  fileSize?: number | undefined;
210
216
  relatedTo?: {
211
217
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -218,9 +224,9 @@ export declare const createDocumentSchema: z.ZodObject<{
218
224
  attributes: {
219
225
  type: "other" | "receipt" | "certificate" | "land-document" | "insurance" | "contract" | "invoice";
220
226
  name: string;
221
- fileUrl: string;
222
227
  description?: string | undefined;
223
228
  category?: string | undefined;
229
+ fileUrl?: string | undefined;
224
230
  fileSize?: number | undefined;
225
231
  relatedTo?: {
226
232
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
@@ -236,6 +242,8 @@ export declare const updateDocumentSchema: z.ZodObject<{
236
242
  name: z.ZodOptional<z.ZodString>;
237
243
  type: z.ZodOptional<z.ZodEnum<["receipt", "certificate", "land-document", "insurance", "contract", "invoice", "other"]>>;
238
244
  category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
245
+ fileUrl: z.ZodOptional<z.ZodString>;
246
+ fileSize: z.ZodOptional<z.ZodNumber>;
239
247
  relatedTo: z.ZodOptional<z.ZodNullable<z.ZodObject<{
240
248
  type: z.ZodEnum<["farm", "field", "purchase", "expense", "equipment", "other"]>;
241
249
  id: z.ZodString;
@@ -253,6 +261,8 @@ export declare const updateDocumentSchema: z.ZodObject<{
253
261
  name?: string | undefined;
254
262
  description?: string | null | undefined;
255
263
  category?: string | null | undefined;
264
+ fileUrl?: string | undefined;
265
+ fileSize?: number | undefined;
256
266
  relatedTo?: {
257
267
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
258
268
  id: string;
@@ -263,6 +273,8 @@ export declare const updateDocumentSchema: z.ZodObject<{
263
273
  name?: string | undefined;
264
274
  description?: string | null | undefined;
265
275
  category?: string | null | undefined;
276
+ fileUrl?: string | undefined;
277
+ fileSize?: number | undefined;
266
278
  relatedTo?: {
267
279
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
268
280
  id: string;
@@ -277,6 +289,8 @@ export declare const updateDocumentSchema: z.ZodObject<{
277
289
  name?: string | undefined;
278
290
  description?: string | null | undefined;
279
291
  category?: string | null | undefined;
292
+ fileUrl?: string | undefined;
293
+ fileSize?: number | undefined;
280
294
  relatedTo?: {
281
295
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
282
296
  id: string;
@@ -291,6 +305,8 @@ export declare const updateDocumentSchema: z.ZodObject<{
291
305
  name?: string | undefined;
292
306
  description?: string | null | undefined;
293
307
  category?: string | null | undefined;
308
+ fileUrl?: string | undefined;
309
+ fileSize?: number | undefined;
294
310
  relatedTo?: {
295
311
  type: "farm" | "field" | "other" | "equipment" | "purchase" | "expense";
296
312
  id: string;
@@ -1035,6 +1051,13 @@ export declare const uploadedFileResponseSchema: z.ZodObject<{
1035
1051
  meta?: Record<string, unknown> | undefined;
1036
1052
  }[] | undefined;
1037
1053
  }>;
1054
+ export declare const uploadFileBodySchema: z.ZodObject<{
1055
+ file: z.ZodType<import("buffer").File, z.ZodTypeDef, import("buffer").File>;
1056
+ }, "strip", z.ZodTypeAny, {
1057
+ file: import("buffer").File;
1058
+ }, {
1059
+ file: import("buffer").File;
1060
+ }>;
1038
1061
  export type DocumentType = z.infer<typeof documentTypeSchema>;
1039
1062
  export type RelatedEntityType = z.infer<typeof relatedEntityTypeSchema>;
1040
1063
  export type RelatedEntity = z.infer<typeof relatedEntitySchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"documents.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/documents.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;GAEG;AAGH,eAAO,MAAM,kBAAkB,qGAQ7B,CAAC;AAGH,eAAO,MAAM,uBAAuB,2EAAyE,CAAC;AAG9G,eAAO,MAAM,mBAAmB;;;;;;;;;EAG9B,CAAC;AAGH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYX,CAAC;AAG3B,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASzC,CAAC;AAGH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOzC,CAAC;AAGH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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G,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uploadedFileResponseSchema = exports.uploadedFileResourceSchema = exports.uploadedFileAttributesSchema = exports.documentListResponseSchema = exports.documentResponseSchema = exports.documentResourceSchema = exports.updateDocumentSchema = exports.createDocumentSchema = exports.updateDocumentAttributesSchema = exports.createDocumentAttributesSchema = exports.documentAttributesSchema = exports.relatedEntitySchema = exports.relatedEntityTypeSchema = exports.documentTypeSchema = void 0;
3
+ exports.uploadFileBodySchema = exports.uploadedFileResponseSchema = exports.uploadedFileResourceSchema = exports.uploadedFileAttributesSchema = exports.documentListResponseSchema = exports.documentResponseSchema = exports.documentResourceSchema = exports.updateDocumentSchema = exports.createDocumentSchema = exports.updateDocumentAttributesSchema = exports.createDocumentAttributesSchema = exports.documentAttributesSchema = exports.relatedEntitySchema = exports.relatedEntityTypeSchema = exports.documentTypeSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const common_schemas_1 = require("./common.schemas");
6
6
  /**
@@ -42,7 +42,7 @@ exports.createDocumentAttributesSchema = zod_1.z.object({
42
42
  name: zod_1.z.string().min(1).max(200),
43
43
  type: exports.documentTypeSchema,
44
44
  category: zod_1.z.string().optional(),
45
- fileUrl: zod_1.z.string().url(), // URL to uploaded file
45
+ fileUrl: zod_1.z.string().url().optional(), // URL to uploaded file (optional - can be set after upload)
46
46
  fileSize: zod_1.z.number().int().positive().optional(), // in bytes
47
47
  relatedTo: exports.relatedEntitySchema.optional(),
48
48
  tags: zod_1.z.array(zod_1.z.string()).optional(),
@@ -53,6 +53,8 @@ exports.updateDocumentAttributesSchema = zod_1.z.object({
53
53
  name: zod_1.z.string().min(1).max(200).optional(),
54
54
  type: exports.documentTypeSchema.optional(),
55
55
  category: zod_1.z.string().nullable().optional(),
56
+ fileUrl: zod_1.z.string().url().optional(), // URL to uploaded file (can be updated after upload)
57
+ fileSize: zod_1.z.number().int().positive().optional(), // in bytes
56
58
  relatedTo: exports.relatedEntitySchema.nullable().optional(),
57
59
  tags: zod_1.z.array(zod_1.z.string()).optional(),
58
60
  description: zod_1.z.string().nullable().optional(),
@@ -82,3 +84,6 @@ exports.uploadedFileAttributesSchema = zod_1.z.object({
82
84
  });
83
85
  exports.uploadedFileResourceSchema = (0, common_schemas_1.createJsonApiResourceSchema)('uploaded-files', exports.uploadedFileAttributesSchema);
84
86
  exports.uploadedFileResponseSchema = (0, common_schemas_1.jsonApiSingleResponseSchema)(exports.uploadedFileResourceSchema);
87
+ exports.uploadFileBodySchema = zod_1.z.object({
88
+ file: zod_1.z.instanceof(File),
89
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepintel-ltd/farmpro-contracts",
3
- "version": "1.3.4",
3
+ "version": "1.4.1",
4
4
  "description": "Type-safe API contracts for FarmPro API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",