xync-schema 0.6.92.dev1__py3-none-any.whl → 0.6.92.dev3__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/__init__.py +17 -0
- xync_schema/models.py +13 -0
- {xync_schema-0.6.92.dev1.dist-info → xync_schema-0.6.92.dev3.dist-info}/METADATA +1 -1
- xync_schema-0.6.92.dev3.dist-info/RECORD +8 -0
- {xync_schema-0.6.92.dev1.dist-info → xync_schema-0.6.92.dev3.dist-info}/WHEEL +1 -1
- xync_schema-0.6.92.dev1.dist-info/RECORD +0 -8
- {xync_schema-0.6.92.dev1.dist-info → xync_schema-0.6.92.dev3.dist-info}/top_level.txt +0 -0
xync_schema/__init__.py
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
async def main():
|
|
2
|
+
from os import getenv as env
|
|
3
|
+
from dotenv import load_dotenv
|
|
4
|
+
import logging
|
|
5
|
+
from x_model import init_db
|
|
6
|
+
from xync_schema import models
|
|
7
|
+
from logging import DEBUG
|
|
8
|
+
|
|
9
|
+
load_dotenv()
|
|
10
|
+
logging.basicConfig(level=DEBUG)
|
|
11
|
+
await init_db(env("DB_URL"), models, True)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
from asyncio import run
|
|
16
|
+
|
|
17
|
+
run(main())
|
xync_schema/models.py
CHANGED
|
@@ -4,11 +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 tortoise.signals import pre_save
|
|
8
|
+
|
|
9
|
+
# noinspection PyUnresolvedReferences
|
|
7
10
|
from x_auth.models import (
|
|
8
11
|
Model,
|
|
9
12
|
Username as Username,
|
|
10
13
|
User as TgUser,
|
|
11
14
|
Proxy as Proxy,
|
|
15
|
+
Dc as Dc,
|
|
16
|
+
Fcm as Fcm,
|
|
17
|
+
App as App,
|
|
12
18
|
Session as Session,
|
|
13
19
|
Peer as Peer,
|
|
14
20
|
UpdateState as UpdateState,
|
|
@@ -238,6 +244,13 @@ class User(TgUser, TsTrait):
|
|
|
238
244
|
# computed = ["balance"]
|
|
239
245
|
|
|
240
246
|
|
|
247
|
+
@pre_save(User)
|
|
248
|
+
async def person(_meta, user: User, _db, _updated: dict) -> None:
|
|
249
|
+
if user.person_id:
|
|
250
|
+
return
|
|
251
|
+
user.person = await Person.create(name=f"{user.first_name} {user.last_name}".strip())
|
|
252
|
+
|
|
253
|
+
|
|
241
254
|
class Gmail(Model):
|
|
242
255
|
login: str = fields.CharField(127)
|
|
243
256
|
password: str = fields.CharField(127)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
xync_schema/__init__.py,sha256=iuGuNLNesQNzMnfM2ao6QhgS-6E0LSdp2CV2c3qhubQ,379
|
|
2
|
+
xync_schema/enums.py,sha256=V0FYnenVT4gR5IN3zrAFRP2M7mHbQDoqwRl5xSI-lNc,12911
|
|
3
|
+
xync_schema/models.py,sha256=rwzCjLVnLdLMU188Zw_X9wBRho5ctmGW1OTBtl27a2c,31055
|
|
4
|
+
xync_schema/types.py,sha256=sYWjJMcwv7mjm38FnWyxWhT6Z4bGpt92BTVZrqyZ0Ic,1675
|
|
5
|
+
xync_schema-0.6.92.dev3.dist-info/METADATA,sha256=h5bGw912fWvoMNsVXN60ODx0vVAtAdTHYSmPpk4ccwA,4060
|
|
6
|
+
xync_schema-0.6.92.dev3.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
7
|
+
xync_schema-0.6.92.dev3.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
|
|
8
|
+
xync_schema-0.6.92.dev3.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
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,,
|
|
File without changes
|