Add depot, attendant, jetfire, optimus, ota services with kustomize overlays
This commit is contained in:
44
services/ota_update_go/handlers/sub_package_update.go
Normal file
44
services/ota_update_go/handlers/sub_package_update.go
Normal file
@@ -0,0 +1,44 @@
|
||||
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
|
||||
// HandleSubscriptionPackageUpdate godoc
|
||||
// @Summary Update subscription package
|
||||
// @Description Update subscription package
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param Authorization header string false "Bearer <ID token>"
|
||||
// @Param Api-Key header string false "<API token>"
|
||||
// @Param package body SubPackagesUpdateRequest true "Subscription package data"
|
||||
// @Success 200 {object} common.SubscriptionPackage
|
||||
// @Failure 400 {object} common.JSONError "Bad request"
|
||||
// @Failure 401 {object} common.JSONError "Unauthorized"
|
||||
// @Failure 503 {object} common.JSONError "Service unavailable"
|
||||
// @Router /subscriptionpackage [put]
|
||||
func HandleSubscriptionPackageUpdate(w http.ResponseWriter, r *http.Request) {
|
||||
subscriptionPackageUpdate.Handle(w, r)
|
||||
}
|
||||
|
||||
var subscriptionPackageUpdate = controllers.NewUpdate(&subscriptionPackageUpdateHelper{})
|
||||
|
||||
type subscriptionPackageUpdateHelper struct {
|
||||
SubscriptionPackagesHelper
|
||||
}
|
||||
|
||||
func (h *subscriptionPackageUpdateHelper) QueryUpdate(model interface{}) (orm.Result, error) {
|
||||
return services.GetDB().GetSubPackages().Update(model.(*common.SubscriptionPackage))
|
||||
}
|
||||
|
||||
type SubPackagesUpdateRequest struct {
|
||||
ID uuid.UUID `json:"uuid"`
|
||||
SubPackagesAddRequest
|
||||
}
|
||||
Reference in New Issue
Block a user