diff --git a/src/services/chat.service.js b/src/services/chat.service.js index 908763073b06e96ff429dce23678cb3207945869..f2b5a810f4ac2b76ba687366e9d12380e58fe475 100644 --- a/src/services/chat.service.js +++ b/src/services/chat.service.js @@ -3,7 +3,14 @@ import { tokenHeader } from "@/utils/token-utils"; const API_URL = process.env.VUE_APP_BASEURL; +/** + * Service class acting as a middle layer between our components and the API + */ class ChatService { + /** + * Service method to get the logged in user's conversations. + * @returns an array of objects containing two objects containing the last message and the recipient. + */ async getConversations() { return await axios .get(API_URL + "chats/users", { diff --git a/src/services/community-admin.service.js b/src/services/community-admin.service.js index eb2c23e00d5d3ca456f5685429dc5d0393d01047..a898827521b86805d5fe804a979d87e35fba0381 100644 --- a/src/services/community-admin.service.js +++ b/src/services/community-admin.service.js @@ -7,6 +7,11 @@ const API_URL = process.env.VUE_APP_BASEURL; * Service class acting as a middle layer between our components and the API */ class CommunityAdminService { + /** + * Checks if the current user is an admin in the community that is being accessed. + * @param {Number} communityID ID of the community to the if the user is an admin in. + * @returns a boolean. + */ async isUserAdmin(communityID) { return await axios .get(API_URL + "communities/" + communityID + "/user/admin", { @@ -17,7 +22,12 @@ class CommunityAdminService { }); } - //TODO + /** + * Accepts a member request. + * @param {Number} communityID the community to accept the request into. + * @param {Number} userID the user id of the user being accepted into the community. + * @returns the response. + */ async acceptUserIntoCommunity(communityID, userID) { return await axios.post( API_URL + "communities/" + communityID + "/requests", @@ -26,7 +36,12 @@ class CommunityAdminService { ); } - //TODO + /** + * Reject a user's request to join a community. + * @param {Number} communityID id of the community to reject the request from. + * @param {Number} userID id of the user being rejected. + * @returns the response. + */ async rejectUserFromCommunity(communityID, userID) { return await axios.patch( API_URL + "communitites/" + communityID + "/requests/reject", @@ -37,9 +52,9 @@ class CommunityAdminService { /** * Method that kicks a user from a community - * @param {int} communityID the community to remove the user from - * @param {int} userID the user to remove - * @returns TODO + * @param {Number} communityID the community to remove the user from + * @param {Number} userID the user to remove + * @returns the response. */ async removeUserFromCommunity(communityID, userID) { return await axios.patch( @@ -56,8 +71,8 @@ class CommunityAdminService { /** * Method to delete a community - * @param {int} communityID id of the community to delete. - * @returns TODO + * @param {Number} communityID id of the community to delete. + * @returns the response. */ async deleteCommunity(communityID) { return await axios.delete(