xync-schema 0.6.36.dev4__py3-none-any.whl → 0.6.38__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/models.py +20 -21
- xync_schema-0.6.38.dist-info/METADATA +186 -0
- xync_schema-0.6.38.dist-info/RECORD +8 -0
- {xync_schema-0.6.36.dev4.dist-info → xync_schema-0.6.38.dist-info}/WHEEL +1 -1
- xync_schema-0.6.36.dev4.dist-info/METADATA +0 -47
- xync_schema-0.6.36.dev4.dist-info/RECORD +0 -8
- {xync_schema-0.6.36.dev4.dist-info → xync_schema-0.6.38.dist-info}/top_level.txt +0 -0
xync_schema/models.py
CHANGED
|
@@ -7,29 +7,29 @@ from x_auth.models import Model
|
|
|
7
7
|
from x_model.models import TsTrait, DatetimeSecField
|
|
8
8
|
from tg_auth.models import UserStatus, AuthUser
|
|
9
9
|
|
|
10
|
-
from xync_schema.enums import ExType, AdStatus,
|
|
10
|
+
from xync_schema.enums import ExType, AdStatus, AssetType, OrderStatus, ExAction
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class Country(Model):
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
# class Country(Model):
|
|
14
|
+
# id = fields.SmallIntField(True)
|
|
15
|
+
# code: int | None = fields.IntField(null=True)
|
|
16
|
+
# short: str | None = fields.CharField(3, unique=True, null=True)
|
|
17
|
+
# name: str | None = fields.CharField(63, unique=True, null=True)
|
|
18
|
+
# cur: fields.ForeignKeyRelation["Cur"] = fields.ForeignKeyField("models.Cur", related_name="countries")
|
|
19
|
+
# curexs: fields.ManyToManyRelation["Curex"]
|
|
20
|
+
# fiats: fields.BackwardFKRelation["Fiat"]
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class Cur(Model):
|
|
24
24
|
id = fields.SmallIntField(True)
|
|
25
25
|
ticker: str = fields.CharField(3, unique=True)
|
|
26
26
|
rate: float | None = fields.FloatField(null=True)
|
|
27
|
-
country: str | None = fields.CharField(63, null=True)
|
|
27
|
+
# country: str | None = fields.CharField(63, null=True)
|
|
28
28
|
|
|
29
29
|
pms: fields.ManyToManyRelation["Pm"] = fields.ManyToManyField("models.Pm", through="pmcur")
|
|
30
30
|
exs: fields.ManyToManyRelation["Ex"] = fields.ManyToManyField("models.Ex", through="curex")
|
|
31
31
|
pairs: fields.ReverseRelation["Pair"]
|
|
32
|
-
countries: fields.ReverseRelation[Country]
|
|
32
|
+
# countries: fields.ReverseRelation[Country]
|
|
33
33
|
|
|
34
34
|
_name = {"ticker"}
|
|
35
35
|
|
|
@@ -92,9 +92,9 @@ class Curex(BaseModel):
|
|
|
92
92
|
ex: fields.ForeignKeyRelation[Ex] = fields.ForeignKeyField("models.Ex")
|
|
93
93
|
exid: str = fields.CharField(31)
|
|
94
94
|
p2p: bool = fields.BooleanField(default=True)
|
|
95
|
-
countries: fields.ManyToManyRelation[Country] = fields.ManyToManyField(
|
|
96
|
-
|
|
97
|
-
)
|
|
95
|
+
# countries: fields.ManyToManyRelation[Country] = fields.ManyToManyField(
|
|
96
|
+
# "models.Country", through="curexcountry", backward_key="curexs"
|
|
97
|
+
# )
|
|
98
98
|
|
|
99
99
|
class Meta:
|
|
100
100
|
table_description = "Currency in Exchange"
|
|
@@ -246,12 +246,11 @@ class Ad(Model, TsTrait):
|
|
|
246
246
|
|
|
247
247
|
|
|
248
248
|
class Pm(Model):
|
|
249
|
-
name: str = fields.CharField(63, unique=
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
type_:
|
|
249
|
+
name: str = fields.CharField(63, unique=False)
|
|
250
|
+
identifier: str | None = fields.CharField(63, unique=False, null=True)
|
|
251
|
+
# type_: PmType | None = fields.IntEnumField(PmType, null=True)
|
|
252
|
+
type_: int | None = fields.SmallIntField(null=True)
|
|
253
253
|
logo: str | None = fields.CharField(127, null=True)
|
|
254
|
-
multiAllow: bool | None = fields.BooleanField(null=True)
|
|
255
254
|
|
|
256
255
|
ads: fields.ManyToManyRelation[Ad]
|
|
257
256
|
curs: fields.ManyToManyRelation[Cur]
|
|
@@ -310,8 +309,8 @@ class Pmcurex(BaseModel): # existence pm in ex for exact cur, with "blocked" fl
|
|
|
310
309
|
class Fiat(Model):
|
|
311
310
|
pmcur: fields.ForeignKeyRelation[Pmcur] = fields.ForeignKeyField("models.Pmcur")
|
|
312
311
|
pmcur_id: int
|
|
313
|
-
country: fields.ForeignKeyRelation[Country] = fields.ForeignKeyField("models.Country", related_name="fiats")
|
|
314
|
-
country_id: int
|
|
312
|
+
# country: fields.ForeignKeyRelation[Country] = fields.ForeignKeyField("models.Country", related_name="fiats")
|
|
313
|
+
# country_id: int
|
|
315
314
|
detail: str = fields.CharField(127)
|
|
316
315
|
name: str | None = fields.CharField(127, null=True)
|
|
317
316
|
user: fields.ForeignKeyRelation[User] = fields.ForeignKeyField("models.User", "fiats")
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: xync-schema
|
|
3
|
+
Version: 0.6.38
|
|
4
|
+
Summary: XyncNet project database model schema
|
|
5
|
+
Author-email: Mike Artemiev <mixartemev@gmail.com>
|
|
6
|
+
License: EULA
|
|
7
|
+
Project-URL: Homepage, https://gitlab.com/xync/back/schema
|
|
8
|
+
Project-URL: Repository, https://gitlab.com/xync/back/schema
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: xtg-auth
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: build ; extra == 'dev'
|
|
14
|
+
Requires-Dist: pytest-asyncio ; extra == 'dev'
|
|
15
|
+
Requires-Dist: twine ; extra == 'dev'
|
|
16
|
+
|
|
17
|
+
## INSTALL
|
|
18
|
+
```bash
|
|
19
|
+
# Create python virtual environment
|
|
20
|
+
python3 -m venv venv
|
|
21
|
+
# Activate this environment
|
|
22
|
+
source venv/bin/activate
|
|
23
|
+
# Install dependencies
|
|
24
|
+
pip install -r requirements.dev.txt
|
|
25
|
+
|
|
26
|
+
# Create pg db
|
|
27
|
+
createdb --U username -W dbname
|
|
28
|
+
## set password for db user
|
|
29
|
+
|
|
30
|
+
# Copy .env file from sample template
|
|
31
|
+
cp .env.sample .env
|
|
32
|
+
## set your pg creds in .env file
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## TEST
|
|
36
|
+
```bash
|
|
37
|
+
pytest
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### pre-commit
|
|
42
|
+
You can done `commit` only after `pytest` will done success.
|
|
43
|
+
Pre-commit script stored in `.git/hooks/pre-commit` file; current script is:
|
|
44
|
+
```shell
|
|
45
|
+
#!/bin/sh
|
|
46
|
+
pytest
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Relations
|
|
50
|
+
```mermaid
|
|
51
|
+
classDiagram
|
|
52
|
+
direction BT
|
|
53
|
+
class Agent {
|
|
54
|
+
timestamp(0) with time zone created_at
|
|
55
|
+
timestamp(0) with time zone updated_at
|
|
56
|
+
integer exid
|
|
57
|
+
jsonb auth
|
|
58
|
+
smallint ex_id
|
|
59
|
+
bigint user_id
|
|
60
|
+
integer id
|
|
61
|
+
}
|
|
62
|
+
class Asset {
|
|
63
|
+
smallint type_ /* spot: 1\nearn: 2\nfound: 3 */
|
|
64
|
+
double precision free
|
|
65
|
+
double precision freeze
|
|
66
|
+
double precision lock
|
|
67
|
+
double precision target
|
|
68
|
+
integer agent_id
|
|
69
|
+
smallint coin_id
|
|
70
|
+
integer id
|
|
71
|
+
}
|
|
72
|
+
class Coin {
|
|
73
|
+
varchar(15) ticker
|
|
74
|
+
double precision rate
|
|
75
|
+
boolean is_fiat
|
|
76
|
+
smallint id
|
|
77
|
+
}
|
|
78
|
+
class CoinEx {
|
|
79
|
+
varchar(31) exid
|
|
80
|
+
boolean p2p
|
|
81
|
+
smallint coin_id
|
|
82
|
+
smallint ex_id
|
|
83
|
+
integer id
|
|
84
|
+
}
|
|
85
|
+
class Cur {
|
|
86
|
+
varchar(3) ticker
|
|
87
|
+
double precision rate
|
|
88
|
+
smallint id
|
|
89
|
+
}
|
|
90
|
+
class CurEx {
|
|
91
|
+
varchar(31) exid
|
|
92
|
+
boolean p2p
|
|
93
|
+
smallint cur_id
|
|
94
|
+
smallint ex_id
|
|
95
|
+
integer id
|
|
96
|
+
}
|
|
97
|
+
class Ex {
|
|
98
|
+
varchar(31) name
|
|
99
|
+
varchar(63) host /* With no protocol 'https://' */
|
|
100
|
+
varchar(63) host_p2p /* With no protocol 'https://' */
|
|
101
|
+
varchar(63) url_login /* With no protocol 'https://' */
|
|
102
|
+
smallint type_ /* p2p: 1\ncex: 2\nmain: 3\ndex: 4\nfutures: 8 */
|
|
103
|
+
varchar(511) logo
|
|
104
|
+
smallint id
|
|
105
|
+
}
|
|
106
|
+
class Fiat {
|
|
107
|
+
varchar(127) detail
|
|
108
|
+
varchar(127) name
|
|
109
|
+
double precision amount
|
|
110
|
+
double precision target
|
|
111
|
+
integer pmcur_id
|
|
112
|
+
bigint user_id
|
|
113
|
+
integer id
|
|
114
|
+
}
|
|
115
|
+
class FiatEx {
|
|
116
|
+
integer exid
|
|
117
|
+
smallint ex_id
|
|
118
|
+
integer fiat_id
|
|
119
|
+
integer id
|
|
120
|
+
}
|
|
121
|
+
class Limit {
|
|
122
|
+
integer amount
|
|
123
|
+
integer unit
|
|
124
|
+
integer level
|
|
125
|
+
boolean income
|
|
126
|
+
bigint added_by_id
|
|
127
|
+
integer pmcur_id
|
|
128
|
+
integer id
|
|
129
|
+
}
|
|
130
|
+
class Pm {
|
|
131
|
+
varchar(63) name
|
|
132
|
+
smallint rank
|
|
133
|
+
smallint type_ /* bank: 0\nweb_wallet: 1\ncash: 2\ngift_card: 3\ncredit_card: 4 */
|
|
134
|
+
varchar(127) logo
|
|
135
|
+
boolean multiAllow
|
|
136
|
+
integer id
|
|
137
|
+
}
|
|
138
|
+
class PmCur {
|
|
139
|
+
smallint cur_id
|
|
140
|
+
integer pm_id
|
|
141
|
+
integer id
|
|
142
|
+
}
|
|
143
|
+
class PmCurEx {
|
|
144
|
+
boolean blocked
|
|
145
|
+
smallint ex_id
|
|
146
|
+
integer pmcur_id
|
|
147
|
+
integer id
|
|
148
|
+
}
|
|
149
|
+
class PmEx {
|
|
150
|
+
varchar(31) exid
|
|
151
|
+
smallint ex_id
|
|
152
|
+
integer pm_id
|
|
153
|
+
integer id
|
|
154
|
+
}
|
|
155
|
+
class User {
|
|
156
|
+
timestamp(0) with time zone created_at
|
|
157
|
+
timestamp(0) with time zone updated_at
|
|
158
|
+
smallint role /* READER: 4\nWRITER: 2\nMANAGER: 6\nADMIN: 7 */
|
|
159
|
+
smallint status /* CREATOR: 5\nADMINISTRATOR: 4\nMEMBER: 3\nRESTRICTED: 2\nLEFT:... */
|
|
160
|
+
varchar(95) username
|
|
161
|
+
bigint ref_id
|
|
162
|
+
bigint id
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
Agent --> Ex : ex_id-id
|
|
166
|
+
Agent --> User : user_id-id
|
|
167
|
+
Asset --> Agent : agent_id-id
|
|
168
|
+
Asset --> Coin : coin_id-id
|
|
169
|
+
CoinEx --> Coin : coin_id-id
|
|
170
|
+
CoinEx --> Ex : ex_id-id
|
|
171
|
+
CurEx --> Cur : cur_id-id
|
|
172
|
+
CurEx --> Ex : ex_id-id
|
|
173
|
+
Fiat --> PmCur : pmcur_id-id
|
|
174
|
+
Fiat --> User : user_id-id
|
|
175
|
+
FiatEx --> Ex : ex_id-id
|
|
176
|
+
FiatEx --> Fiat : fiat_id-id
|
|
177
|
+
Limit --> PmCur : pmcur_id-id
|
|
178
|
+
Limit --> User : added_by_id-id
|
|
179
|
+
PmCur --> Cur : cur_id-id
|
|
180
|
+
PmCur --> Pm : pm_id-id
|
|
181
|
+
PmCurEx --> Ex : ex_id-id
|
|
182
|
+
PmCurEx --> PmCur : pmcur_id-id
|
|
183
|
+
PmEx --> Ex : ex_id-id
|
|
184
|
+
PmEx --> Pm : pm_id-id
|
|
185
|
+
User --> User : ref_id-id
|
|
186
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
xync_schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
xync_schema/enums.py,sha256=oOpyfG2i1-UKD8Udh2sVBIMUHTIhKZMPIA6Rh7lqnDA,10013
|
|
3
|
+
xync_schema/models.py,sha256=6O9YYmwjqDF5e-Oe-38B3t-b8rH5AIuPw_2nLw5RT5I,20070
|
|
4
|
+
xync_schema/pydantic.py,sha256=cyviSX1P2Cj6fLFq_IsrYdWB6gBOYwR4adPXrAmlP7g,274
|
|
5
|
+
xync_schema-0.6.38.dist-info/METADATA,sha256=peqU_tPkRmXAUDEVxg1kbKvi8Oo7lce1pUceGWzGNVA,3988
|
|
6
|
+
xync_schema-0.6.38.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
|
7
|
+
xync_schema-0.6.38.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
|
|
8
|
+
xync_schema-0.6.38.dist-info/RECORD,,
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: xync-schema
|
|
3
|
-
Version: 0.6.36.dev4
|
|
4
|
-
Summary: XyncNet project database model schema
|
|
5
|
-
Author-email: Mike Artemiev <mixartemev@gmail.com>
|
|
6
|
-
License: EULA
|
|
7
|
-
Project-URL: Homepage, https://gitlab.com/xync/back/schema
|
|
8
|
-
Project-URL: Repository, https://gitlab.com/xync/back/schema
|
|
9
|
-
Requires-Python: >=3.12
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
Requires-Dist: xtg-auth
|
|
12
|
-
Provides-Extra: dev
|
|
13
|
-
Requires-Dist: build ; extra == 'dev'
|
|
14
|
-
Requires-Dist: pytest-asyncio ; extra == 'dev'
|
|
15
|
-
Requires-Dist: twine ; extra == 'dev'
|
|
16
|
-
|
|
17
|
-
## INSTALL
|
|
18
|
-
```bash
|
|
19
|
-
# Create python virtual environment
|
|
20
|
-
python3 -m venv venv
|
|
21
|
-
# Activate this environment
|
|
22
|
-
source venv/bin/activate
|
|
23
|
-
# Install dependencies
|
|
24
|
-
pip install -r requirements.dev.txt
|
|
25
|
-
|
|
26
|
-
# Create pg db
|
|
27
|
-
createdb --U username -W dbname
|
|
28
|
-
## set password for db user
|
|
29
|
-
|
|
30
|
-
# Copy .env file from sample template
|
|
31
|
-
cp .env.sample .env
|
|
32
|
-
## set your pg creds in .env file
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## TEST
|
|
36
|
-
```bash
|
|
37
|
-
pytest
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### pre-commit
|
|
42
|
-
You can done `commit` only after `pytest` will done success.
|
|
43
|
-
Pre-commit script stored in `.git/hooks/pre-commit` file; current script is:
|
|
44
|
-
```shell
|
|
45
|
-
#!/bin/sh
|
|
46
|
-
pytest
|
|
47
|
-
```
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
xync_schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
xync_schema/enums.py,sha256=oOpyfG2i1-UKD8Udh2sVBIMUHTIhKZMPIA6Rh7lqnDA,10013
|
|
3
|
-
xync_schema/models.py,sha256=x5RiBV1Wvqwu9TSezDyGtyXqIQBhbDZJM6EOVl2F4t0,20106
|
|
4
|
-
xync_schema/pydantic.py,sha256=cyviSX1P2Cj6fLFq_IsrYdWB6gBOYwR4adPXrAmlP7g,274
|
|
5
|
-
xync_schema-0.6.36.dev4.dist-info/METADATA,sha256=IUQNxQiWCi4OTgIw2weBWFIlIeqO-RgGmnatwGJBNaQ,1099
|
|
6
|
-
xync_schema-0.6.36.dev4.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
|
|
7
|
-
xync_schema-0.6.36.dev4.dist-info/top_level.txt,sha256=jN8IBDfVY8b85Byyk8v0Gyj_0yLB8FO56WV4EvcXWY4,12
|
|
8
|
-
xync_schema-0.6.36.dev4.dist-info/RECORD,,
|
|
File without changes
|