Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 42165bbd authored by a's avatar a
Browse files

add all comments in commandExecutor

parent 7f791bc7
No related branches found
No related tags found
No related merge requests found
......@@ -315,11 +315,10 @@ async function VerifyAndExecuteOpenSessionToMember(data, userDatabase, userMedia
/**
*
* Prepares the template options for Opensession command in the scope of a group. If there is more than one option, calls executeCommandOnGroup with ExecuteOpenSessionToMember
* @param data
* @param userDatabase
* @param userMediaID
* @returns {Promise<JSON|*>}
* @constructor
* @param data - The current data to send.
* @param userDatabase - The user's database data.
* @param userMediaID - The user's OSNS media ID.
* @returns {Promise<JSON>}
*/
async function VerifyAndExecuteOpenSessionToGroup(data, userDatabase, userMediaID)
{
......@@ -339,6 +338,17 @@ async function VerifyAndExecuteOpenSessionToGroup(data, userDatabase, userMediaI
"options":templateOptions
}, data, userDatabase, userMediaID);
}
/**
* Opens a session to a group or a user.
* Based on the user's state, the behavior changes:
* . SendingToGroup: Opens a session with the selected or targeted member in the scope of the group.
* . SendingToUser: Prompts the user that they can't open a session when already in a session with a user.
* . undefined: Opens a session with the selected or targeted group the user is connected to.
* @param data - The current data to send.
* @param userMediaID - The sender's OSNS media ID.
* @returns {Promise<JSON>} - The modified data to send to the user.
*/
async function ExecuteOpenSession(data, userMediaID)
{
const userDatabase = await databaseManager.findUserByMediaID(userMediaID);
......@@ -356,6 +366,13 @@ async function ExecuteOpenSession(data, userMediaID)
}
/**
*
* Prepares the data JSON to send the message to the group the user has an opened session with.
* @param data - The current data to send.
* @param userMediaID - The sender's OSNS media ID.
* @returns {Promise<void>}
*/
async function ExecuteSendingToGroupMessage(data, userMediaID)
{
const userDatabase = await databaseManager.findUserByMediaID(userMediaID);
......@@ -364,6 +381,13 @@ async function ExecuteSendingToGroupMessage(data, userMediaID)
data.targetGroup = userDatabase.target;
}
/**
*
* Prepares the data JSON to send the message to the user the sender has an opened session with.
* @param data - The current data to send.
* @param userMediaID - The sender's OSNS media ID.
* @returns {Promise<void>}
*/
async function ExecuteSendingToUser(data, userMediaID)
{
const userDatabase = await databaseManager.findUserByMediaID(userMediaID);
......@@ -373,6 +397,13 @@ async function ExecuteSendingToUser(data, userMediaID)
data.targetGroup = userDatabase.target;
}
/**
* Connects the user to the target group in parameter.
* @param data - The current data to send.
* @param targetGroupID - The database ID of the target group.
* @param userMediaID - The sender's OSNS media ID.
* @returns {Promise<JSON>}
*/
async function ExecuteConnectToGroup(data, targetGroupID, userMediaID)
{
const targetGroup = await databaseManager.findGroupByGroupID(targetGroupID);
......@@ -392,6 +423,14 @@ async function ExecuteConnectToGroup(data, targetGroupID, userMediaID)
}
return data;
}
/**
*
* Prepares the template options for ConnectToGroup command. If there is more than one option, calls executeCommandOnGroup with ExecuteOpenSessionToMember
* @param data - The current data to send.
* @param userMediaID - The sender's OSNS media ID.
* @returns {Promise<JSON>}
*/
async function VerifyAndExecuteConnectToGroup(data, userMediaID)
{
const userDatabase = await databaseManager.findUserByMediaID(userMediaID);
......@@ -412,6 +451,13 @@ async function VerifyAndExecuteConnectToGroup(data, userMediaID)
}, data, userDatabase, userMediaID)
}
/**
*
* Prepares the data JSON with a formatted message listing the connected members in the target group.
* @param data - The current data to send.
* @param targetGroupID - The database ID of the target group.
* @returns {Promise<JSON>}
*/
async function ExecuteGetConnectedMembers(data, targetGroupID)
{
const targetGroup = await databaseManager.findGroupByGroupID(targetGroupID);
......@@ -426,6 +472,13 @@ async function ExecuteGetConnectedMembers(data, targetGroupID)
return data;
}
/**
*
* Prepares the template options for GetConnectedMembers. If there is more than one option, calls executeCommandOnGroup with ExecuteGetConnectedMembers.
* @param data - The current data to send.
* @param userMediaID - The user's OSNS media ID.
* @returns {Promise<JSON>}
*/
async function VerifyAndExecuteGetConnectedMembers(data, userMediaID)
{
const userDatabase = await databaseManager.findUserByMediaID(userMediaID);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment