Add depot, attendant, jetfire, optimus, ota services with kustomize overlays
This commit is contained in:
48
services/ota_update_go/handlers/sub_feature_get.go
Normal file
48
services/ota_update_go/handlers/sub_feature_get.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"otaupdate/controllers"
|
||||
"otaupdate/services"
|
||||
|
||||
"github.com/fiskerinc/cloud-services/pkg/common"
|
||||
"github.com/gorilla/schema"
|
||||
)
|
||||
|
||||
// @deprecated
|
||||
// HandleSubscriptionFeatureGet godoc
|
||||
// @Summary Get update manifest
|
||||
// @Description Get update manifest by id
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param Authorization header string false "Bearer <ID token>"
|
||||
// @Param Api-Key header string false "<API token>"
|
||||
// @Param id query string false "Subscription feature id"
|
||||
// @Success 200 {object} common.SubscriptionFeature
|
||||
// @Failure 400 {object} common.JSONError "Bad request"
|
||||
// @Failure 401 {object} common.JSONError "Unauthorized"
|
||||
// @Failure 503 {object} common.JSONError "Service unavailable"
|
||||
// @Router /subscriptionfeature [get]
|
||||
func HandleSubscriptionFeatureGet(w http.ResponseWriter, r *http.Request) {
|
||||
subscriptionFeatureGet.Handle(w, r)
|
||||
}
|
||||
|
||||
var subscriptionFeatureGet = controllers.NewGetModel(&subscriptionFeatureGetModelHelper{})
|
||||
|
||||
type subscriptionFeatureGetModelHelper struct {
|
||||
SubscriptionFeatureHelper
|
||||
}
|
||||
|
||||
func (h *subscriptionFeatureGetModelHelper) ParseGetModelParams(r *http.Request) interface{} {
|
||||
decoder := schema.NewDecoder()
|
||||
model := common.SubscriptionFeature{}
|
||||
|
||||
decoder.SetAliasTag("json")
|
||||
decoder.Decode(&model, r.URL.Query())
|
||||
|
||||
return &model
|
||||
}
|
||||
|
||||
func (h *subscriptionFeatureGetModelHelper) QueryLoad(model interface{}) error {
|
||||
return services.GetDB().GetSubFeatures().Load(model.(*common.SubscriptionFeature))
|
||||
}
|
||||
Reference in New Issue
Block a user