xn-auth 0.2.31__py3-none-any.whl → 0.2.33__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.
x_auth/models.py CHANGED
@@ -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
 
@@ -65,8 +68,8 @@ class User(Model):
65
68
  async def is_blocked(cls, sid: str) -> bool:
66
69
  return (await cls[int(sid)]).blocked
67
70
 
68
- class Meta:
69
- abstract = True
71
+ # class Meta:
72
+ # abstract = True
70
73
 
71
74
 
72
75
  class Country(Model):
@@ -145,7 +148,7 @@ class Proxy(Model, TsTrait):
145
148
  class Dc(TortModel):
146
149
  id: int = SmallIntField(True)
147
150
  ip = CharField(15, unique=True)
148
- pub = CharField(495)
151
+ pub = CharField(495, null=True)
149
152
 
150
153
  apps: BackwardFKRelation["App"]
151
154
 
@@ -157,29 +160,30 @@ class Fcm(TortModel):
157
160
  apps: BackwardFKRelation["App"]
158
161
 
159
162
 
160
- class App(TortModel):
163
+ class App(Model):
161
164
  hsh = CharField(32, unique=True)
162
165
  dc: ForeignKeyRelation[Dc] = ForeignKeyField("models.Dc", "apps", default=2)
163
166
  dc_id: int
164
167
  title = CharField(127)
165
- short = CharField(95)
168
+ short = CharField(76)
169
+ ver = CharField(18, default="0.0.1")
166
170
  fcm: ForeignKeyNullableRelation[Fcm] = ForeignKeyField("models.Fcm", "apps", null=True)
167
171
  fcm_id: int
172
+ owner: OneToOneRelation["User"] = OneToOneField("models.User", "app")
168
173
 
169
174
  sessions: BackwardFKRelation["Session"]
170
175
 
171
176
 
172
177
  class Session(TortModel):
173
- id = CharField(127, primary_key=True)
174
- dc_id = IntField(null=True)
178
+ id = CharField(85, primary_key=True)
175
179
  api: ForeignKeyRelation[App] = ForeignKeyField("models.App", "sessions")
176
180
  api_id: int
177
181
  test_mode = BooleanField(default=False)
178
182
  auth_key = BinaryField(null=True)
179
- date = IntField(null=True) # todo: refact to datetime?
183
+ date = IntField(default=0) # todo: refact to datetime?
180
184
  user: ForeignKeyNullableRelation[Username] = ForeignKeyField("models.Username", "sessions", null=True)
181
185
  user_id: int
182
- is_bot = BooleanField(null=True)
186
+ is_bot = CharField(42, null=True)
183
187
  state: dict = JSONField(default={})
184
188
  proxy: ForeignKeyNullableRelation[Proxy] = ForeignKeyField("models.Proxy", "sessions", null=True)
185
189
 
@@ -187,7 +191,7 @@ class Session(TortModel):
187
191
  update_states: BackwardFKRelation["UpdateState"]
188
192
 
189
193
  class Meta:
190
- unique_together = (("user_id", "dc_id"),)
194
+ unique_together = (("user_id", "api_id"),)
191
195
 
192
196
 
193
197
  class Peer(TortModel):
@@ -197,7 +201,7 @@ class Peer(TortModel):
197
201
  session: ForeignKeyRelation[Session] = ForeignKeyField("models.Session", "peers")
198
202
  session_id: int
199
203
  type = CharField(127)
200
- phone_number = BigIntField(null=True)
204
+ phone_number = BigIntField(null=True) # todo: rm (already moved to Username.phone)
201
205
  last_update_on: datetime | None = DatetimeSecField(auto_now=True)
202
206
 
203
207
  class Meta:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xn-auth
3
- Version: 0.2.31
3
+ Version: 0.2.33
4
4
  Summary: Auth adapter for XN-Api framework
5
5
  Author-email: Artemiev <mixartemev@gmail.com>
6
6
  License: MIT
@@ -2,9 +2,9 @@ x_auth/controller.py,sha256=0QhqmqXOqFaWIUTWHlJKITQNmJQ5kXZOkLg7wSUTh60,2240
2
2
  x_auth/enums.py,sha256=kmkX-j1bWNpel6_-fw2YtMEmJSAj9w2iizkG03s3ZSU,631
3
3
  x_auth/exceptions.py,sha256=2B4okJxhPyNqTJXlSTfblJUQJ60bLGXdgJIu6ue7S6w,162
4
4
  x_auth/middleware.py,sha256=JfssQomDv0J_69GfS2a_2_uyRzs26zSY6IW1Vk7m8K0,2900
5
- x_auth/models.py,sha256=etxzc8ejaF4c2zhP6S1X4ysLW3By0dl3OfbxfgfKIrM,7396
5
+ x_auth/models.py,sha256=5N9DvItkYkSDvHTskAYTW4qCK0FY9MGJ_iBUjrv6jNU,7614
6
6
  x_auth/types.py,sha256=j3WGcyH24DmFEdTT6U7xzb_fEm1tFcBZsANKMy7bydo,689
7
- xn_auth-0.2.31.dist-info/METADATA,sha256=O7wgwTNe1P4Vy0YHJ3jjJlEGCWzHRGW1cJPLnl_vs2E,799
8
- xn_auth-0.2.31.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
9
- xn_auth-0.2.31.dist-info/top_level.txt,sha256=ydMDkzxgQPtW-E_MNDfUAroAFZvWSqU-x_kZSA7NSFo,7
10
- xn_auth-0.2.31.dist-info/RECORD,,
7
+ xn_auth-0.2.33.dist-info/METADATA,sha256=ZVPjVhXD2_LoQhakKS5IG4wsyqnoPcWDd8Jw0JNJ3jE,799
8
+ xn_auth-0.2.33.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
9
+ xn_auth-0.2.33.dist-info/top_level.txt,sha256=ydMDkzxgQPtW-E_MNDfUAroAFZvWSqU-x_kZSA7NSFo,7
10
+ xn_auth-0.2.33.dist-info/RECORD,,