xync-schema 0.6.63__py3-none-any.whl → 0.6.67__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.
xync_schema/models.py CHANGED
@@ -1,3 +1,4 @@
1
+ import sys
1
2
  from datetime import datetime
2
3
  from tortoise import fields
3
4
  from tortoise.queryset import QuerySet
@@ -82,8 +83,6 @@ class Ex(Model):
82
83
  include = "name", "logo"
83
84
 
84
85
  def client(self):
85
- import sys
86
-
87
86
  module_name = f"xync_client.{self.name}.ex"
88
87
  __import__(module_name)
89
88
  client = sys.modules[module_name].ExClient
@@ -94,7 +93,6 @@ class Curex(BaseModel):
94
93
  cur: fields.ForeignKeyRelation[Cur] = fields.ForeignKeyField("models.Cur")
95
94
  ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex")
96
95
  exid: str = fields.CharField(31)
97
- p2p: bool = fields.BooleanField(default=True)
98
96
  # countries: fields.ManyToManyRelation[Country] = fields.ManyToManyField(
99
97
  # "models.Country", through="curexcountry", backward_key="curexs"
100
98
  # )
@@ -215,8 +213,6 @@ class Agent(Model):
215
213
  computed = ["balance"]
216
214
 
217
215
  def client(self):
218
- import sys
219
-
220
216
  module_name = f"xync_client.{self.ex.name}.agent"
221
217
  __import__(module_name)
222
218
  client = sys.modules[module_name].AgentClient
@@ -231,8 +227,6 @@ class Agent(Model):
231
227
  # return client(self)
232
228
 
233
229
  def asset_client(self):
234
- import sys
235
-
236
230
  module_name = f"xync_client.{self.ex.name}.asset"
237
231
  __import__(module_name)
238
232
  client = sys.modules[module_name].AssetClient
@@ -270,6 +264,11 @@ class Ad(Model, TsTrait):
270
264
  class Meta:
271
265
  table_description = "P2P Advertisements"
272
266
 
267
+ def epyd(self):
268
+ module_name = f"xync_client.{self.ex.name}.pyd"
269
+ __import__(module_name)
270
+ return sys.modules[module_name].AdEpyd
271
+
273
272
 
274
273
  class Pm(Model):
275
274
  name: str = fields.CharField(63, unique=True)
@@ -293,6 +292,11 @@ class Pm(Model):
293
292
  # backward_relations = True
294
293
  # include = "id", "name", "logo", "pmexs__sbp"
295
294
 
295
+ # def epyd(self):
296
+ # module_name = f"xync_client.{self.ex.name}.pyd"
297
+ # __import__(module_name)
298
+ # return sys.modules[module_name].PmEpyd
299
+
296
300
 
297
301
  class Pmcur(Model): # for fiat with no exs tie
298
302
  pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm")
@@ -319,7 +323,8 @@ class Pmex(BaseModel): # existence pm in ex with no cur tie
319
323
  ex_id: int
320
324
  exid: str = fields.CharField(63)
321
325
  name: str = fields.CharField(63)
322
- sbp: str = fields.BooleanField(default=False)
326
+
327
+ banks: fields.BackwardFKRelation["PmexBank"]
323
328
 
324
329
  class Meta:
325
330
  unique_together = (("ex_id", "exid"),)
@@ -335,6 +340,16 @@ class PmexBank(BaseModel): # banks for SBP
335
340
  unique_together = (("pmex", "exid"),)
336
341
 
337
342
 
343
+ class FiatBank(BaseModel): # banks for SBP
344
+ pmexbank: fields.ForeignKeyRelation[PmexBank] = fields.ForeignKeyField("models.PmexBank", "fiatbanks")
345
+ pmexbank_id: int
346
+ fiat: fields.ForeignKeyRelation["Fiat"] = fields.ForeignKeyField("models.Fiat", "fiatbanks")
347
+ fiat_id: int
348
+
349
+ class Meta:
350
+ unique_together = (("fiat_id", "pmexbank_id"),)
351
+
352
+
338
353
  class Pmcurex(BaseModel): # existence pm in ex for exact cur, with "blocked" flag
339
354
  pmcur: fields.ForeignKeyRelation[Pmcur] = fields.ForeignKeyField("models.Pmcur")
340
355
  pmcur_id: int
@@ -371,7 +386,11 @@ class Fiat(Model):
371
386
  backward_relations = False
372
387
  include = "id", "pmcur", "detail", "name", "amount"
373
388
 
374
- # # exclude_raw_fields = True
389
+ @staticmethod
390
+ def epyd(ex: Ex):
391
+ module_name = f"xync_client.{ex.name}.pyd"
392
+ __import__(module_name)
393
+ return sys.modules[module_name].FiatEpyd
375
394
 
376
395
 
377
396
  class Fiatex(BaseModel): # existence pm in ex with no cur tie
@@ -424,6 +443,11 @@ class Asset(Model):
424
443
  class PydanticMeta(Model.PydanticMeta):
425
444
  max_recursion: int = 2 # default: 3
426
445
 
446
+ def epyd(self):
447
+ module_name = f"xync_client.{self.agent.ex.name}.pyd"
448
+ __import__(module_name)
449
+ return sys.modules[module_name].AssetEpyd
450
+
427
451
 
428
452
  class Order(Model):
429
453
  id: int = fields.BigIntField(True)
@@ -450,8 +474,6 @@ class Order(Model):
450
474
  return f"{self.fiat.pmcur.pm.name}/{self.fiat_id}:{self.amount:.3g} {self.status.name}"
451
475
 
452
476
  async def client(self):
453
- import sys
454
-
455
477
  if isinstance(self.ad, QuerySet):
456
478
  # noinspection PyTypeChecker
457
479
  self.ad: Ad = await self.ad.prefetch_related("agent__ex")
@@ -464,6 +486,11 @@ class Order(Model):
464
486
  client = sys.modules[f"xync_client.{self.ad.agent.ex.name}.order"].Client
465
487
  return client(self)
466
488
 
489
+ # def epyd(self): # todo: for who?
490
+ # module_name = f"xync_client.{self.ex.name}.pyd"
491
+ # __import__(module_name)
492
+ # return sys.modules[module_name].OrderEpyd
493
+
467
494
  class Meta:
468
495
  table_description = "P2P Orders"
469
496
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xync-schema
3
- Version: 0.6.63
3
+ Version: 0.6.67
4
4
  Summary: XyncNet project database model schema
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: EULA
@@ -0,0 +1,8 @@
1
+ xync_schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ xync_schema/enums.py,sha256=la85coRbxXL0HiAgJYpOU4Yyf_atVp6DZSlAV3ICvEk,12207
3
+ xync_schema/models.py,sha256=rPvWqAMNl0JdEXTGhpcNHQEekPhQp1wGMgtEbETYznE,24141
4
+ xync_schema/pydantic.py,sha256=7uTAqoN3WT1w9RByyBwn78FOkD3nfO9b3UGnR-DWAro,794
5
+ xync_schema-0.6.67.dist-info/METADATA,sha256=Ij-gJ-Zixk-pfBRayN2JraYYQ45dwxGpe5YrK1x8OAA,3985
6
+ xync_schema-0.6.67.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
+ xync_schema-0.6.67.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
8
+ xync_schema-0.6.67.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- xync_schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- xync_schema/enums.py,sha256=la85coRbxXL0HiAgJYpOU4Yyf_atVp6DZSlAV3ICvEk,12207
3
- xync_schema/models.py,sha256=2yDjPwOzd7FSE429mM0fEEWcKytNCryy7hDi2k0Ni7o,23095
4
- xync_schema/pydantic.py,sha256=7uTAqoN3WT1w9RByyBwn78FOkD3nfO9b3UGnR-DWAro,794
5
- xync_schema-0.6.63.dist-info/METADATA,sha256=HHDZcpbwTcPsTymsiDQFLuQUfeWzFE9kcpAwjNBHzE4,3985
6
- xync_schema-0.6.63.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
- xync_schema-0.6.63.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
8
- xync_schema-0.6.63.dist-info/RECORD,,