DemocracyOS / core

1 stars 1 forks source link

Adding Comments for documents #46

Closed guillecro closed 6 years ago

guillecro commented 6 years ago
URI Description Auth
GET /api/v1/documents/:id/comments Retrieves a list of comments of the documents. Available queryStrings - field and ids -
POST /api/v1/documents/:id/comments Creates a new comment in a document. The request body requires 2 fields: field and comment. The field is part of the fields of customForm. First, during a POST request, it validates if the field is part of the allowComments array of the customForm of the document. If not, it throws an Exception. If everything is ok, the comment is saved authenticated
PUT /api/v1/documents/:id/update/:field Updates the content of a field of a document. There is only one possible addition: a mark labeled as a comment -
PUT /:id/comments/:idComment/resolve Resolves a comment of a document. This only sets the value true to the field resolved of a comment. Only the author of the document can do this authenticated & must be the author

Note 1: A test revision might be needed Note 2: I might play around with mocha-steps cause I am having some issues with a POST and GET test.. Sometimes I need the POST to end properly before the GET and right now it does it job but a few times it fails.