summaryrefslogtreecommitdiffstats
path: root/models/swimlanes.js
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2018-10-26 07:27:24 +0200
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>2019-01-18 17:02:56 +0100
commitff467402c0c24981078f1f8e2b92b26b0d67d00a (patch)
tree289b4647e571f7896172028068b2bd130cbfa757 /models/swimlanes.js
parent49d3eb5a3f21fad1eb2952eb3da2f93c5c5d6272 (diff)
downloadwekan-ff467402c0c24981078f1f8e2b92b26b0d67d00a.tar.gz
wekan-ff467402c0c24981078f1f8e2b92b26b0d67d00a.tar.bz2
wekan-ff467402c0c24981078f1f8e2b92b26b0d67d00a.zip
RESTAPI: Add some JSDoc
So we can have a decent REST API documentation generated.
Diffstat (limited to 'models/swimlanes.js')
-rw-r--r--models/swimlanes.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/models/swimlanes.js b/models/swimlanes.js
index 3559bcd2..fa5245da 100644
--- a/models/swimlanes.js
+++ b/models/swimlanes.js
@@ -1,10 +1,19 @@
Swimlanes = new Mongo.Collection('swimlanes');
+/**
+ * A swimlane is an line in the kaban board.
+ */
Swimlanes.attachSchema(new SimpleSchema({
title: {
+ /**
+ * the title of the swimlane
+ */
type: String,
},
archived: {
+ /**
+ * is the swimlane archived?
+ */
type: Boolean,
autoValue() { // eslint-disable-line consistent-return
if (this.isInsert && !this.isSet) {
@@ -13,9 +22,15 @@ Swimlanes.attachSchema(new SimpleSchema({
},
},
boardId: {
+ /**
+ * the ID of the board the swimlane is attached to
+ */
type: String,
},
createdAt: {
+ /**
+ * creation date of the swimlane
+ */
type: Date,
autoValue() { // eslint-disable-line consistent-return
if (this.isInsert) {
@@ -26,12 +41,18 @@ Swimlanes.attachSchema(new SimpleSchema({
},
},
sort: {
+ /**
+ * the sort value of the swimlane
+ */
type: Number,
decimal: true,
// XXX We should probably provide a default
optional: true,
},
updatedAt: {
+ /**
+ * when was the swimlane last edited
+ */
type: Date,
optional: true,
autoValue() { // eslint-disable-line consistent-return
@@ -131,6 +152,15 @@ if (Meteor.isServer) {
//SWIMLANE REST API
if (Meteor.isServer) {
+ /**
+ * @operation get_all_swimlanes
+ *
+ * @summary Get the list of swimlanes attached to a board
+ *
+ * @param {string} boardId the ID of the board
+ * @return_type [{_id: string,
+ * title: string}]
+ */
JsonRoutes.add('GET', '/api/boards/:boardId/swimlanes', function (req, res) {
try {
const paramBoardId = req.params.boardId;
@@ -154,6 +184,15 @@ if (Meteor.isServer) {
}
});
+ /**
+ * @operation get_swimlane
+ *
+ * @summary Get a swimlane
+ *
+ * @param {string} boardId the ID of the board
+ * @param {string} swimlaneId the ID of the swimlane
+ * @return_type Swimlanes
+ */
JsonRoutes.add('GET', '/api/boards/:boardId/swimlanes/:swimlaneId', function (req, res) {
try {
const paramBoardId = req.params.boardId;
@@ -172,6 +211,15 @@ if (Meteor.isServer) {
}
});
+ /**
+ * @operation new_swimlane
+ *
+ * @summary Add a swimlane to a board
+ *
+ * @param {string} boardId the ID of the board
+ * @param {string} title the new title of the swimlane
+ * @return_type {_id: string}
+ */
JsonRoutes.add('POST', '/api/boards/:boardId/swimlanes', function (req, res) {
try {
Authentication.checkUserId( req.userId);
@@ -195,6 +243,17 @@ if (Meteor.isServer) {
}
});
+ /**
+ * @operation delete_swimlane
+ *
+ * @summary Delete a swimlane
+ *
+ * @description The swimlane will be deleted, not moved to the recycle bin
+ *
+ * @param {string} boardId the ID of the board
+ * @param {string} swimlaneId the ID of the swimlane
+ * @return_type {_id: string}
+ */
JsonRoutes.add('DELETE', '/api/boards/:boardId/swimlanes/:swimlaneId', function (req, res) {
try {
Authentication.checkUserId( req.userId);