Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
9d06495b
Commit
9d06495b
authored
5 years ago
by
imwatsi
Browse files
Options
Downloads
Patches
Plain Diff
add role and title data to endpoint
parent
63205815
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hive/server/hive_api/community.py
+3
-3
3 additions, 3 deletions
hive/server/hive_api/community.py
with
3 additions
and
3 deletions
hive/server/hive_api/community.py
+
3
−
3
View file @
9d06495b
...
@@ -105,11 +105,11 @@ async def list_pop_communities(context, limit=25):
...
@@ -105,11 +105,11 @@ async def list_pop_communities(context, limit=25):
@return_error_info
@return_error_info
async
def
list_all_subscriptions
(
context
,
account
):
async
def
list_all_subscriptions
(
context
,
account
):
"""
Lists all communities `account` subscribes to.
"""
"""
Lists all communities `account` subscribes to
, plus role and title in each
.
"""
db
=
context
[
'
db
'
]
db
=
context
[
'
db
'
]
account_id
=
await
get_account_id
(
db
,
account
)
account_id
=
await
get_account_id
(
db
,
account
)
sql
=
"""
SELECT c.name, c.title
sql
=
"""
SELECT c.name, c.title
, COALESCE(r.role_id, 0), COALESCE(r.title,
''
)
FROM hive_communities c
FROM hive_communities c
JOIN hive_subscriptions s ON c.id = s.community_id
JOIN hive_subscriptions s ON c.id = s.community_id
LEFT JOIN hive_roles r ON r.account_id = s.account_id
LEFT JOIN hive_roles r ON r.account_id = s.account_id
...
@@ -117,7 +117,7 @@ async def list_all_subscriptions(context, account):
...
@@ -117,7 +117,7 @@ async def list_all_subscriptions(context, account):
WHERE s.account_id = :account_id
WHERE s.account_id = :account_id
ORDER BY COALESCE(role_id, 0) DESC, c.rank
"""
ORDER BY COALESCE(role_id, 0) DESC, c.rank
"""
out
=
await
db
.
query_all
(
sql
,
account_id
=
account_id
)
out
=
await
db
.
query_all
(
sql
,
account_id
=
account_id
)
return
[(
r
[
0
],
r
[
1
])
for
r
in
out
]
return
[(
r
[
0
],
r
[
1
]
,
ROLES
[
r
[
2
]],
r
[
3
]
)
for
r
in
out
]
@return_error_info
@return_error_info
async
def
list_subscribers
(
context
,
community
):
async
def
list_subscribers
(
context
,
community
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment