45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
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"
|
|
)
|
|
|
|
// @deprecated
|
|
// HandleSubscriptionFeatureUpdate godoc
|
|
// @Summary Add subscription package
|
|
// @Description Create subscription package
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param Authorization header string false "Bearer <ID token>"
|
|
// @Param Api-Key header string false "<API token>"
|
|
// @Param feature body SubFeatureUpdateRequest true "Subscription feature data"
|
|
// @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 [put]
|
|
func HandleSubscriptionFeatureUpdate(w http.ResponseWriter, r *http.Request) {
|
|
subscriptionFeatureUpdate.Handle(w, r)
|
|
}
|
|
|
|
var subscriptionFeatureUpdate = controllers.NewUpdate(&subscriptionFeatureUpdateHelper{})
|
|
|
|
type subscriptionFeatureUpdateHelper struct {
|
|
SubscriptionFeatureHelper
|
|
}
|
|
|
|
func (h *subscriptionFeatureUpdateHelper) QueryUpdate(model interface{}) (orm.Result, error) {
|
|
return services.GetDB().GetSubFeatures().Update(model.(*common.SubscriptionFeature))
|
|
}
|
|
|
|
type SubFeatureUpdateRequest struct {
|
|
ID uuid.UUID `json:"uuid"`
|
|
SubFeatureRequest
|
|
}
|