Skip to content
Snippets Groups Projects
Commit 11227a0d authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

#1060809 MST remove deleted teams serverProcess, bot webservice

parent ce70c115
No related branches found
No related tags found
No related merge requests found
......@@ -45,9 +45,11 @@ if (internalMembers.length !== 0)
if (externalMembers.length !== 0)
teams.addExternalMembers(teamId, externalMembers);
var owners = teams.getAllOwners(teamId);
var removeMembers = deletedTeamMembers.map(function (member)
{
return teams.createInternalUserConfig(member["#UID"]);
var isOwner = member["#UID"] in owners;
return teams.createInternalUserConfig(member["#UID"]).setOwner(isOwner);
});
if (removeMembers.length !== 0)
......
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1">
<name>mstws</name>
<name>mstBot_rest</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/mstws/process.js</process>
<process>%aditoprj%/process/mstBot_rest/process.js</process>
<publishAsWebservice v="true" />
<style>REST</style>
<restAcceptedMimeType>application/json</restAcceptedMimeType>
......
import("system.teams");
import("system.logging");
import("system.text");
import("system.util");
import("Sql_lib");
......@@ -23,12 +24,14 @@ function restpost(pRequestAsJson)
{
newWhere("MST_TEAM.MST_TEAMID", teamId)
.updateFields({"SERVICE_URL" : serviceUrl});
return pRequestAsJson;
}
//Sollte jemand die APP manuell wieder entfernen, gibt es einen "AbschiedsRequest", lösche die ServiceUrl aus der DB
if(eventType == "teamMemberRemoved" && who == "ADITO Bot")
{
newWhere("MST_TEAM.MST_TEAMID", teamId)
.updateFields({"SERVICE_URL" : ""});
return pRequestAsJson;
}
//_____________________________________________________________
......@@ -49,5 +52,32 @@ function restpost(pRequestAsJson)
// wird hier keine teams.Funktion benötigt
//Weitere Schritte: text aufsplittet anhand der Syntax und die einzelnen Kommandos umsetzen
var plainMessage = text.html2text(pHTML);
var splitMessage = plainMessage.split("/");
if (splitMessage.length !== 2)
return pRequestAsJson;
var command = splitMessage[1].split(/\s+?/);
var parameters = {};
command.slice(1).forEach(function (param)
{
param = param.split("=");
if (param.length !== 2)
return;
parameters[param[0]] = param[1];
});
command = command[0];
switch (command)
{
case "addTask":
var fieldValues = {};
if ("editor" in parameters)
//TODO: insert task
}
return pRequestAsJson;
}
\ No newline at end of file
import("system.teams");
import("Sql_lib");
var archivedTeams = teams.getAllArchivedTeams(null);
var dbArchivedTeams = newSelect("MST_TEAMID")
.from("MST_TEAM")
.where("MST_TEAM.IS_ARCHIVED", "1")
.arrayColumn();
var teamIdsToDelete = dbArchivedTeams.filter(function (teamId)
{
return !(teamId in archivedTeams);
});
if (teamIdsToDelete.length > 0)
{
newWhere("MST_TEAM.MST_TEAMID", teamIdsToDelete, SqlBuilder.IN())
.deleteData();
newWhere("SALESPROJECT.MST_TEAM_ID", teamIdsToDelete, SqlBuilder.IN())
.updateFields({"MST_TEAM_ID": ""});
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1">
<name>removeMSTTeams_serverProcess</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/removeMSTTeams_serverProcess/process.js</process>
<alias>Data_alias</alias>
<variants>
<element>EXECUTABLE</element>
</variants>
</process>
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