Skip to content
Snippets Groups Projects
Commit 607008d8 authored by Oda Alida Fønstelien Hjelljord's avatar Oda Alida Fønstelien Hjelljord
Browse files

Merge branch 'doc' into 'main'

Doc

See merge request !168
parents 94f5fc96 c04ac1dd
No related branches found
No related tags found
No related merge requests found
......@@ -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", {
......
......@@ -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(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment