xn-auth 0.2.30__tar.gz → 0.2.32__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.
- {xn_auth-0.2.30/xn_auth.egg-info → xn_auth-0.2.32}/PKG-INFO +1 -1
- {xn_auth-0.2.30 → xn_auth-0.2.32}/x_auth/models.py +39 -7
- {xn_auth-0.2.30 → xn_auth-0.2.32/xn_auth.egg-info}/PKG-INFO +1 -1
- {xn_auth-0.2.30 → xn_auth-0.2.32}/.env.dist +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/.gitignore +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/.pre-commit-config.yaml +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/README.md +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/makefile +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/pyproject.toml +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/setup.cfg +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/x_auth/controller.py +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/x_auth/enums.py +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/x_auth/exceptions.py +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/x_auth/middleware.py +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/x_auth/types.py +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/xn_auth.egg-info/SOURCES.txt +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/xn_auth.egg-info/dependency_links.txt +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/xn_auth.egg-info/requires.txt +0 -0
- {xn_auth-0.2.30 → xn_auth-0.2.32}/xn_auth.egg-info/top_level.txt +0 -0
|
@@ -34,6 +34,7 @@ from x_auth.types import AuthUser
|
|
|
34
34
|
class Username(TortModel):
|
|
35
35
|
id: int = BigIntField(True, description="tg_id")
|
|
36
36
|
username: str = CharField(127, null=True)
|
|
37
|
+
phone = BigIntField(null=True)
|
|
37
38
|
|
|
38
39
|
user: BackwardOneToOneRelation["User"]
|
|
39
40
|
peers: BackwardFKRelation["Peer"]
|
|
@@ -49,6 +50,8 @@ class User(Model):
|
|
|
49
50
|
lang: Lang | None = IntEnumField(Lang, default=Lang.ru, null=True)
|
|
50
51
|
role: Role = IntEnumField(Role, default=Role.READER)
|
|
51
52
|
|
|
53
|
+
app: BackwardOneToOneRelation["App"]
|
|
54
|
+
|
|
52
55
|
def get_auth(self) -> AuthUser:
|
|
53
56
|
return AuthUser.model_validate(self, from_attributes=True)
|
|
54
57
|
|
|
@@ -142,16 +145,45 @@ class Proxy(Model, TsTrait):
|
|
|
142
145
|
return reps
|
|
143
146
|
|
|
144
147
|
|
|
148
|
+
class Dc(TortModel):
|
|
149
|
+
id: int = SmallIntField(True)
|
|
150
|
+
ip = CharField(15, unique=True)
|
|
151
|
+
pub = CharField(495, null=True)
|
|
152
|
+
|
|
153
|
+
apps: BackwardFKRelation["App"]
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class Fcm(TortModel):
|
|
157
|
+
id: int = SmallIntField(True)
|
|
158
|
+
json: dict = JSONField(default={})
|
|
159
|
+
|
|
160
|
+
apps: BackwardFKRelation["App"]
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class App(Model):
|
|
164
|
+
hsh = CharField(32, unique=True)
|
|
165
|
+
dc: ForeignKeyRelation[Dc] = ForeignKeyField("models.Dc", "apps", default=2)
|
|
166
|
+
dc_id: int
|
|
167
|
+
title = CharField(127)
|
|
168
|
+
short = CharField(76)
|
|
169
|
+
ver = CharField(18, default="0.0.1")
|
|
170
|
+
fcm: ForeignKeyNullableRelation[Fcm] = ForeignKeyField("models.Fcm", "apps", null=True)
|
|
171
|
+
fcm_id: int
|
|
172
|
+
# owner: OneToOneRelation["User"] = OneToOneField("models.User", "app")
|
|
173
|
+
|
|
174
|
+
sessions: BackwardFKRelation["Session"]
|
|
175
|
+
|
|
176
|
+
|
|
145
177
|
class Session(TortModel):
|
|
146
|
-
id = CharField(
|
|
147
|
-
|
|
148
|
-
api_id
|
|
178
|
+
id = CharField(85, primary_key=True)
|
|
179
|
+
api: ForeignKeyRelation[App] = ForeignKeyField("models.App", "sessions")
|
|
180
|
+
api_id: int
|
|
149
181
|
test_mode = BooleanField(default=False)
|
|
150
182
|
auth_key = BinaryField(null=True)
|
|
151
|
-
date = IntField(
|
|
183
|
+
date = IntField(default=0) # todo: refact to datetime?
|
|
152
184
|
user: ForeignKeyNullableRelation[Username] = ForeignKeyField("models.Username", "sessions", null=True)
|
|
153
185
|
user_id: int
|
|
154
|
-
is_bot =
|
|
186
|
+
is_bot = CharField(42, null=True)
|
|
155
187
|
state: dict = JSONField(default={})
|
|
156
188
|
proxy: ForeignKeyNullableRelation[Proxy] = ForeignKeyField("models.Proxy", "sessions", null=True)
|
|
157
189
|
|
|
@@ -159,7 +191,7 @@ class Session(TortModel):
|
|
|
159
191
|
update_states: BackwardFKRelation["UpdateState"]
|
|
160
192
|
|
|
161
193
|
class Meta:
|
|
162
|
-
unique_together = (("user_id", "
|
|
194
|
+
unique_together = (("user_id", "api_id"),)
|
|
163
195
|
|
|
164
196
|
|
|
165
197
|
class Peer(TortModel):
|
|
@@ -169,7 +201,7 @@ class Peer(TortModel):
|
|
|
169
201
|
session: ForeignKeyRelation[Session] = ForeignKeyField("models.Session", "peers")
|
|
170
202
|
session_id: int
|
|
171
203
|
type = CharField(127)
|
|
172
|
-
phone_number = BigIntField(null=True)
|
|
204
|
+
phone_number = BigIntField(null=True) # todo: rm (already moved to Username.phone)
|
|
173
205
|
last_update_on: datetime | None = DatetimeSecField(auto_now=True)
|
|
174
206
|
|
|
175
207
|
class Meta:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|