xync-schema 0.6.88__py3-none-any.whl → 0.6.90__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/models.py +17 -4
- {xync_schema-0.6.88.dist-info → xync_schema-0.6.90.dist-info}/METADATA +1 -1
- xync_schema-0.6.90.dist-info/RECORD +8 -0
- {xync_schema-0.6.88.dist-info → xync_schema-0.6.90.dist-info}/WHEEL +1 -1
- xync_schema-0.6.88.dist-info/RECORD +0 -8
- {xync_schema-0.6.88.dist-info → xync_schema-0.6.90.dist-info}/top_level.txt +0 -0
xync_schema/models.py
CHANGED
|
@@ -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", "
|
|
214
|
-
return sum(asset["free"] * asset["
|
|
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
|
|
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.
|
|
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
|
|
@@ -0,0 +1,8 @@
|
|
|
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,,
|
|
@@ -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=9nt8Tjv9E0OC9SNPTtzxFu13T7FWwC3rYYQ3aAoRWHY,29291
|
|
4
|
-
xync_schema/types.py,sha256=sYWjJMcwv7mjm38FnWyxWhT6Z4bGpt92BTVZrqyZ0Ic,1675
|
|
5
|
-
xync_schema-0.6.88.dist-info/METADATA,sha256=Hi8MOzjX5N9UlC5QCrXN_HD_UO8PkUmOZBahOSzCzBo,4055
|
|
6
|
-
xync_schema-0.6.88.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
|
7
|
-
xync_schema-0.6.88.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
|
|
8
|
-
xync_schema-0.6.88.dist-info/RECORD,,
|
|
File without changes
|