xync-db 0.5.5.dev12__tar.gz → 0.5.5.dev15__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.
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/PKG-INFO +2 -2
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/enums.py +3 -13
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/models/CLAUDE.md +3 -1
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/models/__init__.py +4 -21
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/.gitignore +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/README.md +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/pyproject.toml +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/__init__.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/config.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/exceptions.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/graph.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/i18n.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/login_store.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/logo.png +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/CLAUDE.md +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/__init__.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/0001_initial.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/0002_triggers.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/0003_seed.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/__init__.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/__init__.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/a_actor_seed.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/a_bin_seed.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/a_country_seed.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/a_tg_seed.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/b_htx_seed.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/c_net_seed.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/countries.json +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/ranges.csv +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/xync_files.sql +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/py.typed +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/shared.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/typs/__init__.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/typs/db/__init__.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/typs/db/actor.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/typs/db/ad.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/typs/db/common.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/typs/db/cred.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/typs/db/order.py +0 -0
- {xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/typs/db/pm.py +0 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from enum import IntEnum
|
|
2
2
|
|
|
3
|
+
# FileType живёт в pyro-client (там же модель File) — здесь только реэкспорт для обратной совместимости
|
|
4
|
+
from pyro_client.enums import FileType # noqa: F401
|
|
5
|
+
|
|
3
6
|
ZERO_TS = 1770000000 # Feb 02 2026 02:40:00 (UTC)
|
|
4
7
|
|
|
5
8
|
|
|
@@ -164,19 +167,6 @@ class TaskType(IntEnum):
|
|
|
164
167
|
order_user_define = 2
|
|
165
168
|
|
|
166
169
|
|
|
167
|
-
class FileType(IntEnum):
|
|
168
|
-
pdf = 1
|
|
169
|
-
jpg = 2
|
|
170
|
-
png = 3
|
|
171
|
-
webp = 4
|
|
172
|
-
mov = 5
|
|
173
|
-
mp4 = 6
|
|
174
|
-
gif = 7
|
|
175
|
-
svg = 8
|
|
176
|
-
tgs = 9
|
|
177
|
-
jpeg = 10
|
|
178
|
-
|
|
179
|
-
|
|
180
170
|
class AgentStatus(IntEnum):
|
|
181
171
|
off = 0
|
|
182
172
|
race = 1
|
|
@@ -105,6 +105,8 @@ actor.set_user(username_id):
|
|
|
105
105
|
### Management
|
|
106
106
|
`Limit`, `ExStat`, `Vpn`, `Invite`, `Credit`, `File`
|
|
107
107
|
|
|
108
|
+
`File` (и enum `FileType`) объявлены в пакете `pyro-client` (`pyro_client/models.py`, `pyro_client/enums.py`) — рядом с `FileClient`, который их пишет; сюда только реэкспортируются (`xync_db.models.File`, `xync_db.enums.FileType`), так что для tortoise они остаются в app `models`.
|
|
109
|
+
|
|
108
110
|
## ORM gotchas
|
|
109
111
|
|
|
110
112
|
### `exclude(**kwargs)` negates each kwarg separately (NOT Django's `NOT(AND)`)
|
|
@@ -135,6 +137,6 @@ PmAgent.client() -> xync_client.Pms.{pm.norm}.agent
|
|
|
135
137
|
|
|
136
138
|
## Enums
|
|
137
139
|
|
|
138
|
-
All enums are in `xync_db/enums.py` (all `IntEnum`). Key ones: `AdStatus`, `OrderStatus`, `OrderAction`, `OrderErr`, `ExType`, `ExStatus`, `ExAction` (~50 actions), `PmType`, `TransactionStatus`, `PersonStatus`, `UserStatus`, `HotStatus`, `FileType`, `DepType`, `AgentStatus`.
|
|
140
|
+
All enums are in `xync_db/enums.py` (all `IntEnum`; `FileType` реэкспортируется из `pyro_client.enums`). Key ones: `AdStatus`, `OrderStatus`, `OrderAction`, `OrderErr`, `ExType`, `ExStatus`, `ExAction` (~50 actions), `PmType`, `TransactionStatus`, `PersonStatus`, `UserStatus`, `HotStatus`, `FileType`, `DepType`, `AgentStatus`.
|
|
139
141
|
|
|
140
142
|
`TransactionStatus` is imported as `TS` alias in this file.
|
|
@@ -14,6 +14,9 @@ from uuid import UUID
|
|
|
14
14
|
from aiohttp import ClientSession
|
|
15
15
|
from cryptography.exceptions import InvalidSignature
|
|
16
16
|
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey, Ed25519PublicKey
|
|
17
|
+
|
|
18
|
+
# noinspection PyUnusedImports
|
|
19
|
+
from pyro_client.models import File # noqa: F401
|
|
17
20
|
from tortoise import BackwardFKRelation, BackwardOneToOneRelation, BaseDBAsyncClient, connections
|
|
18
21
|
from tortoise import Model as BaseModel
|
|
19
22
|
from tortoise.expressions import Q
|
|
@@ -74,7 +77,6 @@ from xync_db.enums import (
|
|
|
74
77
|
ExAction,
|
|
75
78
|
ExStatus,
|
|
76
79
|
ExType,
|
|
77
|
-
FileType,
|
|
78
80
|
HotStatus,
|
|
79
81
|
LinkType,
|
|
80
82
|
OrderErr,
|
|
@@ -107,6 +109,7 @@ SHARE_HEX_EX_IDS = [4]
|
|
|
107
109
|
|
|
108
110
|
|
|
109
111
|
class Country(BaseCountry):
|
|
112
|
+
ccn3: int | None = UInt2Field(null=True) # числовой ISO 3166-1 (базовый `code` — телефонный)
|
|
110
113
|
cur: ForeignKeyRelation[Cur] = ForeignKeyField("models.Cur", "countries", on_update=CASCADE)
|
|
111
114
|
# curexs: ManyToManyRelation[CurEx]
|
|
112
115
|
# forbidden_exs: ManyToManyRelation[Ex]
|
|
@@ -2878,26 +2881,6 @@ class Vpn(Model):
|
|
|
2878
2881
|
table_description = "VPNs"
|
|
2879
2882
|
|
|
2880
2883
|
|
|
2881
|
-
class File(Model):
|
|
2882
|
-
name: str = CharField(255, null=True, unique=True)
|
|
2883
|
-
typ: FileType = IntEnumField(FileType)
|
|
2884
|
-
ref: bytes = UniqBinaryField(unique=True)
|
|
2885
|
-
size: int = UInt4Field()
|
|
2886
|
-
created_at: datetime | None = DatetimeSecField(auto_now_add=True, db_default=Now())
|
|
2887
|
-
|
|
2888
|
-
msg: BackwardOneToOneRelation[Msg]
|
|
2889
|
-
transfer: BackwardOneToOneRelation[Transfer]
|
|
2890
|
-
pmex_logos: BackwardFKRelation[PmEx]
|
|
2891
|
-
|
|
2892
|
-
_icon: ClassVar = "file"
|
|
2893
|
-
_name: ClassVar = {"name"}
|
|
2894
|
-
|
|
2895
|
-
class Meta:
|
|
2896
|
-
table_description = "Files"
|
|
2897
|
-
# Создаем индекс через raw SQL
|
|
2898
|
-
# indexes = [CREATE UNIQUE INDEX IF NOT EXISTS idx_bytea_unique ON file (encode(sha256(ref), 'hex'))"]
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
2884
|
class Invite(Model, TsTrait):
|
|
2902
2885
|
ref: ForeignKeyRelation[User] = ForeignKeyField("models.User", "invite_approvals", on_update=CASCADE)
|
|
2903
2886
|
ref_id: int
|
|
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
|
|
File without changes
|
{xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/a_actor_seed.py
RENAMED
|
File without changes
|
{xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/a_bin_seed.py
RENAMED
|
File without changes
|
{xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/a_country_seed.py
RENAMED
|
File without changes
|
|
File without changes
|
{xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/b_htx_seed.py
RENAMED
|
File without changes
|
{xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/c_net_seed.py
RENAMED
|
File without changes
|
{xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/countries.json
RENAMED
|
File without changes
|
|
File without changes
|
{xync_db-0.5.5.dev12 → xync_db-0.5.5.dev15}/src/xync_db/migrations/models/seed/xync_files.sql
RENAMED
|
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
|