mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-06 15:22:47 +01:00
@@ -118,7 +118,7 @@ func parseQueryOptionalBoolArray(r *http.Request, key string) ([]bool, error) {
|
||||
return parseQueryBoolArray(r, key)
|
||||
}
|
||||
|
||||
func parseBody(b []byte, i interface{}) error {
|
||||
func parseBody(b []byte, i any) error {
|
||||
dec := json.NewDecoder(bytes.NewBuffer(b))
|
||||
err := dec.Decode(i)
|
||||
if err != nil {
|
||||
@@ -137,7 +137,7 @@ func JSONErrorStatus(w http.ResponseWriter, status int, err error) {
|
||||
w.Write(b)
|
||||
}
|
||||
|
||||
func response(w http.ResponseWriter, v interface{}, err error) {
|
||||
func response(w http.ResponseWriter, v any, err error) {
|
||||
if err != nil {
|
||||
var httpError *HTTPError
|
||||
if errors.As(err, &httpError) {
|
||||
@@ -172,7 +172,7 @@ func validateSchema(body []byte, schema *gojsonschema.Schema, w http.ResponseWri
|
||||
validationErrors = append(validationErrors, valdiationError.String())
|
||||
}
|
||||
|
||||
b, _ := json.Marshal(map[string]interface{}{"error": "wrong input", "errors": validationErrors})
|
||||
b, _ := json.Marshal(map[string]any{"error": "wrong input", "errors": validationErrors})
|
||||
w.Write(b)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ type Service interface {
|
||||
CurrentUser(context.Context) (*model.UserResponse, error)
|
||||
CurrentUserData(context.Context) (*model.UserDataResponse, error)
|
||||
UpdateCurrentUserData(context.Context, *model.UserData) (*model.UserDataResponse, error)
|
||||
DashboardData(context.Context, string, *string) (map[string]interface{}, error)
|
||||
DashboardData(context.Context, string, *string) (map[string]any, error)
|
||||
ListDashboards(context.Context) ([]*model.DashboardResponse, error)
|
||||
CreateDashboard(context.Context, *model.Dashboard) (*model.DashboardResponse, error)
|
||||
GetDashboard(context.Context, string) (*model.DashboardResponse, error)
|
||||
@@ -60,8 +60,8 @@ type Service interface {
|
||||
RemoveComment(context.Context, int64, int) (*model.TicketWithTickets, error)
|
||||
AddTicketPlaybook(context.Context, int64, *model.PlaybookTemplateForm) (*model.TicketWithTickets, error)
|
||||
RemoveTicketPlaybook(context.Context, int64, string) (*model.TicketWithTickets, error)
|
||||
SetTaskData(context.Context, int64, string, string, map[string]interface{}) (*model.TicketWithTickets, error)
|
||||
CompleteTask(context.Context, int64, string, string, map[string]interface{}) (*model.TicketWithTickets, error)
|
||||
SetTaskData(context.Context, int64, string, string, map[string]any) (*model.TicketWithTickets, error)
|
||||
CompleteTask(context.Context, int64, string, string, map[string]any) (*model.TicketWithTickets, error)
|
||||
SetTaskOwner(context.Context, int64, string, string, string) (*model.TicketWithTickets, error)
|
||||
RunTask(context.Context, int64, string, string) error
|
||||
SetReferences(context.Context, int64, *model.ReferenceArray) (*model.TicketWithTickets, error)
|
||||
@@ -901,7 +901,7 @@ func (s *server) setTaskDataHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
var dataP map[string]interface{}
|
||||
var dataP map[string]any
|
||||
if err := parseBody(body, &dataP); err != nil {
|
||||
JSONError(w, err)
|
||||
return
|
||||
@@ -928,7 +928,7 @@ func (s *server) completeTaskHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
var dataP map[string]interface{}
|
||||
var dataP map[string]any
|
||||
if err := parseBody(body, &dataP); err != nil {
|
||||
JSONError(w, err)
|
||||
return
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user