fix(handlers): Handle DELETE for environment sensors
It now works as advertised in the README! *ahem*...
This commit is contained in:
parent
b54d4a39cd
commit
b054b02be6
2 changed files with 27 additions and 4 deletions
|
|
@ -11,7 +11,7 @@ import (
|
|||
"git.hamburg.ccc.de/ccchh/spaceapid/types"
|
||||
)
|
||||
|
||||
func EnvironmentSensor(
|
||||
func EnvironmentSensorPUT(
|
||||
authDB config.HTTPBACredentials, validCredentials []config.HTTPBACredentialID,
|
||||
resp *types.EnvironmentSensor,
|
||||
) func(http.ResponseWriter, *http.Request) {
|
||||
|
|
@ -35,3 +35,20 @@ func EnvironmentSensor(
|
|||
resp.LastChange = time.Now().Unix()
|
||||
}
|
||||
}
|
||||
|
||||
func EnvironmentSensorDELETE(
|
||||
authDB config.HTTPBACredentials, validCredentials []config.HTTPBACredentialID,
|
||||
resp *types.EnvironmentSensor,
|
||||
) func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
_, err := updateEndpointValidator(authDB, validCredentials, w, r)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
// Set SpaceAPI response values
|
||||
resp.Value = 0
|
||||
resp.LastChange = time.Now().Unix()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue