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