diff --git a/controllers/resource.go b/controllers/resource.go index 6cdd649..2d78804 100755 --- a/controllers/resource.go +++ b/controllers/resource.go @@ -57,6 +57,8 @@ func (o *ResourceController) notFound() { // @Description list all resources across all types // @Param type path string true "the type you want to get" // @Param is_draft query string false "draft wished" +// @Param offset query string false "offset wished" +// @Param limit query string false "limit wished" // @Success 200 {resource} models.resource // @router /:type [get] func (o *ResourceController) GetAll() { @@ -86,6 +88,8 @@ func (o *ResourceController) GetAll() { // @Param type path string true "the type you want to get" // @Param search path string true "the search you want to get" // @Param is_draft query string false "draft wished" +// @Param offset query string false "offset wished" +// @Param limit query string false "limit wished" // @Success 200 {resource} models.resource // @router /:type/search/:search [get] func (o *ResourceController) Search() { @@ -151,8 +155,9 @@ func (o *ResourceController) Post() { } user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) var res map[string]interface{} - json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res) + json.Unmarshal(o.Ctx.Input.CopyBody(100000), &res) data := oclib.NewRequest(libs[0], user, peerID, groups, nil).StoreOne(res) + fmt.Println(data.Data, res["name"], libs[0]) if data.Err == "" { payload, _ := json.Marshal(data.Data.Serialize(data.Data)) infrastructure.EmitNATS(user, groups, tools.PropalgationMessage{ @@ -206,10 +211,12 @@ func (o *ResourceController) Put() { // @Success 200 {resource} models.resource // @router /:type/:id [delete] func (o *ResourceController) Delete() { + fmt.Println("THERE") user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) id := o.Ctx.Input.Param(":id") for _, col := range o.collection(false) { data := oclib.NewRequest(col, user, peerID, groups, nil).DeleteOne(id) + fmt.Println(col, data, id) if data.Err == "" { o.Data["json"] = data payload, _ := json.Marshal(data.Data.Serialize(data.Data)) diff --git a/go.mod b/go.mod index b5b550d..38c2f2c 100755 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module oc-catalog go 1.25.0 require ( - cloud.o-forge.io/core/oc-lib v0.0.0-20260403121807-913d9b3dfb0a + cloud.o-forge.io/core/oc-lib v0.0.0-20260407073631-5dbe55e63081 github.com/beego/beego/v2 v2.3.8 github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 github.com/smartystreets/goconvey v1.7.2 diff --git a/go.sum b/go.sum index 897641d..427ee6a 100755 --- a/go.sum +++ b/go.sum @@ -10,6 +10,10 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20260402080126-2bc45557938b h1:jkvJ1+aiitFPl cloud.o-forge.io/core/oc-lib v0.0.0-20260402080126-2bc45557938b/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= cloud.o-forge.io/core/oc-lib v0.0.0-20260403121807-913d9b3dfb0a h1:H7K91js08Vyx307MW6BwQ/kqNGTrQVMaR3xvrIrc2W8= cloud.o-forge.io/core/oc-lib v0.0.0-20260403121807-913d9b3dfb0a/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260407063242-2e9f4cb9f466 h1:1xy9pZenAkT1eHY+3ruzYimaLrCKRzYovJgjO61QSok= +cloud.o-forge.io/core/oc-lib v0.0.0-20260407063242-2e9f4cb9f466/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= +cloud.o-forge.io/core/oc-lib v0.0.0-20260407073631-5dbe55e63081 h1:Fl08ZK6LrzkyFxxhTS+GAyEGiNR8kPvoBefo4iUVP/M= +cloud.o-forge.io/core/oc-lib v0.0.0-20260407073631-5dbe55e63081/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= diff --git a/oc-catalog b/oc-catalog deleted file mode 100755 index 49d6766..0000000 Binary files a/oc-catalog and /dev/null differ diff --git a/swagger/swagger.json b/swagger/swagger.json index a347305..3a50e0d 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -236,6 +236,18 @@ "name": "is_draft", "description": "draft wished", "type": "string" + }, + { + "in": "query", + "name": "offset", + "description": "offset wished", + "type": "string" + }, + { + "in": "query", + "name": "limit", + "description": "limit wished", + "type": "string" } ], "responses": { @@ -288,6 +300,18 @@ "name": "is_draft", "description": "draft wished", "type": "string" + }, + { + "in": "query", + "name": "offset", + "description": "offset wished", + "type": "string" + }, + { + "in": "query", + "name": "limit", + "description": "limit wished", + "type": "string" } ], "responses": { @@ -340,6 +364,18 @@ "name": "is_draft", "description": "draft wished", "type": "string" + }, + { + "in": "query", + "name": "offset", + "description": "offset wished", + "type": "string" + }, + { + "in": "query", + "name": "limit", + "description": "limit wished", + "type": "string" } ], "responses": { @@ -406,6 +442,18 @@ "name": "is_draft", "description": "draft wished", "type": "string" + }, + { + "in": "query", + "name": "offset", + "description": "offset wished", + "type": "string" + }, + { + "in": "query", + "name": "limit", + "description": "limit wished", + "type": "string" } ], "responses": { diff --git a/swagger/swagger.yml b/swagger/swagger.yml index 7be3417..cc45146 100644 --- a/swagger/swagger.yml +++ b/swagger/swagger.yml @@ -187,6 +187,14 @@ paths: name: is_draft description: draft wished type: string + - in: query + name: offset + description: offset wished + type: string + - in: query + name: limit + description: limit wished + type: string responses: "200": description: '{compute} models.compute' @@ -242,6 +250,14 @@ paths: name: is_draft description: draft wished type: string + - in: query + name: offset + description: offset wished + type: string + - in: query + name: limit + description: limit wished + type: string responses: "200": description: '{compute} models.compute' @@ -263,6 +279,14 @@ paths: name: is_draft description: draft wished type: string + - in: query + name: offset + description: offset wished + type: string + - in: query + name: limit + description: limit wished + type: string responses: "200": description: '{resource} models.resource' @@ -389,6 +413,14 @@ paths: name: is_draft description: draft wished type: string + - in: query + name: offset + description: offset wished + type: string + - in: query + name: limit + description: limit wished + type: string responses: "200": description: '{resource} models.resource'