This commit is contained in:
mr
2026-04-27 12:52:28 +02:00
parent f048b420d7
commit 26fc02c5b2
5 changed files with 5 additions and 6 deletions

View File

@@ -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
}

View File

@@ -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"`

View File

@@ -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

View File

@@ -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)
}

View File

@@ -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"`
}