diff --git a/controllers/collaborative_area.go b/controllers/collaborative_area.go index f9f8e75..6f94c86 100644 --- a/controllers/collaborative_area.go +++ b/controllers/collaborative_area.go @@ -6,6 +6,7 @@ import ( "slices" oclib "cloud.o-forge.io/core/oc-lib" + "cloud.o-forge.io/core/oc-lib/config" "cloud.o-forge.io/core/oc-lib/tools" beego "github.com/beego/beego/v2/server/web" ) @@ -36,12 +37,15 @@ var paths = map[tools.DataType]map[tools.METHOD]string{ // paths used to call ot // @Title Search // @Description search shared workspace // @Param search path string true "the word search you want to get" +// @Param is_draft query string false "draft wished" // @Success 200 {shared workspace} models.shared_workspace // @router /search/:search [get] func (o *CollaborativeAreaController) Search() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) // store and return Id or post with UUID search := o.Ctx.Input.Param(":search") - o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(tools.COLLABORATIVE_AREA)) + isDraft := o.Ctx.Input.Query("is_draft") + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).Search(nil, search, isDraft == "true") o.ServeJSON() } @@ -52,6 +56,7 @@ func (o *CollaborativeAreaController) Search() { // @Success 200 {shared workspace} models.shared_workspace // @router /:id [put] func (o *CollaborativeAreaController) Put() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) // store and return Id or post with UUID var res map[string]interface{} id := o.Ctx.Input.Param(":id") @@ -59,7 +64,7 @@ func (o *CollaborativeAreaController) Put() { caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) fmt.Println("UPDATE", res) - o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), res, id, caller) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).UpdateOne(res, id) o.ServeJSON() } @@ -69,20 +74,24 @@ func (o *CollaborativeAreaController) Put() { // @Success 200 {shared workspace} models.shared_workspace // @router / [post] func (o *CollaborativeAreaController) Post() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) var res map[string]interface{} json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res) - o.Data["json"] = oclib.StoreOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), res, caller) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).StoreOne(res) o.ServeJSON() } // @Title GetAll // @Description find shared workspace by id +// @Param is_draft query string false "draft wished" // @Success 200 {shared_workspace} models.shared_workspace // @router / [get] func (o *CollaborativeAreaController) GetAll() { - o.Data["json"] = oclib.LoadAll(oclib.LibDataEnum(tools.COLLABORATIVE_AREA)) + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) + isDraft := o.Ctx.Input.Query("is_draft") + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).LoadAll(isDraft == "true") o.ServeJSON() } @@ -92,8 +101,9 @@ func (o *CollaborativeAreaController) GetAll() { // @Success 200 {shared workspace} models.shared_workspace // @router /:id [get] func (o *CollaborativeAreaController) Get() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) id := o.Ctx.Input.Param(":id") - o.Data["json"] = oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).LoadOne(id) o.ServeJSON() } @@ -104,11 +114,12 @@ func (o *CollaborativeAreaController) Get() { // @Success 200 {shared workspace} models.shared_workspace // @router /:id/workspace/:id2 [delete] func (o *CollaborativeAreaController) RemoveWorkspace() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) id := o.Ctx.Input.Param(":id") id2 := o.Ctx.Input.Param(":id2") - r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id) + r := oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).LoadOne(id) shared := r.ToCollaborativeArea() newWorkspace := []string{} if slices.Contains(shared.Workspaces, id2) { @@ -119,7 +130,8 @@ func (o *CollaborativeAreaController) RemoveWorkspace() { } shared.Workspaces = newWorkspace } - o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).UpdateOne( + shared.Serialize(shared), id) o.ServeJSON() } @@ -130,11 +142,12 @@ func (o *CollaborativeAreaController) RemoveWorkspace() { // @Success 200 {shared workspace} models.shared_workspace // @router /:id/workflow/:id2 [delete] func (o *CollaborativeAreaController) RemoveWorkflow() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) id := o.Ctx.Input.Param(":id") id2 := o.Ctx.Input.Param(":id2") - r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id) + r := oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).LoadOne(id) shared := r.ToCollaborativeArea() newWorkflows := []string{} for _, w := range shared.Workflows { @@ -143,7 +156,8 @@ func (o *CollaborativeAreaController) RemoveWorkflow() { } } shared.Workflows = newWorkflows - o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).UpdateOne( + shared.Serialize(shared), id) o.ServeJSON() } @@ -154,14 +168,15 @@ func (o *CollaborativeAreaController) RemoveWorkflow() { // @Success 200 {shared workspace} models.shared_workspace // @router /:id/peer/:id2 [delete] func (o *CollaborativeAreaController) RemovePeer() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) id := o.Ctx.Input.Param(":id") id2 := o.Ctx.Input.Param(":id2") - r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id) + r := oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).LoadOne(id) shared := r.ToCollaborativeArea() - newPeers := []string{} - if shared.CreatorID != id2 { + newPeers := map[string][]string{} + if shared.CreatorID == id2 { o.Data["json"] = map[string]interface{}{ "data": nil, "code": 409, @@ -170,15 +185,28 @@ func (o *CollaborativeAreaController) RemovePeer() { o.ServeJSON() return } - if slices.Contains(shared.Peers, id) && shared.CreatorID != id2 { - for _, peer := range shared.Peers { - if peer != id2 { - newPeers = append(newPeers, peer) - } + if shared.AllowedPeersGroup != nil { + keys := make([]string, len(shared.AllowedPeersGroup)) + i := 0 + for k := range shared.AllowedPeersGroup { + keys[i] = k + i++ + } + if slices.Contains(keys, id) && shared.CreatorID != id2 { + for _, peer := range keys { + if peer != id2 { + if config.GetConfig().Whitelist { + newPeers[peer] = []string{"*"} + } else { + newPeers[peer] = []string{} + } + } + } + shared.AllowedPeersGroup = newPeers } - shared.Peers = newPeers } - o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).UpdateOne( + shared.Serialize(shared), id) o.ServeJSON() } @@ -189,11 +217,12 @@ func (o *CollaborativeAreaController) RemovePeer() { // @Success 200 {shared workspace} models.shared_workspace // @router /:id/rule/:id2 [delete] func (o *CollaborativeAreaController) RemoveRule() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) id := o.Ctx.Input.Param(":id") id2 := o.Ctx.Input.Param(":id2") - r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id) + r := oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).LoadOne(id) shared := r.ToCollaborativeArea() newRules := []string{} if shared != nil && slices.Contains(shared.Rules, id2) { @@ -204,7 +233,8 @@ func (o *CollaborativeAreaController) RemoveRule() { } shared.Rules = newRules } - o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).UpdateOne( + shared.Serialize(shared), id) o.ServeJSON() } @@ -215,11 +245,12 @@ func (o *CollaborativeAreaController) RemoveRule() { // @Success 200 {shared workspace} models.shared_workspace // @router /:id/workspace/:id2 [post] func (o *CollaborativeAreaController) AddWorkspace() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) id := o.Ctx.Input.Param(":id") id2 := o.Ctx.Input.Param(":id2") - r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id) + r := oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).LoadOne(id) if r.Code != 200 { o.Data["json"] = r o.ServeJSON() @@ -229,7 +260,8 @@ func (o *CollaborativeAreaController) AddWorkspace() { if shared != nil && !slices.Contains(shared.Workspaces, id2) { shared.Workspaces = append(shared.Workspaces, id2) } - o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).UpdateOne( + shared.Serialize(shared), id) o.ServeJSON() } @@ -240,16 +272,23 @@ func (o *CollaborativeAreaController) AddWorkspace() { // @Success 200 {shared workspace} models.shared_workspace // @router /:id/workflow/:id2 [post] func (o *CollaborativeAreaController) AddWorkflow() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) id := o.Ctx.Input.Param(":id") id2 := o.Ctx.Input.Param(":id2") - r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id) + r := oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).LoadOne(id) + if r.Code != 200 { + o.Data["json"] = r + o.ServeJSON() + return + } shared := r.ToCollaborativeArea() if shared != nil && !slices.Contains(shared.Workflows, id2) { shared.Workflows = append(shared.Workflows, id2) } - o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).UpdateOne( + shared.Serialize(shared), id) o.ServeJSON() } @@ -257,19 +296,29 @@ func (o *CollaborativeAreaController) AddWorkflow() { // @Description find shared workspace by id // @Param id path string true "the id you want to get" // @Param id2 path string true "the id you want to add" +// @Param body body models.workspace true "The shared workspace content" // @Success 200 {shared workspace} models.shared_workspace // @router /:id/peer/:id2 [post] func (o *CollaborativeAreaController) AddPeer() { + var res []string + json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res) + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) id := o.Ctx.Input.Param(":id") id2 := o.Ctx.Input.Param(":id2") - r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id) + r := oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).LoadOne(id) shared := r.ToCollaborativeArea() - if shared != nil && !slices.Contains(shared.Peers, id2) { - shared.Peers = append(shared.Peers, id2) + if shared.AllowedPeersGroup == nil { + shared.AllowedPeersGroup = map[string][]string{} } - o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller) + if config.GetConfig().Whitelist && len(res) == 0 { + shared.AllowedPeersGroup[id2] = []string{"*"} + } else { + shared.AllowedPeersGroup[id2] = res + } + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).UpdateOne( + shared.Serialize(shared), id) o.ServeJSON() } @@ -280,16 +329,17 @@ func (o *CollaborativeAreaController) AddPeer() { // @Success 200 {shared workspace} models.shared_workspace // @router /:id/rule/:id2 [post] func (o *CollaborativeAreaController) AddRule() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) id := o.Ctx.Input.Param(":id") id2 := o.Ctx.Input.Param(":id2") - r := oclib.LoadOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id) + r := oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, nil).LoadOne(id) shared := r.ToCollaborativeArea() if shared != nil && !slices.Contains(shared.Rules, id2) { shared.Rules = append(shared.Rules, id2) } - o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), shared.Serialize(), id, caller) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).UpdateOne(shared.Serialize(shared), id) o.ServeJSON() } @@ -299,9 +349,10 @@ func (o *CollaborativeAreaController) AddRule() { // @Success 200 {shared workspace} delete success! // @router /:id [delete] func (o *CollaborativeAreaController) Delete() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) id := o.Ctx.Input.Param(":id") caller := tools.NewHTTPCaller(paths) // caller used to send to peers caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true) - o.Data["json"] = oclib.DeleteOne(oclib.LibDataEnum(tools.COLLABORATIVE_AREA), id, caller) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.COLLABORATIVE_AREA), user, peerID, groups, caller).DeleteOne(id) o.ServeJSON() } diff --git a/controllers/rule.go b/controllers/rule.go index 2f8b860..2213b33 100644 --- a/controllers/rule.go +++ b/controllers/rule.go @@ -15,12 +15,15 @@ type RuleController struct { // @Title Search // @Description search rule // @Param search path string true "the word search you want to get" +// @Param is_draft query string false "draft wished" // @Success 200 {rule} models.rule // @router /search/:search [get] func (o *RuleController) Search() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) // store and return Id or post with UUID search := o.Ctx.Input.Param(":search") - o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(oclib.RULE)) + isDraft := o.Ctx.Input.Query("is_draft") + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.RULE), user, peerID, groups, nil).Search(nil, search, isDraft == "true") o.ServeJSON() } @@ -31,11 +34,12 @@ func (o *RuleController) Search() { // @Success 200 {rule} models.rule // @router /:id [put] func (o *RuleController) Put() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) // store and return ID or post with UUID var res map[string]interface{} id := o.Ctx.Input.Param(":id") json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res) - o.Data["json"] = oclib.UpdateOne(oclib.LibDataEnum(oclib.RULE), res, id) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.RULE), user, peerID, groups, nil).UpdateOne(res, id) o.ServeJSON() } @@ -45,18 +49,22 @@ func (o *RuleController) Put() { // @Success 200 {rule} models.rule // @router / [post] func (o *RuleController) Post() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) var res map[string]interface{} json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res) - o.Data["json"] = oclib.StoreOne(oclib.LibDataEnum(oclib.RULE), res) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.RULE), user, peerID, groups, nil).StoreOne(res) o.ServeJSON() } // @Title GetAll // @Description find rule by id +// @Param is_draft query string false "draft wished" // @Success 200 {rule} models.rule // @router / [get] func (o *RuleController) GetAll() { - o.Data["json"] = oclib.LoadAll(oclib.LibDataEnum(oclib.RULE)) + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) + isDraft := o.Ctx.Input.Query("is_draft") + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.RULE), user, peerID, groups, nil).LoadAll(isDraft == "true") o.ServeJSON() } @@ -66,8 +74,9 @@ func (o *RuleController) GetAll() { // @Success 200 {rule} models.rule // @router /:id [get] func (o *RuleController) Get() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) id := o.Ctx.Input.Param(":id") - o.Data["json"] = oclib.LoadOne(oclib.LibDataEnum(oclib.RULE), id) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.RULE), user, peerID, groups, nil).LoadOne(id) o.ServeJSON() } @@ -77,7 +86,8 @@ func (o *RuleController) Get() { // @Success 200 {rule} delete success! // @router /:id [delete] func (o *RuleController) Delete() { + user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request) id := o.Ctx.Input.Param(":id") - o.Data["json"] = oclib.DeleteOne(oclib.LibDataEnum(oclib.RULE), id) + o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.RULE), user, peerID, groups, nil).DeleteOne(id) o.ServeJSON() } diff --git a/go.mod b/go.mod index d852b0e..9d488c8 100644 --- a/go.mod +++ b/go.mod @@ -5,12 +5,13 @@ go 1.22.0 toolchain go1.22.4 require ( - cloud.o-forge.io/core/oc-lib v0.0.0-20250108155542-0f4adeea86be - github.com/beego/beego/v2 v2.3.4 + cloud.o-forge.io/core/oc-lib v0.0.0-20250205160221-88b7cfe2fd0f + github.com/beego/beego/v2 v2.3.1 ) require ( github.com/beorn7/perks v1.0.1 // indirect + github.com/biter777/countries v1.7.5 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/gabriel-vasile/mimetype v1.4.6 // indirect @@ -37,7 +38,7 @@ require ( github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect - github.com/robfig/cron/v3 v3.0.1 // indirect + github.com/robfig/cron v1.2.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect diff --git a/go.sum b/go.sum index 9b87ac8..8787a9c 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,12 @@ -cloud.o-forge.io/core/oc-lib v0.0.0-20250108155542-0f4adeea86be h1:1Yf8ihUxXjOEPqcfgtXJpJ/slxBUHhf7AgS7DZI3iUk= -cloud.o-forge.io/core/oc-lib v0.0.0-20250108155542-0f4adeea86be/go.mod h1:ya7Q+zHhaKM+XF6sAJ+avqHEVzaMnFJQih2X3TlTlGo= +cloud.o-forge.io/core/oc-lib v0.0.0-20250205160221-88b7cfe2fd0f h1:6V+Z81ywYoDYSVMnM4PVaJYXFgCN3xSG3ddiUPn4jL8= +cloud.o-forge.io/core/oc-lib v0.0.0-20250205160221-88b7cfe2fd0f/go.mod h1:2roQbUpv3a6mTIr5oU1ux31WbN8YucyyQvCQ0FqwbcE= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/beego/beego/v2 v2.3.1 h1:7MUKMpJYzOXtCUsTEoXOxsDV/UcHw6CPbaWMlthVNsc= github.com/beego/beego/v2 v2.3.1/go.mod h1:5cqHsOHJIxkq44tBpRvtDe59GuVRVv/9/tyVDxd5ce4= -github.com/beego/beego/v2 v2.3.4 h1:HurQEOGIEhLlPFCTR6ZDuQkybrUl2Ag2i6CdVD2rGiI= -github.com/beego/beego/v2 v2.3.4/go.mod h1:5cqHsOHJIxkq44tBpRvtDe59GuVRVv/9/tyVDxd5ce4= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/biter777/countries v1.7.5 h1:MJ+n3+rSxWQdqVJU8eBy9RqcdH6ePPn4PJHocVWUa+Q= +github.com/biter777/countries v1.7.5/go.mod h1:1HSpZ526mYqKJcpT5Ti1kcGQ0L0SrXWIaptUWjFfv2E= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/coreos/etcd v3.3.17+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -97,8 +97,8 @@ github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPA github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= -github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= +github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= diff --git a/swagger/swagger.json b/swagger/swagger.json index d3379b5..b56895f 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -22,6 +22,14 @@ ], "description": "find shared workspace by id\n\u003cbr\u003e", "operationId": "CollaborativeAreaController.GetAll", + "parameters": [ + { + "in": "query", + "name": "is_draft", + "description": "draft wished", + "type": "string" + } + ], "responses": { "200": { "description": "{shared_workspace} models.shared_workspace" @@ -66,6 +74,12 @@ "description": "the word search you want to get", "required": true, "type": "string" + }, + { + "in": "query", + "name": "is_draft", + "description": "draft wished", + "type": "string" } ], "responses": { @@ -170,6 +184,15 @@ "description": "the id you want to add", "required": true, "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "The shared workspace content", + "required": true, + "schema": { + "$ref": "#/definitions/models.workspace" + } } ], "responses": { @@ -357,7 +380,7 @@ "collaborative_area" ], "description": "find shared workspace by id\n\u003cbr\u003e", - "operationId": "CollaborativeAreaController.Add Workspace", + "operationId": "CollaborativeAreaController.Remove Workspace", "parameters": [ { "in": "path", diff --git a/swagger/swagger.yml b/swagger/swagger.yml index 22bb2e7..4282923 100644 --- a/swagger/swagger.yml +++ b/swagger/swagger.yml @@ -20,6 +20,11 @@ paths: find shared workspace by id
operationId: CollaborativeAreaController.GetAll + parameters: + - in: query + name: is_draft + description: draft wished + type: string responses: "200": description: '{shared_workspace} models.shared_workspace' @@ -114,6 +119,12 @@ paths: description: the id you want to add required: true type: string + - in: body + name: body + description: The shared workspace content + required: true + schema: + $ref: '#/definitions/models.workspace' responses: "200": description: '{shared workspace} models.shared_workspace' @@ -252,7 +263,7 @@ paths: description: |- find shared workspace by id
- operationId: CollaborativeAreaController.Add Workspace + operationId: CollaborativeAreaController.Remove Workspace parameters: - in: path name: id @@ -281,6 +292,10 @@ paths: description: the word search you want to get required: true type: string + - in: query + name: is_draft + description: draft wished + type: string responses: "200": description: '{shared workspace} models.shared_workspace'