set up unfonctionnal rework, TODO -> pricing separation

This commit is contained in:
mr
2024-12-17 10:42:00 +01:00
parent 7696f065f8
commit be3b09b683
20 changed files with 199 additions and 174 deletions

View File

@@ -18,7 +18,12 @@ const (
LICENCED
)
type abstractDataResource struct {
/*
* DataResource is a struct that represents a data resource
* it defines the resource data
*/
type DataResource struct {
AbstractResource[*ResourceInstance[*DataResourcePartnership]]
Type string `bson:"type,omitempty" json:"type,omitempty"`
Quality string `bson:"quality,omitempty" json:"quality,omitempty"`
OpenData bool `bson:"open_data" json:"open_data" default:"false"` // Type is the type of the storage
@@ -26,17 +31,7 @@ type abstractDataResource struct {
UpdatePeriod time.Time `bson:"update_period,omitempty" json:"update_period,omitempty"`
PersonalData bool `bson:"personal_data,omitempty" json:"personal_data,omitempty"`
AnonymizedPersonalData bool `bson:"anonymized_personal_data,omitempty" json:"anonymized_personal_data,omitempty"`
SizeGB float64 `json:"size_gb,omitempty" bson:"size_gb,omitempty"` // SizeGB is the size of the data
}
/*
* DataResource is a struct that represents a data resource
* it defines the resource data
*/
type DataResource struct {
AbstractResource[*ResourceInstance[*DataResourcePartnership]]
abstractDataResource // AbstractResource contains the basic fields of an object (id, name)
License DataLicense `json:"license" bson:"license" description:"license of the data" default:"0"` // License is the license of the data
SizeGB float64 `json:"size_gb,omitempty" bson:"size_gb,omitempty"` // SizeGB is the size of the data License DataLicense `json:"license" bson:"license" description:"license of the data" default:"0"` // License is the license of the data
// ? Interest DataLicense `json:"interest" bson:"interest" description:"interest of the data" default:"0"` // Interest is the interest of the data
Example string `json:"example,omitempty" bson:"example,omitempty" description:"base64 encoded data"` // Example is an example of the data
}
@@ -102,13 +97,12 @@ func (p *DataResourcePricingProfile) GetPrice(amountOfData float64, explicitDura
return p.Pricing.GetPrice(amountOfData, explicitDuration, start, &end)
}
func (p *DataResourcePricingProfile) IsBuying() bool {
func (p *DataResourcePricingProfile) IsPurchased() bool {
return p.Pricing.BuyingStrategy != pricing.PAY_PER_USE
}
type CustomizedDataResource struct {
AbstractCustomizedResource[*ResourceInstance[*DataResourcePartnership]]
abstractDataResource
StorageGB float64 `json:"storage_gb,omitempty" bson:"storage_gb,omitempty"`
}