xync-schema 0.6.36.dev3__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 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
- taker_curs = 21 # Список поддерживаемых валют тейкера
95
- coins = 22 # Список торгуемых монет (с ограничениям по валютам, если есть)
96
- pms = 23 # Список платежных методов по каждой валюте
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
- curexs: fields.ReverseRelation["Curex"]
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(Model):
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
- _name = {"cur__ticker", "ex__name"}
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 = (("cur_id", "ex_id"),)
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,14 +247,11 @@ 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
254
  multiAllow: bool | None = fields.BooleanField(null=True)
248
- riskLevel: int | None = fields.SmallIntField(null=True)
249
- chatNeed: bool | None = fields.BooleanField(null=True)
250
255
 
251
256
  ads: fields.ManyToManyRelation[Ad]
252
257
  curs: fields.ManyToManyRelation[Cur]
@@ -271,42 +276,35 @@ class Pmcur(Model): # for fiat with no exs tie
271
276
  fiats: fields.ReverseRelation["Fiat"]
272
277
  exs: fields.ManyToManyRelation[Ex]
273
278
 
274
- _name = {"pm__name", "cur__ticker"}
275
-
276
279
  class Meta:
277
280
  table_description = "Payment methods - Currencies"
278
- unique_together = (("pm", "cur"),)
281
+ # unique_together = ("pm", "cur"),
279
282
 
280
283
  class PydanticMeta(Model.PydanticMeta):
281
284
  max_recursion: int = 2 # default: 3
282
285
  include = "cur_id", "pm"
283
286
 
284
287
 
285
- class Pmex(Model): # existence pm in ex with no cur tie
288
+ class Pmex(BaseModel): # existence pm in ex with no cur tie
286
289
  pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm", "pmexs")
287
290
  pm_id: int
288
291
  ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex", "pmexs")
289
292
  ex_id: int
290
- exid: int = fields.SmallIntField()
291
-
292
- _name = {"pm__name", "ex__name"}
293
+ exid: str = fields.CharField(31)
293
294
 
294
295
  class Meta:
295
- table_description = "Payment methods - Currencies"
296
296
  unique_together = (("pm_id", "ex_id"), ("ex_id", "exid"))
297
297
 
298
298
 
299
- class Pmcurex(Model): # existence pm in ex for exact cur, with "blocked" flag
299
+ class Pmcurex(BaseModel): # existence pm in ex for exact cur, with "blocked" flag
300
300
  pmcur: fields.ForeignKeyRelation[Pmcur] = fields.ForeignKeyField("models.Pmcur")
301
301
  pmcur_id: int
302
302
  ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex")
303
303
  ex_id: int
304
304
  blocked: bool = fields.BooleanField(default=False)
305
305
 
306
- _name = {"pmcur__pm__name", "pmcur__cur__ticker", "ex__name"}
307
-
308
- class Meta:
309
- table_description = "Payment methods - Currencies"
306
+ # class Meta:
307
+ # unique_together = (("ex_id", "pmcur_id"),)
310
308
 
311
309
 
312
310
  class Fiat(Model):
@@ -337,14 +335,12 @@ class Fiat(Model):
337
335
  # # exclude_raw_fields = True
338
336
 
339
337
 
340
- class Fiatex(Model): # existence pm in ex with no cur tie
338
+ class Fiatex(BaseModel): # existence pm in ex with no cur tie
341
339
  fiat: fields.ForeignKeyRelation[Fiat] = fields.ForeignKeyField("models.Fiat", "fiatexs")
342
340
  fiat_id: int
343
341
  ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex", "fiatexs")
344
342
  ex_id: int
345
- exid: int = fields.SmallIntField()
346
-
347
- _name = {"fiat__detail", "ex__name"}
343
+ exid: int = fields.IntField()
348
344
 
349
345
  class Meta:
350
346
  table_description = "Fiat on Ex"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xync-schema
3
- Version: 0.6.36.dev3
3
+ Version: 0.6.36.dev4
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=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,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -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=AT_ZZA6H1xz_Lg-tikATVMpcm3X3-lawCL95H7_jS1o,20093
4
- xync_schema/pydantic.py,sha256=cyviSX1P2Cj6fLFq_IsrYdWB6gBOYwR4adPXrAmlP7g,274
5
- xync_schema-0.6.36.dev3.dist-info/METADATA,sha256=4OIwa3Ug1J1fWwRB7qBume4sEv-iSPlum8Uk78lqYv8,1099
6
- xync_schema-0.6.36.dev3.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
7
- xync_schema-0.6.36.dev3.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
8
- xync_schema-0.6.36.dev3.dist-info/RECORD,,