v3: general cleanup

This commit is contained in:
Matteo Pagliazzi
2016-04-17 01:17:22 +02:00
parent c2b8cad886
commit b271520c53
22 changed files with 213 additions and 193 deletions

View File

@@ -27,7 +27,7 @@ let api = {};
*
* @apiParam {string} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
*
* @apiSuccess {Array} chat An array of chat messages
* @apiSuccess {Array} data An array of chat messages
*/
api.getChat = {
method: 'GET',
@@ -54,11 +54,11 @@ api.getChat = {
* @apiName PostCat
* @apiGroup Chat
*
* @apiParam {UUID} groupId The group _id
* @apiParam {message} message The chat's message
* @apiParam {previousMsg} previousMsg The previous chat message which will force a return of the full group chat
* @apiParam {UUID} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
* @apiParam {message} Body parameter - message The message to post
* @apiParam {previousMsg} previousMsg Query parameter - The previous chat message which will force a return of the full group chat
*
* @apiSuccess {Array} chat An array of chat messages
* @apiSuccess data An array of chat messages if a new message was posted after previousMsg, otherwise the posted message
*/
api.postChat = {
method: 'POST',
@@ -107,10 +107,10 @@ api.postChat = {
* @apiName LikeChat
* @apiGroup Chat
*
* @apiParam {groupId} groupId The group _id
* @apiParam {groupId} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
* @apiParam {chatId} chatId The chat message _id
*
* @apiSuccess {Array} chat An array of chat messages
* @apiSuccess {Object} data The liked chat message
*/
api.likeChat = {
method: 'POST',
@@ -154,10 +154,10 @@ api.likeChat = {
* @apiName LikeChat
* @apiGroup Chat
*
* @apiParam {groupId} groupId The group _id
* @apiParam {chatId} chatId The chat message _id
* @apiParam {groupId} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
* @apiParam {chatId} chatId The chat message id
*
* @apiSuccess {Array} chat An array of chat messages
* @apiSuccess {object} data The flagged chat message
*/
api.flagChat = {
method: 'POST',
@@ -255,14 +255,15 @@ api.flagChat = {
/**
* @api {post} /api/v3/groups/:groupId/chat/:chatId/clear-flags Clear a group chat message's flags
* @apiDescription Admin-only
* @apiVersion 3.0.0
* @apiName ClearFlags
* @apiGroup Chat
*
* @apiParam {groupId} groupId The group _id
* @apiParam {chatId} chatId The chat message _id
* @apiParam {groupId} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
* @apiParam {chatId} chatId The chat message id
*
* @apiSuccess {Object} An empty object
* @apiSuccess {Object} data An empty object
*/
api.clearChatFlags = {
method: 'Post',
@@ -306,7 +307,9 @@ api.clearChatFlags = {
* @apiName SeenChat
* @apiGroup Chat
*
* @apiParam {groupId} groupId The group _id
* @apiParam {groupId} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
*
* @apiSuccess {Object} data An empty object
*/
api.seenChat = {
method: 'POST',
@@ -328,7 +331,7 @@ api.seenChat = {
update.$unset[`newMessages.${groupId}`] = true;
await User.update({_id: user._id}, update).exec();
res.respond(200);
res.respond(200, {});
},
};
@@ -338,11 +341,12 @@ api.seenChat = {
* @apiName DeleteChat
* @apiGroup Chat
*
* @apiParam {string} previousMsg Query parameter - The last message fetched by the client so that the whole chat will be returned only if new messages have been posted in the meantime
* @apiParam {string} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
* @apiParam {string} chatId The chat _id
* @apiParam {string} chatId The chat message id
*
* @apiSuccess {Array} The update chat array
* @apiSuccess {Object} An empty object when the previous message was deleted
* @apiSuccess data The updated chat array or an empty object if no message was posted after previousMsg
* @apiSuccess {Object} data An empty object when the previous message was deleted
*/
api.deleteChat = {
method: 'DELETE',