Workshops comments API
CRUD operations for the workshops comments platform
Routes
/comments
GET
Get the comments.
You can send some filters in the query params.
If no filter is present, it will return the 100 last non closed comments.
Params:
-
jobId
: (integer) ID of the order/board. -
creationDate
: (string) Date of comment creation. -
service
: (string) Service key string. -
type
: (string) Type key string. -
status
: ([string]) Array of status key strings. -
workshopId
: (integer) Workshop ID. -
progress
: ([string]) Array of progress key strings.
Returns: an array of comments.
POST
Creates a comment.
Takes directly a comment object as body.
PUT
Modifies a comment.
Takes directly a comment object as body, like the post method.
/comments/lock
GET
Method to ask if a specific comment has been opened by someone else.
It returns an object of the form { isLocked: boolean }
.
If the comment is locked, the value returned is true.
If the comment is not locked, the value returned is false and it locks it.
Params:
-
commentId
: (integer) the id of the comment to lock
POST
Method to release the lock on a comment.
Body:
-
commentId
: (integer) the id of the comment to lock
/comments/info
GET
Method to get the information about the order or board linked to the comment.
Params:
-
langId
: (integer) id of the wanted language -
isOrder
: (boolean) specify if you want info about a board or an order -
orderId
: (integer) id or the order you want info about, only used ifisOrder
is true -
boardId
: (integer) id or the board you want info about, only used ifisOrder
is false
Returns: (cf. project db-production
for more details)
{
"details": [
... various s-details
],
"options": [
... options list
],
"orderslist": [
... orders list
]
}
/responses
GET
Get a comment's responses.
Params:
-
commentId
: (integer) the id of the comment you want the responses from
Returns: an array of responses.
POST
Create a response to a comment.
Body: a response object.
/mail
POST
Send an email to a list of recipients.
Body:
-
title
: (string) Title of the email -
content
: (string) Content of the email -
recipients
: ([string]) Array of email addresses
CLI
Running locally
Uncomment the plugin section in serverless.yml
then:
$ npm run -s local
# Or
$ yarn local
Deploy project remotely
$ npm run -s deploy
# Or
$ yarn deploy
Deploy a function remotely
$ sls deploy function -f api --region eu-west-1
UnDeploy
$ npm run -s undeploy
# Or
$ yarn undeploy
Continuous Integration
Test with mocha
$ npm test
# Or
$ yarn test
Build JsDoc and Plato
$ npm run -s build
# Or
$ yarn build
Run Eslint & security check
$ npm run -s lint
# Or
$ yarn lint