Added richText and allowComments to customForms. It declares which fields has richText and which fields allows comments. This will be handy later for validations and also for the front end to render proper components for that.
Created model generalComment. It saves a comment related to a field of a document
Added new db-apis: Document.listGeneralComments( query ) and GeneralComment.create( theGeneralComment )
Added 2 new API endpoints
URI
Description
Auth
GET /api/v1/documents/:id/comments
Retrieves a list of comments of the documents.
-
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
Updated API documentation
Added 2 new tests under the documents test:
POST (/:id/comments) should be able to create a comment on a specific document, in a specific fieldGET (/:id/comments) should be able to get a list of comments of a specific document
Note: 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.
richText
andallowComments
tocustomForms
. It declares which fields has richText and which fields allows comments. This will be handy later for validations and also for the front end to render proper components for that.generalComment
. It saves a comment related to a field of a documentDocument.listGeneralComments( query )
andGeneralComment.create( theGeneralComment )
GET /api/v1/documents/:id/comments
POST /api/v1/documents/:id/comments
field
andcomment
. Thefield
is part of the fields of customForm. First, during a POST request, it validates if thefield
is part of theallowComments
array of the customForm of the document. If not, it throws an Exception. If everything is ok, the comment is savedPOST (/:id/comments) should be able to create a comment on a specific document, in a specific field
GET (/:id/comments) should be able to get a list of comments of a specific document
Note: 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.