Working update

This commit is contained in:
mr
2024-11-19 15:07:47 +01:00
parent e9eeac3738
commit 6567dc68a5
3 changed files with 18 additions and 9 deletions

View File

@@ -97,7 +97,7 @@ func (o *CollaborativeAreaController) Get() {
o.ServeJSON()
}
// @Title Add Workspace
// @Title Remove Workspace
// @Description find shared workspace by id
// @Param id path string true "the id you want to get"
// @Param id2 path string true "the id you want to add"
@@ -135,17 +135,14 @@ func (o *CollaborativeAreaController) RemoveWorkflow() {
id := o.Ctx.Input.Param(":id")
id2 := o.Ctx.Input.Param(":id2")
r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id)
fmt.Println("RemoveWorkflow", r)
shared := r.ToCollaborativeArea()
newWorkflows := []string{}
if slices.Contains(shared.Workflows, id2) {
for _, w := range shared.Workflows {
if w != id2 {
newWorkflows = append(newWorkflows, w)
}
for _, w := range shared.Workflows {
if w != id2 {
newWorkflows = append(newWorkflows, w)
}
shared.Workflows = newWorkflows
}
shared.Workflows = newWorkflows
o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller)
o.ServeJSON()
}