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.
@@ -0,0 +1,15 @@
1
+ from django.db import migrations
2
+
3
+
4
+ class Migration(migrations.Migration):
5
+
6
+ dependencies = [
7
+ ("graph", "0002_auto_20210512_1353"),
8
+ ]
9
+
10
+ operations = [
11
+ migrations.RemoveField(
12
+ model_name="template",
13
+ name="customs",
14
+ ),
15
+ ]
@@ -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 Customs, Parcel, Address
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.customs, self.parcel]
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.DefaultTemplatesType.resolve
41
+ resolver=types.resolve_default_templates
42
42
  )
43
- address_templates: utils.Connection[types.AddressTemplateType] = strawberry.field(
44
- resolver=types.AddressTemplateType.resolve_list
43
+ addresses: utils.Connection[types.AddressTemplateType] = strawberry.field(
44
+ resolver=types.resolve_addresses
45
45
  )
46
- customs_templates: utils.Connection[types.CustomsTemplateType] = strawberry.field(
47
- resolver=types.CustomsTemplateType.resolve_list
46
+ address: typing.Optional[types.AddressTemplateType] = strawberry.field(
47
+ resolver=types.resolve_address
48
48
  )
49
- parcel_templates: utils.Connection[types.ParcelTemplateType] = strawberry.field(
50
- resolver=types.ParcelTemplateType.resolve_list
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 create_address_template(
204
- self, info: Info, input: inputs.CreateAddressTemplateInput
205
- ) -> mutations.CreateAddressTemplateMutation:
206
- return mutations.CreateAddressTemplateMutation.mutate(info, **input.to_dict())
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 update_address_template(
210
- self, info: Info, input: inputs.UpdateAddressTemplateInput
211
- ) -> mutations.UpdateAddressTemplateMutation:
212
- return mutations.UpdateAddressTemplateMutation.mutate(info, **input.to_dict())
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 create_customs_template(
216
- self, info: Info, input: inputs.CreateCustomsTemplateInput
217
- ) -> mutations.CreateCustomsTemplateMutation:
218
- return mutations.CreateCustomsTemplateMutation.mutate(info, **input.to_dict())
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 update_customs_template(
222
- self, info: Info, input: inputs.UpdateCustomsTemplateInput
223
- ) -> mutations.UpdateCustomsTemplateMutation:
224
- return mutations.UpdateCustomsTemplateMutation.mutate(info, **input.to_dict())
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 create_parcel_template(
228
- self, info: Info, input: inputs.CreateParcelTemplateInput
229
- ) -> mutations.CreateParcelTemplateMutation:
230
- return mutations.CreateParcelTemplateMutation.mutate(info, **input.to_dict())
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 update_parcel_template(
234
- self, info: Info, input: inputs.UpdateParcelTemplateInput
235
- ) -> mutations.UpdateParcelTemplateMutation:
236
- return mutations.UpdateParcelTemplateMutation.mutate(info, **input.to_dict())
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.Carrier, **input.to_dict()
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 delete_template(
310
+ def delete_address(
284
311
  self, info: Info, input: inputs.DeleteMutationInput
285
- ) -> mutations.DeleteMutation:
286
- return mutations.DeleteMutation.mutate(
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 discard_commodity(
316
+ def delete_parcel(
292
317
  self, info: Info, input: inputs.DeleteMutationInput
293
- ) -> mutations.DeleteMutation:
294
- return mutations.DeleteMutation.mutate(
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 discard_customs(
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.Customs,
308
- validator=manager_serializers.can_mutate_customs,
327
+ model=manager.Commodity,
328
+ validator=manager_serializers.can_mutate_commodity,
309
329
  **input.to_dict()
310
330
  )
311
331