xync-schema 0.6.88__tar.gz → 0.6.90__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xync-schema
3
- Version: 0.6.88
3
+ Version: 0.6.90
4
4
  Summary: XyncNet project database model schema
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: EULA
@@ -177,10 +177,12 @@ class Person(Model, TsTrait):
177
177
  user: fields.BackwardOneToOneRelation["User"]
178
178
  creds: fields.BackwardFKRelation["Cred"]
179
179
  actors: fields.BackwardFKRelation["Actor"]
180
+ pm_agents: fields.BackwardFKRelation["PmAgent"]
180
181
 
181
182
 
182
183
  class User(UserTg, TsTrait):
183
184
  status: UserStatus = fields.IntEnumField(UserStatus, default=UserStatus.SLEEP)
185
+ gmail_auth: dict = fields.JSONField(default={})
184
186
 
185
187
  person: fields.OneToOneRelation[Person] = fields.OneToOneField("models.Person", related_name="user")
186
188
  person_id: int
@@ -210,8 +212,8 @@ class User(UserTg, TsTrait):
210
212
  # investments: fields.BackwardFKRelation["Investment"]
211
213
 
212
214
  async def free_assets(self):
213
- assets = await Asset.filter(agent__actor__person__user__id=self.id).values("free", "coin__rate")
214
- return sum(asset["free"] * asset["coin__rate"] for asset in assets)
215
+ assets = await Asset.filter(agent__actor__person__user__id=self.id).values("free", "addr__coin__rate")
216
+ return sum(asset["free"] * asset["addr__coin__rate"] for asset in assets)
215
217
 
216
218
  async def fiats_sum(self):
217
219
  fiats = await Fiat.filter(cred__person__user__id=self.id).values("amount", "cred__pmcur__cur__rate")
@@ -275,7 +277,7 @@ class Actor(Model):
275
277
 
276
278
 
277
279
  class Agent(Model, TsTrait):
278
- auth: dict[str, str] = fields.JSONField(default={})
280
+ auth: dict = fields.JSONField(default={})
279
281
  actor: fields.OneToOneRelation[Actor] = fields.OneToOneField("models.Actor", "agent")
280
282
  actor_id: int
281
283
 
@@ -356,7 +358,8 @@ class Pm(Model):
356
358
  # name: str = fields.CharField(63) # mv to pmex cause it diffs on each ex
357
359
  norm: str | None = fields.CharField(63)
358
360
  acronym: str | None = fields.CharField(7, null=True)
359
- country: fields.ForeignKeyRelation[Country] = fields.ForeignKeyField("models.Country", "pms", null=True)
361
+ country: fields.ForeignKeyNullableRelation[Country] = fields.ForeignKeyField("models.Country", "pms", null=True)
362
+ df_cur: fields.ForeignKeyNullableRelation[Cur] = fields.ForeignKeyField("models.Cur", "df_pms", null=True)
360
363
  alias: str | None = fields.CharField(63, null=True)
361
364
  extra: str | None = fields.CharField(63, null=True)
362
365
  ok: bool = fields.BooleanField(default=True)
@@ -385,6 +388,16 @@ class Pm(Model):
385
388
  # return sys.modules[module_name].PmEpyd
386
389
 
387
390
 
391
+ class PmAgent(Model):
392
+ pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm", related_name="agents")
393
+ user: fields.ForeignKeyRelation[User] = fields.ForeignKeyField("models.User", related_name="pm_agents")
394
+ user_id: int
395
+ auth: dict = fields.JSONField(default={})
396
+
397
+ class Meta:
398
+ unique_together = (("pm_id", "user_id"),)
399
+
400
+
388
401
  class Pmcur(Model): # for fiat with no exs tie
389
402
  pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm")
390
403
  pm_id: int
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xync-schema
3
- Version: 0.6.88
3
+ Version: 0.6.90
4
4
  Summary: XyncNet project database model schema
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: EULA
File without changes
File without changes
File without changes
File without changes
File without changes