diff pkg/controllers/routes.go @ 5712:6270951dda28 revive-cleanup

/interface{}/any/
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 20 Feb 2024 22:37:51 +0100
parents 2dd155cc95ec
children 3d497077f888
line wrap: on
line diff
--- a/pkg/controllers/routes.go	Tue Feb 20 22:22:57 2024 +0100
+++ b/pkg/controllers/routes.go	Tue Feb 20 22:37:51 2024 +0100
@@ -41,7 +41,7 @@
 
 	// Password resets.
 	api.Handle("/users/passwordreset", &mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return new(models.PWResetUser) },
+		Input:  func(*http.Request) any { return new(models.PWResetUser) },
 		Handle: passwordResetRequest,
 		NoConn: true,
 	}).Methods(http.MethodPost)
@@ -55,7 +55,7 @@
 	})).Methods(http.MethodGet)
 
 	api.Handle("/users", sysAdmin(&mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return new(models.User) },
+		Input:  func(*http.Request) any { return new(models.User) },
 		Handle: createUser,
 	})).Methods(http.MethodPost)
 
@@ -64,12 +64,12 @@
 	})).Methods(http.MethodGet)
 
 	api.Handle("/users/{user:.+}", anyUser(&mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return new(models.User) },
+		Input:  func(*http.Request) any { return new(models.User) },
 		Handle: updateUser,
 	})).Methods(http.MethodPut)
 
 	api.Handle("/users/{user:.+}", anyUser(&mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return new(models.UserPatch) },
+		Input:  func(*http.Request) any { return new(models.UserPatch) },
 		Handle: patchUser,
 	})).Methods(http.MethodPatch)
 
@@ -99,7 +99,7 @@
 	})).Methods(http.MethodGet)
 
 	api.Handle("/system/settings", sysAdmin(&mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return &map[string]string{} },
+		Input:  func(*http.Request) any { return &map[string]string{} },
 		Handle: setSystemSettings,
 	})).Methods(http.MethodPut)
 
@@ -119,7 +119,7 @@
 	})).Methods(http.MethodGet)
 
 	api.Handle("/templates/"+tTypes+"/{name}", waterwayAdmin(&mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return &json.RawMessage{} },
+		Input:  func(*http.Request) any { return &json.RawMessage{} },
 		Handle: createPrintTemplate,
 		Limit:  maxPrintTemplateSize,
 	})).Methods(http.MethodPost)
@@ -129,7 +129,7 @@
 	})).Methods(http.MethodDelete)
 
 	api.Handle("/templates/"+tTypes+"/{name}", waterwayAdmin(&mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return &json.RawMessage{} },
+		Input:  func(*http.Request) any { return &json.RawMessage{} },
 		Handle: updatePrintTemplate,
 		Limit:  maxPrintTemplateSize,
 	})).Methods(http.MethodPatch)
@@ -187,20 +187,20 @@
 
 	// difference calculation
 	api.Handle("/diff", anyUser(&mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return new(models.DiffCalculationInput) },
+		Input:  func(*http.Request) any { return new(models.DiffCalculationInput) },
 		Handle: diffCalculation,
 		NoConn: true,
 	})).Methods(http.MethodPost)
 
 	// Cross sections
 	api.Handle("/cross", anyUser(&mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return new(models.CrossSectionInput) },
+		Input:  func(*http.Request) any { return new(models.CrossSectionInput) },
 		Handle: crossSection,
 	})).Methods(http.MethodPost)
 
 	// Feature search
 	api.Handle("/search", anyUser(&mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return new(models.SearchRequest) },
+		Input:  func(*http.Request) any { return new(models.SearchRequest) },
 		Handle: searchFeature,
 	})).Methods(http.MethodPost)
 
@@ -282,7 +282,7 @@
 
 	api.Handle("/imports/config/{id:[0-9]+}",
 		waterwayAdmin(&mw.JSONHandler{
-			Input:  func(*http.Request) interface{} { return &json.RawMessage{} },
+			Input:  func(*http.Request) any { return &json.RawMessage{} },
 			Handle: modifyImportConfig,
 		})).Methods(http.MethodPatch)
 
@@ -298,7 +298,7 @@
 
 	api.Handle("/imports/config",
 		waterwayAdmin(&mw.JSONHandler{
-			Input:  func(*http.Request) interface{} { return new(imports.ImportConfigIn) },
+			Input:  func(*http.Request) any { return new(imports.ImportConfigIn) },
 			Handle: addImportConfig,
 		})).Methods(http.MethodPost)
 
@@ -321,7 +321,7 @@
 	})).Methods(http.MethodGet)
 
 	api.Handle("/imports", waterwayAdmin(&mw.JSONHandler{
-		Input:  func(*http.Request) interface{} { return &[]models.Review{} },
+		Input:  func(*http.Request) any { return &[]models.Review{} },
 		Handle: reviewImports,
 		NoConn: true,
 	})).Methods(http.MethodPatch)