karrio-server-graph 2026.1.1__py3-none-any.whl → 2026.1.4__py3-none-any.whl
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.
- karrio/server/graph/migrations/0003_remove_template_customs.py +15 -0
- karrio/server/graph/models.py +2 -5
- karrio/server/graph/schemas/base/__init__.py +68 -48
- karrio/server/graph/schemas/base/inputs.py +286 -71
- karrio/server/graph/schemas/base/mutations.py +365 -84
- karrio/server/graph/schemas/base/types.py +940 -248
- karrio/server/graph/serializers.py +35 -60
- karrio/server/graph/tests/base.py +33 -6
- karrio/server/graph/tests/test_carrier_connections.py +33 -4
- karrio/server/graph/tests/test_pickups.py +333 -0
- karrio/server/graph/tests/test_rate_sheets.py +0 -1
- karrio/server/graph/tests/test_templates.py +328 -510
- karrio/server/graph/utils.py +68 -1
- {karrio_server_graph-2026.1.1.dist-info → karrio_server_graph-2026.1.4.dist-info}/METADATA +1 -1
- {karrio_server_graph-2026.1.1.dist-info → karrio_server_graph-2026.1.4.dist-info}/RECORD +17 -15
- {karrio_server_graph-2026.1.1.dist-info → karrio_server_graph-2026.1.4.dist-info}/WHEEL +1 -1
- {karrio_server_graph-2026.1.1.dist-info → karrio_server_graph-2026.1.4.dist-info}/top_level.txt +0 -0
karrio/server/graph/models.py
CHANGED
|
@@ -2,7 +2,7 @@ from django.conf import settings
|
|
|
2
2
|
from django.db import models
|
|
3
3
|
|
|
4
4
|
from karrio.server.core.models import OwnedEntity, uuid, register_model
|
|
5
|
-
from karrio.server.manager.models import
|
|
5
|
+
from karrio.server.manager.models import Parcel, Address
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
@register_model
|
|
@@ -20,9 +20,6 @@ class Template(OwnedEntity):
|
|
|
20
20
|
address = models.OneToOneField(
|
|
21
21
|
Address, on_delete=models.CASCADE, null=True, blank=True
|
|
22
22
|
)
|
|
23
|
-
customs = models.OneToOneField(
|
|
24
|
-
Customs, on_delete=models.CASCADE, null=True, blank=True
|
|
25
|
-
)
|
|
26
23
|
parcel = models.OneToOneField(
|
|
27
24
|
Parcel, on_delete=models.CASCADE, null=True, blank=True
|
|
28
25
|
)
|
|
@@ -31,7 +28,7 @@ class Template(OwnedEntity):
|
|
|
31
28
|
attachment = next(
|
|
32
29
|
(
|
|
33
30
|
entity
|
|
34
|
-
for entity in [self.address, self.
|
|
31
|
+
for entity in [self.address, self.parcel]
|
|
35
32
|
if entity is not None
|
|
36
33
|
),
|
|
37
34
|
super(),
|
|
@@ -38,16 +38,25 @@ class Query:
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
default_templates: types.DefaultTemplatesType = strawberry.field(
|
|
41
|
-
resolver=types.
|
|
41
|
+
resolver=types.resolve_default_templates
|
|
42
42
|
)
|
|
43
|
-
|
|
44
|
-
resolver=types.
|
|
43
|
+
addresses: utils.Connection[types.AddressTemplateType] = strawberry.field(
|
|
44
|
+
resolver=types.resolve_addresses
|
|
45
45
|
)
|
|
46
|
-
|
|
47
|
-
resolver=types.
|
|
46
|
+
address: typing.Optional[types.AddressTemplateType] = strawberry.field(
|
|
47
|
+
resolver=types.resolve_address
|
|
48
48
|
)
|
|
49
|
-
|
|
50
|
-
resolver=types.
|
|
49
|
+
parcels: utils.Connection[types.ParcelTemplateType] = strawberry.field(
|
|
50
|
+
resolver=types.resolve_parcels
|
|
51
|
+
)
|
|
52
|
+
parcel: typing.Optional[types.ParcelTemplateType] = strawberry.field(
|
|
53
|
+
resolver=types.resolve_parcel
|
|
54
|
+
)
|
|
55
|
+
products: utils.Connection[types.ProductTemplateType] = strawberry.field(
|
|
56
|
+
resolver=types.resolve_products
|
|
57
|
+
)
|
|
58
|
+
product: typing.Optional[types.ProductTemplateType] = strawberry.field(
|
|
59
|
+
resolver=types.resolve_product
|
|
51
60
|
)
|
|
52
61
|
|
|
53
62
|
log: typing.Optional[types.LogType] = strawberry.field(
|
|
@@ -92,6 +101,13 @@ class Query:
|
|
|
92
101
|
resolver=types.ManifestType.resolve_list
|
|
93
102
|
)
|
|
94
103
|
|
|
104
|
+
pickup: typing.Optional[types.PickupType] = strawberry.field(
|
|
105
|
+
resolver=types.PickupType.resolve
|
|
106
|
+
)
|
|
107
|
+
pickups: utils.Connection[types.PickupType] = strawberry.field(
|
|
108
|
+
resolver=types.PickupType.resolve_list
|
|
109
|
+
)
|
|
110
|
+
|
|
95
111
|
carrier_connection: typing.Optional[types.CarrierConnectionType] = strawberry.field(
|
|
96
112
|
resolver=types.CarrierConnectionType.resolve
|
|
97
113
|
)
|
|
@@ -200,40 +216,51 @@ class Mutation:
|
|
|
200
216
|
return mutations.DisableMultiFactorMutation.mutate(info, **input.to_dict())
|
|
201
217
|
|
|
202
218
|
@strawberry.mutation
|
|
203
|
-
def
|
|
204
|
-
self, info: Info, input: inputs.
|
|
205
|
-
) -> mutations.
|
|
206
|
-
return mutations.
|
|
219
|
+
def create_address(
|
|
220
|
+
self, info: Info, input: inputs.CreateAddressInput
|
|
221
|
+
) -> mutations.CreateAddressMutation:
|
|
222
|
+
return mutations.CreateAddressMutation.mutate(info, **input.to_dict())
|
|
223
|
+
|
|
224
|
+
@strawberry.mutation
|
|
225
|
+
def update_address(
|
|
226
|
+
self, info: Info, input: inputs.UpdateAddressInput
|
|
227
|
+
) -> mutations.UpdateAddressMutation:
|
|
228
|
+
return mutations.UpdateAddressMutation.mutate(info, **input.to_dict())
|
|
207
229
|
|
|
208
230
|
@strawberry.mutation
|
|
209
|
-
def
|
|
210
|
-
self, info: Info, input: inputs.
|
|
211
|
-
) -> mutations.
|
|
212
|
-
return mutations.
|
|
231
|
+
def create_parcel(
|
|
232
|
+
self, info: Info, input: inputs.CreateParcelInput
|
|
233
|
+
) -> mutations.CreateParcelMutation:
|
|
234
|
+
return mutations.CreateParcelMutation.mutate(info, **input.to_dict())
|
|
213
235
|
|
|
214
236
|
@strawberry.mutation
|
|
215
|
-
def
|
|
216
|
-
self, info: Info, input: inputs.
|
|
217
|
-
) -> mutations.
|
|
218
|
-
return mutations.
|
|
237
|
+
def update_parcel(
|
|
238
|
+
self, info: Info, input: inputs.UpdateParcelInput
|
|
239
|
+
) -> mutations.UpdateParcelMutation:
|
|
240
|
+
return mutations.UpdateParcelMutation.mutate(info, **input.to_dict())
|
|
219
241
|
|
|
220
242
|
@strawberry.mutation
|
|
221
|
-
def
|
|
222
|
-
self, info: Info, input: inputs.
|
|
223
|
-
) -> mutations.
|
|
224
|
-
return mutations.
|
|
243
|
+
def create_product(
|
|
244
|
+
self, info: Info, input: inputs.CreateProductInput
|
|
245
|
+
) -> mutations.CreateProductMutation:
|
|
246
|
+
return mutations.CreateProductMutation.mutate(info, **input.to_dict())
|
|
225
247
|
|
|
226
248
|
@strawberry.mutation
|
|
227
|
-
def
|
|
228
|
-
self, info: Info, input: inputs.
|
|
229
|
-
) -> mutations.
|
|
230
|
-
return mutations.
|
|
249
|
+
def update_product(
|
|
250
|
+
self, info: Info, input: inputs.UpdateProductInput
|
|
251
|
+
) -> mutations.UpdateProductMutation:
|
|
252
|
+
return mutations.UpdateProductMutation.mutate(info, **input.to_dict())
|
|
231
253
|
|
|
232
254
|
@strawberry.mutation
|
|
233
|
-
def
|
|
234
|
-
self, info: Info, input: inputs.
|
|
235
|
-
) -> mutations.
|
|
236
|
-
return mutations.
|
|
255
|
+
def delete_product(
|
|
256
|
+
self, info: Info, input: inputs.DeleteMutationInput
|
|
257
|
+
) -> mutations.DeleteMutation:
|
|
258
|
+
return mutations.DeleteMutation.mutate(
|
|
259
|
+
info,
|
|
260
|
+
model=manager.Commodity,
|
|
261
|
+
validator=manager_serializers.can_mutate_commodity,
|
|
262
|
+
**input.to_dict()
|
|
263
|
+
)
|
|
237
264
|
|
|
238
265
|
@strawberry.mutation
|
|
239
266
|
def create_carrier_connection(
|
|
@@ -258,7 +285,7 @@ class Mutation:
|
|
|
258
285
|
self, info: Info, input: inputs.DeleteMutationInput
|
|
259
286
|
) -> mutations.DeleteMutation:
|
|
260
287
|
return mutations.DeleteMutation.mutate(
|
|
261
|
-
info, model=providers.
|
|
288
|
+
info, model=providers.CarrierConnection, **input.to_dict()
|
|
262
289
|
)
|
|
263
290
|
|
|
264
291
|
@strawberry.mutation
|
|
@@ -280,32 +307,25 @@ class Mutation:
|
|
|
280
307
|
return mutations.ChangeShipmentStatusMutation.mutate(info, **input.to_dict())
|
|
281
308
|
|
|
282
309
|
@strawberry.mutation
|
|
283
|
-
def
|
|
310
|
+
def delete_address(
|
|
284
311
|
self, info: Info, input: inputs.DeleteMutationInput
|
|
285
|
-
) -> mutations.
|
|
286
|
-
return mutations.
|
|
287
|
-
info, model=graph.Template, **input.to_dict()
|
|
288
|
-
)
|
|
312
|
+
) -> mutations.DeleteAddressMutation:
|
|
313
|
+
return mutations.DeleteAddressMutation.mutate(info, **input.to_dict())
|
|
289
314
|
|
|
290
315
|
@strawberry.mutation
|
|
291
|
-
def
|
|
316
|
+
def delete_parcel(
|
|
292
317
|
self, info: Info, input: inputs.DeleteMutationInput
|
|
293
|
-
) -> mutations.
|
|
294
|
-
return mutations.
|
|
295
|
-
info,
|
|
296
|
-
model=manager.Commodity,
|
|
297
|
-
validator=manager_serializers.can_mutate_commodity,
|
|
298
|
-
**input.to_dict()
|
|
299
|
-
)
|
|
318
|
+
) -> mutations.DeleteParcelMutation:
|
|
319
|
+
return mutations.DeleteParcelMutation.mutate(info, **input.to_dict())
|
|
300
320
|
|
|
301
321
|
@strawberry.mutation
|
|
302
|
-
def
|
|
322
|
+
def discard_commodity(
|
|
303
323
|
self, info: Info, input: inputs.DeleteMutationInput
|
|
304
324
|
) -> mutations.DeleteMutation:
|
|
305
325
|
return mutations.DeleteMutation.mutate(
|
|
306
326
|
info,
|
|
307
|
-
model=manager.
|
|
308
|
-
validator=manager_serializers.
|
|
327
|
+
model=manager.Commodity,
|
|
328
|
+
validator=manager_serializers.can_mutate_commodity,
|
|
309
329
|
**input.to_dict()
|
|
310
330
|
)
|
|
311
331
|
|