xync-schema 0.0.9.dev7__tar.gz → 0.0.9.dev9__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.
Files changed (19) hide show
  1. {xync_schema-0.0.9.dev7/xync_schema.egg-info → xync_schema-0.0.9.dev9}/PKG-INFO +1 -1
  2. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/xync_schema/__init__.py +2 -3
  3. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/xync_schema/enums.py +4 -5
  4. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/xync_schema/models.py +19 -29
  5. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9/xync_schema.egg-info}/PKG-INFO +1 -1
  6. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/.env.sample +0 -0
  7. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/.gitignore +0 -0
  8. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/.pre-commit-config.yaml +0 -0
  9. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/README.md +0 -0
  10. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/makefile +0 -0
  11. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/pyproject.toml +0 -0
  12. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/setup.cfg +0 -0
  13. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/tests/__init__.py +0 -0
  14. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/tests/test_db.py +0 -0
  15. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/xync_schema/xtype.py +0 -0
  16. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/xync_schema.egg-info/SOURCES.txt +0 -0
  17. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/xync_schema.egg-info/dependency_links.txt +0 -0
  18. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/xync_schema.egg-info/requires.txt +0 -0
  19. {xync_schema-0.0.9.dev7 → xync_schema-0.0.9.dev9}/xync_schema.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xync-schema
3
- Version: 0.0.9.dev7
3
+ Version: 0.0.9.dev9
4
4
  Summary: XyncNet project database model schema
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: EULA
@@ -1,14 +1,13 @@
1
1
  from os import getenv as env
2
- from aerich import models as amodels
3
2
  from dotenv import load_dotenv
4
3
 
5
- from xync_schema import models as xmodels
4
+ from xync_schema import models
6
5
 
7
6
  load_dotenv()
8
7
 
9
8
  TORM = {
10
9
  "connections": {"default": env("DB_URL")},
11
- "apps": {"models": {"models": [xmodels, amodels]}},
10
+ "apps": {"models": {"models": [models, "aerich.models"]}},
12
11
  "use_tz": False,
13
12
  "timezone": "UTC",
14
13
  }
@@ -104,11 +104,10 @@ class SynonymType(IntEnum):
104
104
  slip_send = 6
105
105
  abuser = 7
106
106
  scale = 8
107
- mtl_like = 9
108
- bank_only = 10
109
- no_bank = 11
110
- cred_in_chat = 12
111
- slavic = 13
107
+ slavic = 9
108
+ mtl_like = 10
109
+ bank = 11
110
+ bank_side = 12
112
111
 
113
112
 
114
113
  class Party(IntEnum):
@@ -357,7 +357,6 @@ class Cond(Model, TsTrait):
357
357
  last_ver: str = CharField(4095, null=True)
358
358
 
359
359
  ads: BackwardFKRelation["Ad"]
360
- banks: BackwardFKRelation["CondPm"]
361
360
  parsed: BackwardOneToOneRelation["CondParsed"]
362
361
  sim: BackwardOneToOneRelation["Cond"]
363
362
 
@@ -365,25 +364,11 @@ class Cond(Model, TsTrait):
365
364
  return {self.raw_txt: await self.sim.sims()} if await self.sim else self.raw_txt
366
365
 
367
366
 
368
- class CondParsed(Model, TsTrait):
369
- cond: OneToOneNullableRelation[Cond] = OneToOneField("models.Cond", "parsed", null=True)
370
- cond_id: int # new
371
- to_party: Party = IntEnumField(Party, null=True)
372
- from_party: Party = IntEnumField(Party, null=True)
373
- ppo: int = SmallIntField(null=True) # Payments per order
374
- slip_req: Slip = IntEnumField(Slip, null=True)
375
- slip_send: Slip = IntEnumField(Slip, null=True)
376
- abuser: bool = BooleanField(null=True) # рейт: жмет "Оплачено" сразу, "Отмена" по аппеляции
377
- slavic: bool = BooleanField(null=True)
378
- mtl_like: bool = BooleanField(null=True)
379
- cred_in_chat: bool = BooleanField(null=True)
380
- scale: int = SmallIntField(null=True)
381
-
382
-
383
367
  class Synonym(BaseModel):
384
368
  typ: SynonymType = IntEnumField(SynonymType, db_index=True)
385
369
  txt: str = CharField(255, unique=True)
386
370
  curs: ManyToManyRelation[Cur] = ManyToManyField("models.Cur", "synonym_cur", related_name="synonyms")
371
+ val: int | None = SmallIntField(null=True) # SynonymType dependent (e.g: no-slavic for name, approx for ppo..)
387
372
 
388
373
 
389
374
  class CondSim(BaseModel):
@@ -412,7 +397,7 @@ class Pm(Model):
412
397
  no_conds: ManyToManyRelation[Cond]
413
398
  only_conds: ManyToManyRelation[Cond]
414
399
  exs: ManyToManyRelation[Ex] = ManyToManyField("models.Ex", "pmex") # no need. use pmexs[.exid]
415
- conds: BackwardFKRelation["CondPm"]
400
+ conds: BackwardFKRelation["CondParsed"]
416
401
  orders: BackwardFKRelation["Order"]
417
402
  pmcurs: BackwardFKRelation["Pmcur"] # no need. use curs
418
403
  pmexs: BackwardFKRelation["Pmex"]
@@ -432,6 +417,22 @@ class Pm(Model):
432
417
  # return sys.modules[module_name].PmEpyd
433
418
 
434
419
 
420
+ class CondParsed(Model, TsTrait):
421
+ cond: OneToOneNullableRelation[Cond] = OneToOneField("models.Cond", "parsed", null=True)
422
+ cond_id: int # new
423
+ to_party: Party = IntEnumField(Party, null=True)
424
+ from_party: Party = IntEnumField(Party, null=True)
425
+ ppo: int = SmallIntField(null=True) # Payments per order
426
+ slip_req: Slip = IntEnumField(Slip, null=True)
427
+ slip_send: Slip = IntEnumField(Slip, null=True)
428
+ abuser: bool = BooleanField(null=True) # рейт: жмет "Оплачено" сразу, "Отмена" по аппеляции
429
+ slavic: bool = BooleanField(null=True)
430
+ mtl_like: bool = BooleanField(null=True)
431
+ scale: int = SmallIntField(null=True)
432
+ bank_side: bool = BooleanField(null=True) # False - except this banks, True - only this banks
433
+ banks: ManyToManyRelation[Pm] = ManyToManyField("models.Pm", "cond_banks", related_name="conds")
434
+
435
+
435
436
  class Ad(Model, TsTrait):
436
437
  exid: int = BigIntField(unique=True) # todo: спарить уникальность с биржей, тк на разных биржах могут совпасть
437
438
  pair_side: ForeignKeyRelation[PairSide] = ForeignKeyField("models.PairSide", related_name="ads")
@@ -501,17 +502,6 @@ class Race(Model):
501
502
  created_at: datetime | None = DatetimeSecField(auto_now_add=True)
502
503
 
503
504
 
504
- class CondPm(Model):
505
- positive: int = BooleanField(default=True) # /1000
506
- cond: ForeignKeyRelation[Cond] = ForeignKeyField("models.Cond", "banks")
507
- cond_id: int # new
508
- pm: ForeignKeyRelation[Pm] = ForeignKeyField("models.Pm", "conds")
509
- pm_id: int # old
510
-
511
- class Meta:
512
- unique_together = (("cond_id", "pm_id"),)
513
-
514
-
515
505
  class PmRep(Model):
516
506
  ex: ForeignKeyRelation[Ex] = ForeignKeyField("models.Ex", "pm_reps")
517
507
  ex_id: int
@@ -596,7 +586,7 @@ class Cred(Model):
596
586
  extra: str | None = CharField(255, null=True)
597
587
  person: ForeignKeyRelation[Person] = ForeignKeyField("models.Person", "creds")
598
588
  person_id: int
599
- from_chat: bool = BooleanField(default=False)
589
+ from_chat: int # todo: ForeignKeyNullableRelation["Order"] = ForeignKeyField("models.Order", null=True)
600
590
 
601
591
  banks: ManyToManyRelation[PmexBank] = ManyToManyField("models.PmexBank", related_name="creds")
602
592
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xync-schema
3
- Version: 0.0.9.dev7
3
+ Version: 0.0.9.dev9
4
4
  Summary: XyncNet project database model schema
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: EULA