Skip to content
GitLab
Explore
Sign in
Register
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
7b8498ca
Commit
7b8498ca
authored
5 years ago
by
roadscape
Browse files
Options
Downloads
Patches
Plain Diff
add post_notifications endpoint
parent
cba79c7b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hive/server/hive_api/notify.py
+16
-1
16 additions, 1 deletion
hive/server/hive_api/notify.py
hive/server/serve.py
+1
-0
1 addition, 0 deletions
hive/server/serve.py
with
17 additions
and
1 deletion
hive/server/hive_api/notify.py
+
16
−
1
View file @
7b8498ca
...
@@ -3,7 +3,7 @@ import logging
...
@@ -3,7 +3,7 @@ import logging
from
hive.server.common.helpers
import
return_error_info
,
json_date
from
hive.server.common.helpers
import
return_error_info
,
json_date
from
hive.indexer.notify
import
NotifyType
from
hive.indexer.notify
import
NotifyType
from
hive.server.hive_api.common
import
get_account_id
,
valid_limit
from
hive.server.hive_api.common
import
get_account_id
,
valid_limit
,
get_post_id
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -72,6 +72,21 @@ async def account_notifications(context, account, min_score=25, last_id=None, li
...
@@ -72,6 +72,21 @@ async def account_notifications(context, account, min_score=25, last_id=None, li
last_id
=
last_id
,
limit
=
limit
)
last_id
=
last_id
,
limit
=
limit
)
return
[
_render
(
row
)
for
row
in
rows
]
return
[
_render
(
row
)
for
row
in
rows
]
@return_error_info
async
def
post_notifications
(
context
,
author
,
permlink
,
min_score
=
25
,
last_id
=
None
,
limit
=
100
):
"""
Load notifications for a specific post.
"""
# pylint: disable=too-many-arguments
db
=
context
[
'
db
'
]
limit
=
valid_limit
(
limit
,
100
)
post_id
=
await
get_post_id
(
db
,
author
,
permlink
)
seek
=
'
AND hn.id < :last_id
'
if
last_id
else
''
sql
=
_notifs_sql
(
"
post_id = :post_id
"
+
seek
)
rows
=
await
db
.
query_all
(
sql
,
min_score
=
min_score
,
post_id
=
post_id
,
last_id
=
last_id
,
limit
=
limit
)
return
[
_render
(
row
)
for
row
in
rows
]
def
_notifs_sql
(
where
):
def
_notifs_sql
(
where
):
sql
=
"""
SELECT hn.id, hn.type_id, hn.score, hn.created_at,
sql
=
"""
SELECT hn.id, hn.type_id, hn.score, hn.created_at,
src.name src, dst.name dst,
src.name src, dst.name dst,
...
...
This diff is collapsed.
Click to expand it.
hive/server/serve.py
+
1
−
0
View file @
7b8498ca
...
@@ -122,6 +122,7 @@ def build_methods():
...
@@ -122,6 +122,7 @@ def build_methods():
bridge_api
.
get_ranked_posts
,
bridge_api
.
get_ranked_posts
,
bridge_api
.
get_profile
,
bridge_api
.
get_profile
,
bridge_api
.
get_trending_topics
,
bridge_api
.
get_trending_topics
,
hive_api_notify
.
post_notifications
,
hive_api_notify
.
account_notifications
,
hive_api_notify
.
account_notifications
,
hive_api_notify
.
unread_notifications
,
hive_api_notify
.
unread_notifications
,
hive_api_stats
.
get_payout_stats
,
hive_api_stats
.
get_payout_stats
,
...
...
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