Add depot, attendant, jetfire, optimus, ota services with kustomize overlays
This commit is contained in:
55
services/ota_update_go/handlers/sub_feature_delete.go
Normal file
55
services/ota_update_go/handlers/sub_feature_delete.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"otaupdate/controllers"
|
||||
"otaupdate/services"
|
||||
|
||||
"github.com/fiskerinc/cloud-services/pkg/common"
|
||||
"github.com/go-pg/pg/v10/orm"
|
||||
"github.com/google/uuid"
|
||||
"github.com/gorilla/schema"
|
||||
)
|
||||
|
||||
// @deprecated
|
||||
// HandleSubscriptionFeatureDelete godoc
|
||||
// @Summary Delete subscription feature
|
||||
// @Description Delete subscription feature data. Requires delete permissions
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param Authorization header string false "Bearer <ID token>"
|
||||
// @Param Api-Key header string false "<API token>"
|
||||
// @Param id query string true "Subscription feature id"
|
||||
// @Success 200 {object} common.JSONMessage
|
||||
// @Failure 400 {object} common.JSONError "Bad request"
|
||||
// @Failure 401 {object} common.JSONError "Unauthorized"
|
||||
// @Failure 503 {object} common.JSONError "Service unavailable"
|
||||
// @Router /subscriptionfeature [delete]
|
||||
func HandleSubscriptionFeatureDelete(w http.ResponseWriter, r *http.Request) {
|
||||
subscriptionFeatureDelete.Handle(w, r)
|
||||
}
|
||||
|
||||
var subscriptionFeatureDelete = controllers.NewDelete(&subscriptionFeatureDeleteHelper{})
|
||||
|
||||
type subscriptionFeatureDeleteHelper struct {
|
||||
SubscriptionFeatureHelper
|
||||
}
|
||||
|
||||
func (h *subscriptionFeatureDeleteHelper) ParseDeleteQueryParams(r *http.Request) interface{} {
|
||||
req := common.SubscriptionFeature{}
|
||||
decoder := schema.NewDecoder()
|
||||
|
||||
decoder.SetAliasTag("json")
|
||||
decoder.Decode(&req, r.URL.Query())
|
||||
|
||||
return &req
|
||||
}
|
||||
|
||||
func (h *subscriptionFeatureDeleteHelper) QueryDelete(model interface{}) (orm.Result, error) {
|
||||
return services.GetDB().GetSubFeatures().Delete(model.(*common.SubscriptionFeature))
|
||||
}
|
||||
|
||||
type SubscriptionFeatureDeleteRequest struct {
|
||||
ID uuid.UUID `validate:"required"`
|
||||
}
|
||||
Reference in New Issue
Block a user