Add depot, attendant, jetfire, optimus, ota services with kustomize overlays
This commit is contained in:
43
services/ota_update_go/handlers/sub_feature_add.go
Normal file
43
services/ota_update_go/handlers/sub_feature_add.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"otaupdate/controllers"
|
||||
"otaupdate/services"
|
||||
|
||||
"github.com/fiskerinc/cloud-services/pkg/common"
|
||||
"github.com/go-pg/pg/v10/orm"
|
||||
)
|
||||
|
||||
// @deprecated
|
||||
// HandleSubscriptionFeatureAdd godoc
|
||||
// @Summary Add subscription feature
|
||||
// @Description Create subscription feature
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param Authorization header string false "Bearer <ID token>"
|
||||
// @Param Api-Key header string false "<API token>"
|
||||
// @Param feature body SubFeatureRequest 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 [post]
|
||||
func HandleSubscriptionFeatureAdd(w http.ResponseWriter, r *http.Request) {
|
||||
subscriptionFeatureAdd.Handle(w, r)
|
||||
}
|
||||
|
||||
var subscriptionFeatureAdd = controllers.NewCreate(&subscriptionFeatureCreateHelper{})
|
||||
|
||||
type subscriptionFeatureCreateHelper struct {
|
||||
SubscriptionFeatureHelper
|
||||
}
|
||||
|
||||
func (h *subscriptionFeatureCreateHelper) QueryInsert(model interface{}) (orm.Result, error) {
|
||||
return services.GetDB().GetSubFeatures().Insert(model.(*common.SubscriptionFeature))
|
||||
}
|
||||
|
||||
type SubFeatureRequest struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
Reference in New Issue
Block a user