From 26fc02c5b2369c3f1e354f5de5e8edfbd701826b Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 27 Apr 2026 12:52:28 +0200 Subject: [PATCH] oclib --- entrypoint.go | 1 - models/resources/processing.go | 1 - .../resources/purchase_resource/purchase_resource_accessor.go | 2 -- models/resources/resource_accessor.go | 3 +++ models/resources/service.go | 4 ++-- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/entrypoint.go b/entrypoint.go index e221a15..e4502d4 100644 --- a/entrypoint.go +++ b/entrypoint.go @@ -219,7 +219,6 @@ func GetExtend(obj utils.DBObject, extends map[string][]tools.DataType, cache ma } for _, vv := range v { if cache[vv] != nil && cache[vv][fmt.Sprintf("%v", base[k+"_id"])] != nil { - fmt.Println("FOUND", vv, k, cache[vv][fmt.Sprintf("%v", base[k+"_id"])]) base[k] = cache[vv][fmt.Sprintf("%v", base[k+"_id"])] continue } diff --git a/models/resources/processing.go b/models/resources/processing.go index e026d54..a4cdae5 100755 --- a/models/resources/processing.go +++ b/models/resources/processing.go @@ -28,7 +28,6 @@ type ProcessingUsage struct { */ type ProcessingResource struct { AbstractInstanciatedResource[*ProcessingInstance] - IsEvent bool `json:"is_event,omitempty" bson:"is_event,omitempty"` Infrastructure enum.InfrastructureType `json:"infrastructure" bson:"infrastructure" default:"-1"` Usage *ProcessingUsage `bson:"usage,omitempty" json:"usage,omitempty"` OpenSource bool `json:"open_source" bson:"open_source" default:"false"` diff --git a/models/resources/purchase_resource/purchase_resource_accessor.go b/models/resources/purchase_resource/purchase_resource_accessor.go index bc2c8a8..86a7748 100644 --- a/models/resources/purchase_resource/purchase_resource_accessor.go +++ b/models/resources/purchase_resource/purchase_resource_accessor.go @@ -1,7 +1,6 @@ package purchase_resource import ( - "fmt" "time" "cloud.o-forge.io/core/oc-lib/logs" @@ -30,7 +29,6 @@ func NewAccessor(request *tools.APIRequest) *PurchaseResourceMongoAccessor { */ func (a *PurchaseResourceMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) { return utils.GenericLoadOne(id, a.New(), func(d utils.DBObject) (utils.DBObject, int, error) { - fmt.Println("FOUND PURCHASE", d) if d.(*PurchaseResource).EndDate != nil && time.Now().UTC().After(*d.(*PurchaseResource).EndDate) { utils.GenericDelete(d, a) return nil, 404, nil diff --git a/models/resources/resource_accessor.go b/models/resources/resource_accessor.go index 3aaf69f..251923a 100755 --- a/models/resources/resource_accessor.go +++ b/models/resources/resource_accessor.go @@ -2,6 +2,7 @@ package resources import ( "errors" + "fmt" "slices" "cloud.o-forge.io/core/oc-lib/dbs" @@ -97,8 +98,10 @@ func (wfa *ResourceMongoAccessor[T]) LoadAll(isDraft bool, offset int64, limit i func (wfa *ResourceMongoAccessor[T]) Search(filters *dbs.Filters, search string, isDraft bool, offset int64, limit int64) ([]utils.ShallowDBObject, int, error) { if filters == nil && search == "*" { return utils.GenericLoadAll[T](func(d utils.DBObject) utils.ShallowDBObject { + fmt.Println("Search", d) d.(T).VerifyBuy() d.(T).SetAllowedInstances(wfa.Request) + fmt.Println("Search2", d) return d }, isDraft, wfa, offset, limit) } diff --git a/models/resources/service.go b/models/resources/service.go index e5d61d6..958c168 100755 --- a/models/resources/service.go +++ b/models/resources/service.go @@ -26,7 +26,7 @@ func (m ServiceMode) String() string { type ServiceProtocol int const ( - HTTP ServiceProtocol = iota + HTTP ServiceProtocol = iota GRPC WEBSOCKET TCP @@ -111,7 +111,7 @@ type ServiceResourcePartnership struct { // - DEPLOYMENT: uptime billing via ExploitPricingProfile (pay while service is up) // - HOSTED: per-call billing via AccessPricingProfile (pay per request) type ServiceResourcePricingProfile struct { - Mode ServiceMode `json:"mode" bson:"mode"` + Mode ServiceMode `json:"mode" bson:"mode"` UptimePricing *pricing.ExploitPricingProfile[pricing.TimePricingStrategy] `json:"uptime_pricing,omitempty" bson:"uptime_pricing,omitempty"` AccessPricing *pricing.AccessPricingProfile[pricing.TimePricingStrategy] `json:"access_pricing,omitempty" bson:"access_pricing,omitempty"` }