xync-schema 0.6.36.dev2__py3-none-any.whl → 0.6.36.dev4__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/enums.py +4 -3
- xync_schema/models.py +29 -36
- {xync_schema-0.6.36.dev2.dist-info → xync_schema-0.6.36.dev4.dist-info}/METADATA +1 -1
- xync_schema-0.6.36.dev4.dist-info/RECORD +8 -0
- {xync_schema-0.6.36.dev2.dist-info → xync_schema-0.6.36.dev4.dist-info}/WHEEL +1 -1
- xync_schema-0.6.36.dev2.dist-info/RECORD +0 -8
- {xync_schema-0.6.36.dev2.dist-info → xync_schema-0.6.36.dev4.dist-info}/top_level.txt +0 -0
xync_schema/enums.py
CHANGED
|
@@ -91,9 +91,10 @@ class ExAction(IntEnum):
|
|
|
91
91
|
send_appeal_msg = 17 # Отправка сообщения по апелляции
|
|
92
92
|
get_appeal_msg = -17 # Получение сообщения по апелляции
|
|
93
93
|
""" Ex: Public """
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
pms = 20 # Список платежных методов по каждой валюте
|
|
95
|
+
curs = 21 # Список поддерживаемых валют тейкера
|
|
96
|
+
cur_pms_map = 22 # Мэппинг валюта => платежные методы
|
|
97
|
+
coins = 23 # Список торгуемых монет (с ограничениям по валютам, если есть)
|
|
97
98
|
ads = 24 # Список объяв по (buy/sell, cur, coin, pm)
|
|
98
99
|
""" Agent: Fiat """
|
|
99
100
|
my_fiats = 25 # Список реквизитов моих платежных методов
|
xync_schema/models.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
from tortoise import fields
|
|
3
3
|
from tortoise.queryset import QuerySet
|
|
4
|
+
from tortoise import Model as BaseModel
|
|
4
5
|
from x_auth.enums import Role
|
|
5
6
|
from x_auth.models import Model
|
|
6
7
|
from x_model.models import TsTrait, DatetimeSecField
|
|
@@ -18,8 +19,6 @@ class Country(Model):
|
|
|
18
19
|
curexs: fields.ManyToManyRelation["Curex"]
|
|
19
20
|
fiats: fields.BackwardFKRelation["Fiat"]
|
|
20
21
|
|
|
21
|
-
_icon = "location"
|
|
22
|
-
|
|
23
22
|
|
|
24
23
|
class Cur(Model):
|
|
25
24
|
id = fields.SmallIntField(True)
|
|
@@ -28,8 +27,7 @@ class Cur(Model):
|
|
|
28
27
|
country: str | None = fields.CharField(63, null=True)
|
|
29
28
|
|
|
30
29
|
pms: fields.ManyToManyRelation["Pm"] = fields.ManyToManyField("models.Pm", through="pmcur")
|
|
31
|
-
|
|
32
|
-
pmcurs: fields.ReverseRelation["Pmcur"] # no need. use pms
|
|
30
|
+
exs: fields.ManyToManyRelation["Ex"] = fields.ManyToManyField("models.Ex", through="curex")
|
|
33
31
|
pairs: fields.ReverseRelation["Pair"]
|
|
34
32
|
countries: fields.ReverseRelation[Country]
|
|
35
33
|
|
|
@@ -65,12 +63,11 @@ class Ex(Model):
|
|
|
65
63
|
logo: str = fields.CharField(511, default="")
|
|
66
64
|
|
|
67
65
|
pms: fields.ManyToManyRelation["Pm"]
|
|
66
|
+
curs: fields.ManyToManyRelation[Cur]
|
|
68
67
|
pmcurs: fields.ManyToManyRelation["Pmcur"] = fields.ManyToManyField("models.Pmcur", through="pmcurex")
|
|
69
68
|
coins: fields.ManyToManyRelation[Coin]
|
|
70
69
|
|
|
71
70
|
agents: fields.ReverseRelation["Agent"]
|
|
72
|
-
curexs: fields.ReverseRelation["Curex"]
|
|
73
|
-
pmcurexs: fields.ReverseRelation["Pmcurex"]
|
|
74
71
|
pmexs: fields.ReverseRelation["Pmex"]
|
|
75
72
|
pairs: fields.ReverseRelation["Pair"]
|
|
76
73
|
# deps: fields.ReverseRelation["Dep"]
|
|
@@ -90,18 +87,29 @@ class Ex(Model):
|
|
|
90
87
|
return client(self)
|
|
91
88
|
|
|
92
89
|
|
|
93
|
-
class Curex(
|
|
90
|
+
class Curex(BaseModel):
|
|
94
91
|
cur: fields.ForeignKeyRelation[Cur] = fields.ForeignKeyField("models.Cur")
|
|
95
92
|
ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex")
|
|
93
|
+
exid: str = fields.CharField(31)
|
|
94
|
+
p2p: bool = fields.BooleanField(default=True)
|
|
96
95
|
countries: fields.ManyToManyRelation[Country] = fields.ManyToManyField(
|
|
97
96
|
"models.Country", through="curexcountry", backward_key="curexs"
|
|
98
97
|
)
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
class Meta:
|
|
100
|
+
table_description = "Currency in Exchange"
|
|
101
|
+
unique_together = (("ex_id", "cur_id"), ("ex_id", "exid"))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class Coinex(BaseModel):
|
|
105
|
+
coin: fields.ForeignKeyRelation[Coin] = fields.ForeignKeyField("models.Coin")
|
|
106
|
+
ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex")
|
|
107
|
+
exid: str = fields.CharField(31)
|
|
108
|
+
p2p: bool = fields.BooleanField(default=True)
|
|
101
109
|
|
|
102
110
|
class Meta:
|
|
103
111
|
table_description = "Currency in Exchange"
|
|
104
|
-
unique_together = (("
|
|
112
|
+
unique_together = (("ex_id", "coin_id"), ("ex_id", "exid"))
|
|
105
113
|
|
|
106
114
|
|
|
107
115
|
class Pair(Model, TsTrait):
|
|
@@ -193,7 +201,7 @@ class Agent(Model, TsTrait):
|
|
|
193
201
|
|
|
194
202
|
class PydanticMeta(Model.PydanticMeta):
|
|
195
203
|
# max_recursion = 3
|
|
196
|
-
include = "ex", "assets", "auth", "updated_at"
|
|
204
|
+
include = "id", "ex", "assets", "auth", "updated_at"
|
|
197
205
|
computed = ["balance"]
|
|
198
206
|
|
|
199
207
|
async def client(self):
|
|
@@ -239,21 +247,15 @@ class Ad(Model, TsTrait):
|
|
|
239
247
|
|
|
240
248
|
class Pm(Model):
|
|
241
249
|
name: str = fields.CharField(63, unique=True)
|
|
242
|
-
identifier: str | None = fields.CharField(63, unique=True, null=True)
|
|
250
|
+
# identifier: str | None = fields.CharField(63, unique=True, null=True)
|
|
243
251
|
rank: int | None = fields.SmallIntField(default=0)
|
|
244
252
|
type_: PmType | None = fields.IntEnumField(PmType, null=True)
|
|
245
|
-
template: int | None = fields.SmallIntField(null=True)
|
|
246
253
|
logo: str | None = fields.CharField(127, null=True)
|
|
247
|
-
color: str | None = fields.CharField(7, null=True)
|
|
248
254
|
multiAllow: bool | None = fields.BooleanField(null=True)
|
|
249
|
-
riskLevel: int | None = fields.SmallIntField(null=True)
|
|
250
|
-
chatNeed: bool | None = fields.BooleanField(null=True)
|
|
251
255
|
|
|
252
256
|
ads: fields.ManyToManyRelation[Ad]
|
|
253
257
|
curs: fields.ManyToManyRelation[Cur]
|
|
254
|
-
exs: fields.ManyToManyRelation[Ex] = fields.ManyToManyField(
|
|
255
|
-
"models.Ex", through="pmex"
|
|
256
|
-
) # no need. use pmexs[.exid]
|
|
258
|
+
exs: fields.ManyToManyRelation[Ex] = fields.ManyToManyField("models.Ex", "pmex") # no need. use pmexs[.exid]
|
|
257
259
|
orders: fields.ReverseRelation["Order"]
|
|
258
260
|
pmcurs: fields.ReverseRelation["Pmcur"] # no need. use curs
|
|
259
261
|
pmexs: fields.ReverseRelation["Pmex"]
|
|
@@ -262,7 +264,7 @@ class Pm(Model):
|
|
|
262
264
|
table_description = "Payment methods"
|
|
263
265
|
|
|
264
266
|
class PydanticMeta(Model.PydanticMeta):
|
|
265
|
-
include = ("logo"
|
|
267
|
+
include = ("id", "name", "logo")
|
|
266
268
|
|
|
267
269
|
|
|
268
270
|
class Pmcur(Model): # for fiat with no exs tie
|
|
@@ -274,42 +276,35 @@ class Pmcur(Model): # for fiat with no exs tie
|
|
|
274
276
|
fiats: fields.ReverseRelation["Fiat"]
|
|
275
277
|
exs: fields.ManyToManyRelation[Ex]
|
|
276
278
|
|
|
277
|
-
_name = {"pm__name", "cur__ticker"}
|
|
278
|
-
|
|
279
279
|
class Meta:
|
|
280
280
|
table_description = "Payment methods - Currencies"
|
|
281
|
-
unique_together = (
|
|
281
|
+
# unique_together = ("pm", "cur"),
|
|
282
282
|
|
|
283
283
|
class PydanticMeta(Model.PydanticMeta):
|
|
284
284
|
max_recursion: int = 2 # default: 3
|
|
285
285
|
include = "cur_id", "pm"
|
|
286
286
|
|
|
287
287
|
|
|
288
|
-
class Pmex(
|
|
288
|
+
class Pmex(BaseModel): # existence pm in ex with no cur tie
|
|
289
289
|
pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm", "pmexs")
|
|
290
290
|
pm_id: int
|
|
291
291
|
ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex", "pmexs")
|
|
292
292
|
ex_id: int
|
|
293
|
-
exid:
|
|
294
|
-
|
|
295
|
-
_name = {"pm__name", "ex__name"}
|
|
293
|
+
exid: str = fields.CharField(31)
|
|
296
294
|
|
|
297
295
|
class Meta:
|
|
298
|
-
table_description = "Payment methods - Currencies"
|
|
299
296
|
unique_together = (("pm_id", "ex_id"), ("ex_id", "exid"))
|
|
300
297
|
|
|
301
298
|
|
|
302
|
-
class Pmcurex(
|
|
299
|
+
class Pmcurex(BaseModel): # existence pm in ex for exact cur, with "blocked" flag
|
|
303
300
|
pmcur: fields.ForeignKeyRelation[Pmcur] = fields.ForeignKeyField("models.Pmcur")
|
|
304
301
|
pmcur_id: int
|
|
305
302
|
ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex")
|
|
306
303
|
ex_id: int
|
|
307
304
|
blocked: bool = fields.BooleanField(default=False)
|
|
308
305
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
class Meta:
|
|
312
|
-
table_description = "Payment methods - Currencies"
|
|
306
|
+
# class Meta:
|
|
307
|
+
# unique_together = (("ex_id", "pmcur_id"),)
|
|
313
308
|
|
|
314
309
|
|
|
315
310
|
class Fiat(Model):
|
|
@@ -340,14 +335,12 @@ class Fiat(Model):
|
|
|
340
335
|
# # exclude_raw_fields = True
|
|
341
336
|
|
|
342
337
|
|
|
343
|
-
class Fiatex(
|
|
338
|
+
class Fiatex(BaseModel): # existence pm in ex with no cur tie
|
|
344
339
|
fiat: fields.ForeignKeyRelation[Fiat] = fields.ForeignKeyField("models.Fiat", "fiatexs")
|
|
345
340
|
fiat_id: int
|
|
346
341
|
ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex", "fiatexs")
|
|
347
342
|
ex_id: int
|
|
348
|
-
exid: int = fields.
|
|
349
|
-
|
|
350
|
-
_name = {"fiat__detail", "ex__name"}
|
|
343
|
+
exid: int = fields.IntField()
|
|
351
344
|
|
|
352
345
|
class Meta:
|
|
353
346
|
table_description = "Fiat on Ex"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
xync_schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
xync_schema/enums.py,sha256=oOpyfG2i1-UKD8Udh2sVBIMUHTIhKZMPIA6Rh7lqnDA,10013
|
|
3
|
+
xync_schema/models.py,sha256=x5RiBV1Wvqwu9TSezDyGtyXqIQBhbDZJM6EOVl2F4t0,20106
|
|
4
|
+
xync_schema/pydantic.py,sha256=cyviSX1P2Cj6fLFq_IsrYdWB6gBOYwR4adPXrAmlP7g,274
|
|
5
|
+
xync_schema-0.6.36.dev4.dist-info/METADATA,sha256=IUQNxQiWCi4OTgIw2weBWFIlIeqO-RgGmnatwGJBNaQ,1099
|
|
6
|
+
xync_schema-0.6.36.dev4.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
|
|
7
|
+
xync_schema-0.6.36.dev4.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
|
|
8
|
+
xync_schema-0.6.36.dev4.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
xync_schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
xync_schema/enums.py,sha256=555m5ZD-l5be9h-_hAHysfCkmKHwKjLFDPM1pw_gFuQ,9932
|
|
3
|
-
xync_schema/models.py,sha256=QWYFTUKw8UHxjSa_cS-9jgYbSxaLfqqBmqteZFx0cwQ,20157
|
|
4
|
-
xync_schema/pydantic.py,sha256=cyviSX1P2Cj6fLFq_IsrYdWB6gBOYwR4adPXrAmlP7g,274
|
|
5
|
-
xync_schema-0.6.36.dev2.dist-info/METADATA,sha256=cNhbrLNpO_s-DTY8QymKGg7hjy9OfR1T5Dkemvrtwk0,1099
|
|
6
|
-
xync_schema-0.6.36.dev2.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
7
|
-
xync_schema-0.6.36.dev2.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
|
|
8
|
-
xync_schema-0.6.36.dev2.dist-info/RECORD,,
|
|
File without changes
|