Add depot, attendant, jetfire, optimus, ota services with kustomize overlays

This commit is contained in:
Chris Rai
2026-01-31 15:35:07 -05:00
parent a0ec642ca1
commit 9a5cb2f547
404 changed files with 38817 additions and 16 deletions

View File

@@ -0,0 +1,38 @@
package controllers
import (
"net/http"
"github.com/fiskerinc/cloud-services/pkg/utils"
"github.com/go-pg/pg/v10/orm"
"github.com/fiskerinc/cloud-services/pkg/loggerdataresp"
)
func NewCreate(helper CreateHelperInterface) *HandleCreate {
return &HandleCreate{Helper: helper}
}
type CreateHelperInterface interface {
ParseRequest(r *http.Request, model interface{}) error
QueryInsert(model interface{}) (orm.Result, error)
NewModel() interface{}
}
type HandleCreate struct {
Helper CreateHelperInterface
}
func (h *HandleCreate) Handle(w http.ResponseWriter, r *http.Request) {
model := h.Helper.NewModel()
err := h.Helper.ParseRequest(r, model)
if loggerdataresp.BadDataErrorResp(w, err, http.StatusBadRequest) {
return
}
_, err = h.Helper.QueryInsert(model)
if loggerdataresp.BadDataErrorResp(w, err, http.StatusServiceUnavailable) {
return
}
utils.RespJSON(w, http.StatusOK, model)
}