nsarchive 2.0.0a2__tar.gz → 2.0.0a4__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.
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/PKG-INFO +1 -1
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/cls/base.py +4 -3
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/cls/entities.py +2 -2
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/instances/_entities.py +6 -5
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/pyproject.toml +1 -1
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/LICENSE +0 -0
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/README.md +0 -0
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/__init__.py +0 -0
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/assets/default_avatar.png +0 -0
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/cls/archives.py +0 -0
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/cls/economy.py +0 -0
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/cls/exceptions.py +0 -0
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/cls/republic.py +0 -0
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/instances/_economy.py +0 -0
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/instances/_republic.py +0 -0
- {nsarchive-2.0.0a2 → nsarchive-2.0.0a4}/nsarchive/utils/assets.py +0 -0
@@ -37,7 +37,7 @@ class Instance:
|
|
37
37
|
def __init__(self, client: Client):
|
38
38
|
self.db = client
|
39
39
|
|
40
|
-
def _select_from_db(self, table: str, key: str, value: str) ->
|
40
|
+
def _select_from_db(self, table: str, key: str, value: str) -> list:
|
41
41
|
"""
|
42
42
|
Récupère des données JSON d'une table Supabase en fonction de l'ID.
|
43
43
|
|
@@ -112,11 +112,12 @@ class Instance:
|
|
112
112
|
matches = []
|
113
113
|
|
114
114
|
for key, value in query.items():
|
115
|
-
|
115
|
+
entity = self._select_from_db(table, key, value)
|
116
|
+
if entity is not None: matches.append(entity[0])
|
116
117
|
|
117
118
|
_res = []
|
118
119
|
|
119
|
-
for item in matches
|
120
|
+
for item in matches:
|
120
121
|
if all(item in sublist for sublist in matches[1:]):
|
121
122
|
_res.append(item)
|
122
123
|
|
@@ -29,7 +29,7 @@ class PositionPermissions:
|
|
29
29
|
self.vote_representatives = False # Participer aux élections législatives
|
30
30
|
|
31
31
|
def edit(self, **permissions: bool) -> None:
|
32
|
-
for perm in permissions.
|
32
|
+
for perm in permissions.items():
|
33
33
|
self.__setattr__(*perm)
|
34
34
|
|
35
35
|
class Position:
|
@@ -141,7 +141,7 @@ class Organization(Entity):
|
|
141
141
|
self.members: list[GroupMember] = []
|
142
142
|
|
143
143
|
self.parts: dict[NSID, int] = {
|
144
|
-
self.
|
144
|
+
self.id: 1
|
145
145
|
}
|
146
146
|
|
147
147
|
def add_certification(self, certification: str) -> None:
|
@@ -67,7 +67,7 @@ class EntityInstance(Instance):
|
|
67
67
|
|
68
68
|
for _member in _data['members']:
|
69
69
|
member = GroupMember(_member['id'])
|
70
|
-
member.permission_level = _member['
|
70
|
+
member.permission_level = _member['position']
|
71
71
|
|
72
72
|
_member_profile = self.get_entity(member.id)
|
73
73
|
|
@@ -167,9 +167,10 @@ class EntityInstance(Instance):
|
|
167
167
|
- `list[Entity | User | Organization]`
|
168
168
|
"""
|
169
169
|
|
170
|
-
_res = self.fetch('
|
170
|
+
_res = self.fetch('individuals', **query)
|
171
|
+
_res.extend(self.fetch('organizations', **query))
|
171
172
|
|
172
|
-
return [ self.get_entity(NSID(entity['
|
173
|
+
return [ self.get_entity(NSID(entity['id'])) for entity in _res if entity is not None ]
|
173
174
|
|
174
175
|
def get_entity_groups(self, id: str | NSID) -> list[Organization]:
|
175
176
|
"""
|
@@ -221,8 +222,8 @@ class EntityInstance(Instance):
|
|
221
222
|
return None
|
222
223
|
|
223
224
|
position = Position(id)
|
224
|
-
position.name = _data['
|
225
|
-
position.permissions.edit(
|
225
|
+
position.name = _data['title']
|
226
|
+
position.permissions.edit(**{ p: True for p in _data['permissions'] })
|
226
227
|
|
227
228
|
return position
|
228
229
|
|
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
|