xync-db 0.1.2__tar.gz → 0.1.4__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.1.2 → xync_db-0.1.4}/PKG-INFO +1 -1
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/models/__init__.py +27 -1
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/typs/db/cred.py +1 -1
- {xync_db-0.1.2 → xync_db-0.1.4}/.gitignore +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/README.md +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/pyproject.toml +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/__init__.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/config.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/enums.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/exceptions.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/graph.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/i18n.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/logo.png +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/CLAUDE.md +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/__init__.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/models/0001_initial.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/models/0002_triggers.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/models/0003_files_seed.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/models/0004_all_seed.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/models/__init__.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/models/seed/__init__.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/models/seed/a_actor_seed.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/models/seed/a_tg_seed.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/models/seed/b_htx_seed.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/migrations/models/seed/xync_files.sql +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/models/CLAUDE.md +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/py.typed +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/shared.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/typs/__init__.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/typs/db/__init__.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/typs/db/actor.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/typs/db/ad.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/typs/db/common.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/typs/db/order.py +0 -0
- {xync_db-0.1.2 → xync_db-0.1.4}/src/xync_db/typs/db/pm.py +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
import re
|
|
4
5
|
import struct
|
|
5
6
|
import sys
|
|
6
7
|
from datetime import datetime
|
|
@@ -1406,6 +1407,31 @@ class Cred(Model):
|
|
|
1406
1407
|
name = f", имя: {self.name}" if self.name else ""
|
|
1407
1408
|
return f"`{self.detail}`{name}{xtr}"
|
|
1408
1409
|
|
|
1410
|
+
async def set_ovr_pm(self) -> bool:
|
|
1411
|
+
"""Вывести «оверрайд-PM» по detail/extra и проставить его. XyncPay-кред → ovr_pm_id=0 (hot,
|
|
1412
|
+
размножается по биржам); Volet/AdvCash (или его R/E/U/T/L/D-карточный паттерн) → Pm `volet`.
|
|
1413
|
+
Идемпотентно — пишет только при реальном изменении, поэтому безопасно звать на КАЖДОМ create И
|
|
1414
|
+
update креда без зацикливания триггера `creds_upd`. Возвращает True, если ovr_pm_id поменялся."""
|
|
1415
|
+
extra = self.extra or ""
|
|
1416
|
+
if "XyncPay" in self.detail or "XyncPay" in extra:
|
|
1417
|
+
ovr: int | None = 0
|
|
1418
|
+
elif (
|
|
1419
|
+
"volet" in self.detail.lower()
|
|
1420
|
+
or "advcash" in self.detail.lower()
|
|
1421
|
+
or "volet" in extra.lower()
|
|
1422
|
+
or "advcash" in extra.lower()
|
|
1423
|
+
or re.match(r"[REUTLD]\d{4} ?\d{4} ?\d{4}\b", self.detail)
|
|
1424
|
+
or re.match(r"[REUTLD]\d{4} ?\d{4} ?\d{4}\b", extra)
|
|
1425
|
+
):
|
|
1426
|
+
ovr = (await Pm.get(norm="volet")).id
|
|
1427
|
+
else:
|
|
1428
|
+
return False
|
|
1429
|
+
if self.ovr_pm_id == ovr:
|
|
1430
|
+
return False
|
|
1431
|
+
self.ovr_pm_id = ovr
|
|
1432
|
+
await self.save(update_fields=["ovr_pm_id"])
|
|
1433
|
+
return True
|
|
1434
|
+
|
|
1409
1435
|
class Meta:
|
|
1410
1436
|
table_description = "Currency accounts"
|
|
1411
1437
|
unique_together = (("person", "pmcur", "ovr_pm"), ("person", "pmcur", "detail"))
|
|
@@ -1710,7 +1736,7 @@ class Order(Model, TsTrait):
|
|
|
1710
1736
|
sql = """
|
|
1711
1737
|
SELECT pg_notify(
|
|
1712
1738
|
CASE WHEN o.status = $1 AND NOT ps.is_sell THEN 'hot_order_upd_status' ELSE 'hot_order_new' END,
|
|
1713
|
-
CASE WHEN o.status = $1 AND NOT ps.is_sell THEN jsonb_build_array(row_to_json(o), $2)::text
|
|
1739
|
+
CASE WHEN o.status = $1 AND NOT ps.is_sell THEN jsonb_build_array(row_to_json(o), $2::smallint)::text
|
|
1714
1740
|
ELSE row_to_json(o)::text END
|
|
1715
1741
|
)
|
|
1716
1742
|
FROM "order" o
|
|
@@ -30,7 +30,7 @@ class CredXE(_Cred, ExidXE):
|
|
|
30
30
|
async def guess_cur(self, pre_curs: list[Cur] | None = None):
|
|
31
31
|
curs: dict[int | str, int] = {c.ticker: c.id for c in pre_curs or await Cur.all()}
|
|
32
32
|
for cur, cid in curs.items():
|
|
33
|
-
if re.search(re.compile(rf"\({cur}\)"), self.extra + self.detail):
|
|
33
|
+
if re.search(re.compile(rf"\({cur}\)"), (self.extra or "") + self.detail):
|
|
34
34
|
return cid
|
|
35
35
|
# todo: хуйня какая-то, ищет в extra ориг название платежки. удалить?
|
|
36
36
|
# lower_extras = [mb.lower() for mb in self.extra.split(" | ")]
|
|
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
|
|
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
|