From c7912becf8683f734084f616199e777e491f683a Mon Sep 17 00:00:00 2001 From: Oleg Silkin Date: Mon, 20 May 2019 02:28:04 -0400 Subject: [PATCH] Adds signature in return --- schema/comments_ddl.sql | 4 ++-- src/database.py | 4 ++-- src/server.py | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/schema/comments_ddl.sql b/schema/comments_ddl.sql index eda9cef..a398b78 100644 --- a/schema/comments_ddl.sql +++ b/schema/comments_ddl.sql @@ -37,8 +37,8 @@ CREATE INDEX COMMENT_CLAIM_INDEX ON COMMENT (LbryClaimId); -- VIEWS DROP VIEW IF EXISTS COMMENTS_ON_CLAIMS; -CREATE VIEW COMMENTS_ON_CLAIMS (comment_id, claim_id, timestamp, channel_name, channel_id, channel_uri, comment, parent_id) AS - SELECT C.CommentId, C.LbryClaimId, C.Timestamp, CHAN.Name, CHAN.ClaimId, 'lbry://' || CHAN.Name || '#' || CHAN.ClaimId, C.Body, C.ParentId +CREATE VIEW COMMENTS_ON_CLAIMS (comment_id, claim_id, timestamp, channel_name, channel_id, channel_uri, signature, parent_id, comment) AS + SELECT C.CommentId, C.LbryClaimId, C.Timestamp, CHAN.Name, CHAN.ClaimId, 'lbry://' || CHAN.Name || '#' || CHAN.ClaimId, C.Signature, C.ParentId, C.Body FROM CHANNEL AS CHAN INNER JOIN COMMENT C on CHAN.ClaimId = C.ChannelId ORDER BY C.Timestamp; diff --git a/src/database.py b/src/database.py index c6e5b60..fe360d2 100644 --- a/src/database.py +++ b/src/database.py @@ -77,7 +77,7 @@ class DatabaseConnection: ) def _insert_comment(self, claim_id: str = None, comment: str = None, - channel_id: str = None, sig: str = None, + channel_id: str = None, signature: str = None, parent_id: str = None, **kwargs): timestamp = time.time_ns() comment_prehash = ':'.join((claim_id, comment, str(timestamp),)) @@ -90,7 +90,7 @@ class DatabaseConnection: ParentId, Signature, Timestamp) VALUES (?, ?, ?, ?, ?, ?, ?) """, - (comment_id, claim_id, channel_id, comment, parent_id, sig, timestamp) + (comment_id, claim_id, channel_id, comment, parent_id, signature, timestamp) ) return comment_id diff --git a/src/server.py b/src/server.py index cc3b9bb..d616ad0 100644 --- a/src/server.py +++ b/src/server.py @@ -89,14 +89,12 @@ class CommentServer: return web.json_response(response) else: return web.json_response({'error': ERRORS['UNKNOWN']}) - except except json.decoder.JSONDecodeError as jde: return web.json_response({ 'error': {'message': jde.msg, 'code': -1} }) - if __name__ == '__main__': app = CommentServer() asyncio.run(app.run())