Neo Oclib + Config Minio For private source

This commit is contained in:
mr
2026-05-27 16:14:33 +02:00
parent e3e29295ee
commit f7322156e1
13 changed files with 652 additions and 11 deletions
+41
View File
@@ -29,6 +29,9 @@ func resourceTypeEnum(t string, special bool) []oclib.LibDataEnum {
if t == "storage" || t == "live" {
e = append(e, oclib.LibDataEnum(oclib.LIVE_STORAGE))
}
if t == "service" || t == "live" {
e = append(e, oclib.LibDataEnum(oclib.LIVE_SERVICE))
}
if t == "datacenter" || t == "live" {
e = append(e, oclib.LibDataEnum(oclib.LIVE_DATACENTER))
}
@@ -92,6 +95,44 @@ func (o *DatacenterController) Search() {
o.ServeJSON()
}
// @Title GetAllCompatible
// @Description find booking by id
// @Param type path string true "the word type you want to get"
// @Param is_draft query string false "draft wished"
// @Param offset query string false
// @Param limit query string false
// @Success 200 {booking} models.booking
// @router /compatible/:type [put]
func (o *DatacenterController) GetAllCompatible() {
user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
isDraft := o.Ctx.Input.Query("is_draft")
offset, _ := strconv.Atoi(o.Ctx.Input.Query("offset"))
limit, _ := strconv.Atoi(o.Ctx.Input.Query("limit"))
var res map[string]interface{}
json.Unmarshal(o.Ctx.Input.CopyBody(100000), &res)
m := map[string][]utils.ShallowDBObject{}
for _, col := range o.collection(false) {
if m[col.String()] == nil {
m[col.String()] = []utils.ShallowDBObject{}
}
s := oclib.NewRequest(oclib.LibDataEnum(col), user, peerID, groups, nil).LoadAll(isDraft == "true", int64(offset), int64(limit))
for _, ss := range s.Data {
if ss.(live.LiveInterface).IsCompatible(res) {
m[col.String()] = append(m[col.String()], ss)
}
}
}
fmt.Println(m)
o.Data["json"] = map[string]interface{}{
"data": m,
"code": 200,
"err": nil,
}
o.ServeJSON()
}
// @Title GetAll
// @Description find booking by id
// @Param type path string true "the word type you want to get"