xync-schema 0.6.43__tar.gz → 0.6.44__tar.gz
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-0.6.43/xync_schema.egg-info → xync_schema-0.6.44}/PKG-INFO +1 -1
- {xync_schema-0.6.43 → xync_schema-0.6.44}/xync_schema/enums.py +13 -7
- {xync_schema-0.6.43 → xync_schema-0.6.44}/xync_schema/models.py +25 -9
- {xync_schema-0.6.43 → xync_schema-0.6.44/xync_schema.egg-info}/PKG-INFO +1 -1
- {xync_schema-0.6.43 → xync_schema-0.6.44}/.env.sample +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/.gitignore +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/.pre-commit-config.yaml +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/README.md +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/makefile +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/pyproject.toml +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/setup.cfg +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/tests/__init__.py +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/tests/test_db.py +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/xync_schema/__init__.py +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/xync_schema/pydantic.py +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/xync_schema.egg-info/SOURCES.txt +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/xync_schema.egg-info/dependency_links.txt +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/xync_schema.egg-info/requires.txt +0 -0
- {xync_schema-0.6.43 → xync_schema-0.6.44}/xync_schema.egg-info/top_level.txt +0 -0
|
@@ -11,14 +11,20 @@ class AdStatus(IntEnum):
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class OrderStatus(IntEnum):
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
fifth = 5
|
|
14
|
+
requested = 1
|
|
15
|
+
request_canceled = 2
|
|
16
|
+
created = 3
|
|
17
|
+
rejected = 4
|
|
18
|
+
paid = 5
|
|
20
19
|
canceled = 6
|
|
21
|
-
|
|
20
|
+
completed = 7
|
|
21
|
+
appealed_by_seller = 9
|
|
22
|
+
appealed_by_buyer = 10
|
|
23
|
+
seller_appeal_disputed_by_buyer = 11
|
|
24
|
+
buyer_appeal_disputed_by_seller = 12
|
|
25
|
+
appeal_canceled = 15
|
|
26
|
+
# todo: 8T - один вирт экшн на бездействие обеих сторон, а 12T и 13T - по отдельности?
|
|
27
|
+
# paid_and_canceled = 7
|
|
22
28
|
# COMPLETED, PENDING, TRADING, BUYER_PAYED, DISTRIBUTING, COMPLETED, IN_APPEAL, CANCELLED, CANCELLED_BY_SYSTEM
|
|
23
29
|
|
|
24
30
|
|
|
@@ -182,12 +182,14 @@ class User(Model, TsTrait):
|
|
|
182
182
|
# computed = ["balance"]
|
|
183
183
|
|
|
184
184
|
|
|
185
|
-
class Agent(Model
|
|
186
|
-
exid: int = fields.
|
|
185
|
+
class Agent(Model):
|
|
186
|
+
exid: int = fields.BigIntField()
|
|
187
187
|
ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex", related_name="agents")
|
|
188
188
|
auth: dict[str, str] = fields.JSONField(null=True)
|
|
189
189
|
user: fields.ForeignKeyRelation[User] = fields.ForeignKeyField("models.User", related_name="agents")
|
|
190
190
|
user_id: int
|
|
191
|
+
updated_at: datetime | None = DatetimeSecField(auto_now=True)
|
|
192
|
+
|
|
191
193
|
assets: fields.ReverseRelation["Asset"]
|
|
192
194
|
orders: fields.ReverseRelation["Order"]
|
|
193
195
|
ads: fields.ReverseRelation["Ad"]
|
|
@@ -209,9 +211,6 @@ class Agent(Model, TsTrait):
|
|
|
209
211
|
async def client(self):
|
|
210
212
|
import sys
|
|
211
213
|
|
|
212
|
-
if isinstance(self.ex, QuerySet):
|
|
213
|
-
# noinspection PyTypeChecker
|
|
214
|
-
self.ex: Ex = await self.ex
|
|
215
214
|
client = sys.modules[f"xync_client.{self.ex.name}.agent"].Client
|
|
216
215
|
return client(self)
|
|
217
216
|
|
|
@@ -330,7 +329,7 @@ class Fiat(Model):
|
|
|
330
329
|
table_description = "Currency accounts balance"
|
|
331
330
|
|
|
332
331
|
class PydanticMeta(Model.PydanticMeta):
|
|
333
|
-
#
|
|
332
|
+
# max_recursion: int = 2
|
|
334
333
|
backward_relations = False
|
|
335
334
|
include = "id", "pmcur", "detail", "name", "amount"
|
|
336
335
|
|
|
@@ -388,7 +387,7 @@ class Asset(Model):
|
|
|
388
387
|
max_recursion: int = 2 # default: 3
|
|
389
388
|
|
|
390
389
|
|
|
391
|
-
class Order(Model
|
|
390
|
+
class Order(Model):
|
|
392
391
|
id: int = fields.BigIntField(True)
|
|
393
392
|
ad: fields.ForeignKeyRelation[Ad] = fields.ForeignKeyField("models.Ad", related_name="ads")
|
|
394
393
|
ad_id: int
|
|
@@ -398,14 +397,31 @@ class Order(Model, TsTrait):
|
|
|
398
397
|
taker: fields.ForeignKeyRelation[Agent] = fields.ForeignKeyField("models.Agent", "orders")
|
|
399
398
|
taker_id: int
|
|
400
399
|
status: OrderStatus = fields.IntEnumField(OrderStatus)
|
|
401
|
-
|
|
402
|
-
|
|
400
|
+
created_at: datetime | None = DatetimeSecField(auto_now_add=True)
|
|
401
|
+
payed_at: datetime | None = DatetimeSecField(null=True)
|
|
402
|
+
confirmed_at: datetime | None = DatetimeSecField(null=True)
|
|
403
|
+
appealed_at: datetime | None = DatetimeSecField(null=True)
|
|
403
404
|
|
|
404
405
|
_name = {"fiat__pmcur__pm__name"}
|
|
405
406
|
|
|
406
407
|
def repr(self):
|
|
407
408
|
return f"{self.fiat.pmcur.pm.name}/{self.fiat_id}:{self.amount:.3g} {self.status.name}"
|
|
408
409
|
|
|
410
|
+
async def client(self):
|
|
411
|
+
import sys
|
|
412
|
+
|
|
413
|
+
if isinstance(self.ad, QuerySet):
|
|
414
|
+
# noinspection PyTypeChecker
|
|
415
|
+
self.ad: Ad = await self.ad.prefetch_related("agent__ex")
|
|
416
|
+
elif isinstance(self.ad, Ad) and isinstance(self.ad.agent, QuerySet):
|
|
417
|
+
# noinspection PyTypeChecker
|
|
418
|
+
self.ad.agent = await self.ad.agent.prefetch_related("ex")
|
|
419
|
+
elif isinstance(self.ad.agent, Agent) and isinstance(self.ad.agent.ex, QuerySet):
|
|
420
|
+
# noinspection PyTypeChecker
|
|
421
|
+
self.ad.agent.ex = await self.ad.agent.ex
|
|
422
|
+
client = sys.modules[f"xync_client.{self.ad.agent.ex.name}.order"].Client
|
|
423
|
+
return client(self)
|
|
424
|
+
|
|
409
425
|
class Meta:
|
|
410
426
|
table_description = "P2P Orders"
|
|
411
427
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|