xync-schema 0.6.90__py3-none-any.whl → 0.6.92.dev1__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
@@ -321,3 +321,15 @@ exs = {
321
321
  ),
322
322
  # "catalogop2p(.com": ExType.p2p, ''), todo: discover brazilian p2p platforms
323
323
  }
324
+ df_curs = {
325
+ "t": "RUB",
326
+ "alfa": "RUB",
327
+ "sber": "RUB",
328
+ "ozon": "RUB",
329
+ "volet": "RUB",
330
+ "payeer": "RUB",
331
+ "sbp": "RUB",
332
+ "yoomoney": "RUB",
333
+ "kasikorn": "THB",
334
+ "google": "INR",
335
+ }
xync_schema/models.py CHANGED
@@ -4,7 +4,17 @@ from datetime import datetime
4
4
  from tortoise import fields
5
5
  from tortoise.queryset import QuerySet
6
6
  from tortoise import Model as BaseModel
7
- from x_auth.models import Model, UserTg
7
+ from x_auth.models import (
8
+ Model,
9
+ Username as Username,
10
+ User as TgUser,
11
+ Proxy as Proxy,
12
+ Session as Session,
13
+ Peer as Peer,
14
+ UpdateState as UpdateState,
15
+ Version as Version,
16
+ Country as BaseCountry,
17
+ )
8
18
  from x_model.models import TsTrait, DatetimeSecField
9
19
 
10
20
  from xync_schema.enums import (
@@ -21,11 +31,7 @@ from xync_schema.enums import (
21
31
  )
22
32
 
23
33
 
24
- class Country(Model):
25
- id = fields.SmallIntField(True)
26
- code: int | None = fields.IntField(null=True)
27
- short: str | None = fields.CharField(3, null=True)
28
- name: str | None = fields.CharField(63, unique=True, null=True)
34
+ class Country(BaseCountry):
29
35
  cur: fields.ForeignKeyRelation["Cur"] = fields.ForeignKeyField("models.Cur", related_name="countries")
30
36
  curexs: fields.ManyToManyRelation["Curex"]
31
37
  fiats: fields.BackwardFKRelation["Fiat"]
@@ -117,6 +123,7 @@ class Curex(BaseModel):
117
123
 
118
124
  class Coinex(BaseModel):
119
125
  coin: fields.ForeignKeyRelation[Coin] = fields.ForeignKeyField("models.Coin")
126
+ coin_id: int
120
127
  ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex")
121
128
  minimum: float = fields.FloatField(null=True)
122
129
 
@@ -180,10 +187,8 @@ class Person(Model, TsTrait):
180
187
  pm_agents: fields.BackwardFKRelation["PmAgent"]
181
188
 
182
189
 
183
- class User(UserTg, TsTrait):
190
+ class User(TgUser, TsTrait):
184
191
  status: UserStatus = fields.IntEnumField(UserStatus, default=UserStatus.SLEEP)
185
- gmail_auth: dict = fields.JSONField(default={})
186
-
187
192
  person: fields.OneToOneRelation[Person] = fields.OneToOneField("models.Person", related_name="user")
188
193
  person_id: int
189
194
  ref: fields.ForeignKeyNullableRelation["User"] = fields.ForeignKeyField(
@@ -195,15 +200,17 @@ class User(UserTg, TsTrait):
195
200
  ) # who can texts this user
196
201
  contacted_with_id: int | None
197
202
 
198
- forum: fields.BackwardOneToOneRelation["Forum"]
203
+ actors: fields.BackwardFKRelation["Actor"]
204
+ contacts: fields.BackwardFKRelation["User"]
199
205
  created_forums: fields.BackwardFKRelation["Forum"]
200
- proteges: fields.BackwardFKRelation["User"]
201
206
  creds: fields.BackwardFKRelation["Cred"]
202
- actors: fields.BackwardFKRelation["Actor"]
203
207
  # fiats: fields.BackwardFKRelation["Fiat"]
208
+ gmail: fields.BackwardOneToOneRelation["Gmail"]
209
+ forum: fields.BackwardOneToOneRelation["Forum"]
204
210
  limits: fields.BackwardFKRelation["Limit"]
205
211
  msgs: fields.BackwardFKRelation["Msg"]
206
- contacts: fields.BackwardFKRelation["User"]
212
+ proteges: fields.BackwardFKRelation["User"]
213
+
207
214
  # vpn: fields.BackwardOneToOneRelation["Vpn"]
208
215
  # invite_requests: fields.BackwardFKRelation["Invite"]
209
216
  # invite_approvals: fields.BackwardFKRelation["Invite"]
@@ -231,6 +238,15 @@ class User(UserTg, TsTrait):
231
238
  # computed = ["balance"]
232
239
 
233
240
 
241
+ class Gmail(Model):
242
+ login: str = fields.CharField(127)
243
+ password: str = fields.CharField(127)
244
+ auth: dict = fields.JSONField(default={})
245
+ updated_at: datetime | None = DatetimeSecField(auto_now=True)
246
+
247
+ user: fields.OneToOneRelation[User] = fields.OneToOneField("models.User", "gmail")
248
+
249
+
234
250
  class Forum(Model, TsTrait):
235
251
  id: int = fields.BigIntField(True)
236
252
  joined: bool = fields.BooleanField(default=False)
@@ -258,9 +274,7 @@ class Actor(Model):
258
274
  return client(self, headers=self.agent.auth.get("headers"), cookies=self.agent.auth.get("cookies"))
259
275
 
260
276
  def in_client(self):
261
- import sys
262
-
263
- module_name = f"xync_client.{self.ex.name}.inAgent"
277
+ module_name = f"xync_client.{self.ex.name}.InAgent"
264
278
  __import__(module_name)
265
279
  client = sys.modules[module_name].InAgentClient
266
280
  return client(self)
@@ -459,8 +473,9 @@ class PmexBank(BaseModel): # banks for SBP
459
473
  class Cred(Model):
460
474
  pmcur: fields.ForeignKeyRelation[Pmcur] = fields.ForeignKeyField("models.Pmcur")
461
475
  pmcur_id: int
462
- detail: str = fields.CharField(127)
463
- name: str | None = fields.CharField(127, null=True)
476
+ detail: str = fields.CharField(84)
477
+ name: str | None = fields.CharField(84, null=True)
478
+ extra: str | None = fields.CharField(84, null=True)
464
479
  person: fields.ForeignKeyRelation[Person] = fields.ForeignKeyField("models.Person", "creds")
465
480
  person_id: int
466
481
 
@@ -516,6 +531,19 @@ class Fiat(Model):
516
531
  return sys.modules[module_name].FiatEpyd
517
532
 
518
533
 
534
+ class Rival(Model, TsTrait):
535
+ actor: fields.ForeignKeyRelation[Actor] = fields.ForeignKeyField("models.Actor")
536
+ actor_id: int
537
+ direction: fields.ForeignKeyRelation[Direction] = fields.ForeignKeyField("models.Direction")
538
+ direction_id: int
539
+ pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm")
540
+ pm_id: int
541
+ rplace: int = fields.SmallIntField()
542
+ price: float = fields.SmallIntField()
543
+ exec_rate: int = fields.SmallIntField()
544
+ completed: int = fields.SmallIntField()
545
+
546
+
519
547
  class Limit(Model):
520
548
  pmcur: fields.ForeignKeyRelation[Pmcur] = fields.ForeignKeyField("models.Pmcur")
521
549
  pmcur_id: int
@@ -715,7 +743,7 @@ class Msg(Model):
715
743
 
716
744
  class TestEx(Model):
717
745
  ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex", related_name="tests")
718
- # ex_id: int
746
+ ex_id: int
719
747
  action: ExAction = fields.IntEnumField(ExAction)
720
748
  ok: bool | None = fields.BooleanField(default=False, null=True)
721
749
  updated_at: datetime | None = DatetimeSecField(auto_now=True)
@@ -723,7 +751,7 @@ class TestEx(Model):
723
751
  _icon = "test-pipe"
724
752
  _name = {"ex_id", "action", "ok"}
725
753
 
726
- def repr(self, *args):
754
+ def repr(self):
727
755
  return f"{self.ex_id} {self.action.name} {self.ok}"
728
756
 
729
757
  class Meta:
@@ -744,7 +772,7 @@ class Vpn(Model):
744
772
  _icon = "vpn"
745
773
  _name = {"pub"}
746
774
 
747
- def repr(self, *args):
775
+ def repr(self):
748
776
  return self.user.username
749
777
 
750
778
  class Meta:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xync-schema
3
- Version: 0.6.90
3
+ Version: 0.6.92.dev1
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=V0FYnenVT4gR5IN3zrAFRP2M7mHbQDoqwRl5xSI-lNc,12911
3
+ xync_schema/models.py,sha256=OEAgynmLFYbp2PHwZJ3diyB7iCokggfuvk2I3q2b39g,30720
4
+ xync_schema/types.py,sha256=sYWjJMcwv7mjm38FnWyxWhT6Z4bGpt92BTVZrqyZ0Ic,1675
5
+ xync_schema-0.6.92.dev1.dist-info/METADATA,sha256=qqAOrrHll17uJUKJPE6y5FGMDOWipUifZfSW4542DVI,4060
6
+ xync_schema-0.6.92.dev1.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
7
+ xync_schema-0.6.92.dev1.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
8
+ xync_schema-0.6.92.dev1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.1)
2
+ Generator: setuptools (80.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=MM5s20GpI8gsPlPS9nYFtkyrPheTvlcDYESwjnZ4Hmg,12698
3
- xync_schema/models.py,sha256=tDyIW-8GguHYBllhR4bVPl87Y1ySO9Eko8H0bDwN9EM,29877
4
- xync_schema/types.py,sha256=sYWjJMcwv7mjm38FnWyxWhT6Z4bGpt92BTVZrqyZ0Ic,1675
5
- xync_schema-0.6.90.dist-info/METADATA,sha256=OOKBByV63zAMDG1r1KxTGgZHSPAnAAT16KljOj7n574,4055
6
- xync_schema-0.6.90.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
7
- xync_schema-0.6.90.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
8
- xync_schema-0.6.90.dist-info/RECORD,,