nsarchive 0.0.5a0__py3-none-any.whl → 0.0.7a0__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.
- nsarchive/__init__.py +34 -2
- nsarchive/cls/bank.py +7 -0
- {nsarchive-0.0.5a0.dist-info → nsarchive-0.0.7a0.dist-info}/METADATA +1 -1
- nsarchive-0.0.7a0.dist-info/RECORD +9 -0
- nsarchive-0.0.5a0.dist-info/RECORD +0 -8
- {nsarchive-0.0.5a0.dist-info → nsarchive-0.0.7a0.dist-info}/LICENSE +0 -0
- {nsarchive-0.0.5a0.dist-info → nsarchive-0.0.7a0.dist-info}/WHEEL +0 -0
nsarchive/__init__.py
CHANGED
@@ -4,6 +4,7 @@ import deta
|
|
4
4
|
|
5
5
|
from .cls.entities import *
|
6
6
|
from .cls.votes import *
|
7
|
+
from .cls.bank import *
|
7
8
|
|
8
9
|
from .cls.exceptions import *
|
9
10
|
|
@@ -55,7 +56,7 @@ class EntityInstance:
|
|
55
56
|
}
|
56
57
|
|
57
58
|
if type(entity) == Organization:
|
58
|
-
_data['owner_id'] = entity.owner.upper() if entity.owner else "0"
|
59
|
+
_data['owner_id'] = entity.owner.id.upper() if entity.owner else "0"
|
59
60
|
_data['members'] = [ member.id.upper() for member in entity.members ] if entity.members else []
|
60
61
|
_data['certifications'] = entity.certifications
|
61
62
|
elif type(entity) == User:
|
@@ -135,4 +136,35 @@ class RepublicInstance:
|
|
135
136
|
'choices': vote.choices
|
136
137
|
}
|
137
138
|
|
138
|
-
self.votes.put(_data, vote.id.upper())
|
139
|
+
self.votes.put(_data, vote.id.upper())
|
140
|
+
|
141
|
+
class BankInstance:
|
142
|
+
def __init__(self, token: str) -> None:
|
143
|
+
self.db = deta.Deta(token)
|
144
|
+
self.accounts = self.db.Base('accounts')
|
145
|
+
self.registry = self.db.Base('banks')
|
146
|
+
|
147
|
+
def get_account(self, id: str) -> BankAccount:
|
148
|
+
id = id.upper()
|
149
|
+
_data = self.accounts.get(id)
|
150
|
+
|
151
|
+
if _data is None:
|
152
|
+
return None
|
153
|
+
|
154
|
+
acc = BankAccount(id)
|
155
|
+
acc.amount = _data['amount']
|
156
|
+
acc.locked = _data['locked']
|
157
|
+
acc.owner = _data['owner_id']
|
158
|
+
acc.bank = _data['bank']
|
159
|
+
|
160
|
+
return acc
|
161
|
+
|
162
|
+
def save_account(self, acc: BankAccount):
|
163
|
+
_data = {
|
164
|
+
'amount': acc.amount,
|
165
|
+
'locked': acc.locked,
|
166
|
+
'owner_id': acc.owner,
|
167
|
+
'bank': acc.bank
|
168
|
+
}
|
169
|
+
|
170
|
+
self.accounts.put(_data, acc.id.upper())
|
nsarchive/cls/bank.py
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
nsarchive/__init__.py,sha256=3zNWlcKF5Cs5ZCgVY_i4RbHdbMTDVWRlZa_8JtlrqFU,5492
|
2
|
+
nsarchive/cls/bank.py,sha256=OactEpRn8PGv7BwnBUbMpzgHqrvv4yx526AMzh9uBO8,220
|
3
|
+
nsarchive/cls/entities.py,sha256=mhBHZBtYK1E2dfTDoFHNdw1uu5QsnOc-Utuu5EjtV7c,2556
|
4
|
+
nsarchive/cls/exceptions.py,sha256=TrH9PvHhVZi7wap9ZfBLGRWJY3OBCYgWAMnco5uadYY,420
|
5
|
+
nsarchive/cls/votes.py,sha256=qaWVgfhk5GBccilFSwoZ0E9qE--IX_3HuOBoQAHD2jA,502
|
6
|
+
nsarchive-0.0.7a0.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
|
7
|
+
nsarchive-0.0.7a0.dist-info/METADATA,sha256=NAWRyMMcf3NkeYj9eSSmF_E52Goabm8ruXA8fr_N2sU,5554
|
8
|
+
nsarchive-0.0.7a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
9
|
+
nsarchive-0.0.7a0.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
nsarchive/__init__.py,sha256=f6avf_TRSHQklWkFGRSJzNtyDNWnCutnjiBIiWBlYq4,4610
|
2
|
-
nsarchive/cls/entities.py,sha256=mhBHZBtYK1E2dfTDoFHNdw1uu5QsnOc-Utuu5EjtV7c,2556
|
3
|
-
nsarchive/cls/exceptions.py,sha256=TrH9PvHhVZi7wap9ZfBLGRWJY3OBCYgWAMnco5uadYY,420
|
4
|
-
nsarchive/cls/votes.py,sha256=qaWVgfhk5GBccilFSwoZ0E9qE--IX_3HuOBoQAHD2jA,502
|
5
|
-
nsarchive-0.0.5a0.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
|
6
|
-
nsarchive-0.0.5a0.dist-info/METADATA,sha256=kDdN3hsmA4jI-otKdw4KTebT1z2LctPdvFD3qM7W66s,5554
|
7
|
-
nsarchive-0.0.5a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
8
|
-
nsarchive-0.0.5a0.dist-info/RECORD,,
|
File without changes
|
File without changes
|