fix(publish): handle inline model corectly on publish
This commit is contained in:
parent
4dbf80562b
commit
b960840197
1 changed files with 6 additions and 1 deletions
|
|
@ -38,8 +38,13 @@ func PublishHandler(registry service.RegistryService, authService auth.Service)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get server details from the request
|
// Get server details from the request
|
||||||
serverDetail := publishReq.ServerDetail
|
var serverDetail model.ServerDetail
|
||||||
|
|
||||||
|
err = json.Unmarshal(body, &serverDetail)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "Invalid server detail payload: "+err.Error(), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
// Validate required fields
|
// Validate required fields
|
||||||
if serverDetail.Name == "" {
|
if serverDetail.Name == "" {
|
||||||
http.Error(w, "Name is required", http.StatusBadRequest)
|
http.Error(w, "Name is required", http.StatusBadRequest)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue