mirror of
https://github.com/optim-enterprises-bv/databunker.git
synced 2025-10-29 17:12:22 +00:00
code cleanup
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
|
||||||
|
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
"github.com/securitybunker/databunker/src/utils"
|
"github.com/securitybunker/databunker/src/utils"
|
||||||
@@ -32,40 +31,16 @@ func (e mainEnv) pactivityCreate(w http.ResponseWriter, r *http.Request, ps http
|
|||||||
w.Write([]byte(`{"status":"ok"}`))
|
w.Write([]byte(`{"status":"ok"}`))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
title := ""
|
|
||||||
script := ""
|
|
||||||
fulldesc := ""
|
|
||||||
legalbasis := ""
|
legalbasis := ""
|
||||||
newactivity := ""
|
title := utils.GetStringValue(records["title"])
|
||||||
applicableto := ""
|
|
||||||
if value, ok := records["title"]; ok {
|
|
||||||
if reflect.TypeOf(value) == reflect.TypeOf("string") {
|
|
||||||
title = value.(string)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(title) == 0 {
|
if len(title) == 0 {
|
||||||
title = activity
|
title = activity
|
||||||
}
|
}
|
||||||
if value, ok := records["script"]; ok {
|
script := utils.GetStringValue(records["script"])
|
||||||
if reflect.TypeOf(value) == reflect.TypeOf("string") {
|
fulldesc := utils.GetStringValue(records["fulldesc"])
|
||||||
script = value.(string)
|
newactivity := utils.GetStringValue(records["activity"])
|
||||||
}
|
applicableto := utils.GetStringValue(records["applicableto"])
|
||||||
}
|
|
||||||
if value, ok := records["fulldesc"]; ok {
|
|
||||||
if reflect.TypeOf(value) == reflect.TypeOf("string") {
|
|
||||||
fulldesc = value.(string)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if value, ok := records["activity"]; ok {
|
|
||||||
if reflect.TypeOf(value) == reflect.TypeOf("string") {
|
|
||||||
newactivity = value.(string)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if value, ok := records["applicableto"]; ok {
|
|
||||||
if reflect.TypeOf(value) == reflect.TypeOf("string") {
|
|
||||||
applicableto = value.(string)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
e.db.createProcessingActivity(activity, newactivity, title, script, fulldesc, legalbasis, applicableto)
|
e.db.createProcessingActivity(activity, newactivity, title, script, fulldesc, legalbasis, applicableto)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -69,12 +68,7 @@ func (dbobj dbcon) linkProcessingActivity(activity string, brief string) (bool,
|
|||||||
if raw == nil {
|
if raw == nil {
|
||||||
return false, errors.New("not found")
|
return false, errors.New("not found")
|
||||||
}
|
}
|
||||||
legalbasis := ""
|
legalbasis := utils.GetStringValue(raw["legalbasis"])
|
||||||
if value, ok := raw["legalbasis"]; ok {
|
|
||||||
if reflect.TypeOf(value) == reflect.TypeOf("string") {
|
|
||||||
legalbasis = value.(string)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
briefs := strings.Split(legalbasis, ",")
|
briefs := strings.Split(legalbasis, ",")
|
||||||
if utils.SliceContains(briefs, brief) == true {
|
if utils.SliceContains(briefs, brief) == true {
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
@@ -100,12 +94,7 @@ func (dbobj dbcon) unlinkProcessingActivity(activity string, brief string) (bool
|
|||||||
if raw == nil {
|
if raw == nil {
|
||||||
return false, errors.New("not found")
|
return false, errors.New("not found")
|
||||||
}
|
}
|
||||||
legalbasis := ""
|
legalbasis := utils.GetStringValue(raw["legalbasis"])
|
||||||
if val, ok := raw["legalbasis"]; ok {
|
|
||||||
if reflect.TypeOf(val) == reflect.TypeOf("string") {
|
|
||||||
legalbasis = val.(string)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
briefs := strings.Split(legalbasis, ",")
|
briefs := strings.Split(legalbasis, ",")
|
||||||
if utils.SliceContains(briefs, brief) == false {
|
if utils.SliceContains(briefs, brief) == false {
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
|
|||||||
Reference in New Issue
Block a user