KristerV / heliumpay-budgetweb-backend

2 stars 2 forks source link

Comments: View, Submit, Delete, Vote #24

Closed jschr closed 7 years ago

jschr commented 7 years ago

Overview

Users will need to able to comment on proposals proposals and vote on other users comments. They will also need to edit and delete their own comments. The proposed feature set is using dash central as a guideline.

API

GET   /comments?proposalHash= -> get comments for proposal # must provide a proposal
POST  /comments               -> new comment
        {text, proposalId, replyToId}
PUT   /comments/:id           -> update comment
        {text}
POST  /comments/:id/vote      -> new vote count
        {direction: -1 | 0 | 1}
DEL   /comments/:id           -> delete comment

Schema

comment
  id: pk
  userId: fk -> user.id # owner
  replyToId: fk -> comment.id # if set, is a reply
  text: string

comment_vote
  id: pk, fk -> comment.id
  userId: pk, fk -> user.id
  dir: int

References

jschr commented 7 years ago

Implemented in https://github.com/KristerV/heliumpay-budgetweb-backend/pull/30