oclib update + controller adjustment

This commit is contained in:
mr
2025-02-18 15:05:47 +01:00
parent 8eeae90b67
commit 2d3224704a
5 changed files with 38 additions and 10 deletions

View File

@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"oc-datacenter/infrastructure"
"strings"
"time"
oclib "cloud.o-forge.io/core/oc-lib"
@@ -198,7 +199,6 @@ func (o *BookingController) Check() {
// @Success 200 {object} models.object
// @router / [post]
func (o *BookingController) Post() {
fmt.Println("POST")
/*
* This function is used to create a booking.
* It takes the following parameters:
@@ -239,7 +239,19 @@ func (o *BookingController) Post() {
o.ServeJSON()
return
}
fmt.Println("there was an error creating the namespace", o.createNamespace(resp.ExecutionsID))
if err := o.createNamespace(resp.ExecutionsID); err != nil {
if strings.Contains(err.Error(), "already exists") {
err = nil
} else {
o.Data["json"] = map[string]interface{}{
"data": nil,
"code": 500,
"error": err.Error(),
}
o.ServeJSON()
return
}
}
o.Data["json"] = map[string]interface{}{
"data": []interface{}{b},
"code": 200,