resource as resource named

This commit is contained in:
mr
2024-07-19 10:54:58 +02:00
parent 218714683b
commit 2a9a784ec1
28 changed files with 381 additions and 284 deletions

View File

@@ -12,7 +12,7 @@ type URL struct {
Path string `bson:"path" json:"path"`
}
type Storage struct {
type StorageResource struct {
resources.AbstractResource
Capacity uint `bson:"capacity,omitempty" json:"capacity,omitempty"`
@@ -24,7 +24,7 @@ type Storage struct {
BookingPrice uint `bson:"booking_price,omitempty" json:"booking_price,omitempty"`
}
func (dma *Storage) Deserialize(j map[string]interface{}) utils.DBObject {
func (dma *StorageResource) Deserialize(j map[string]interface{}) utils.DBObject {
b, err := json.Marshal(j)
if err != nil {
return nil
@@ -33,7 +33,7 @@ func (dma *Storage) Deserialize(j map[string]interface{}) utils.DBObject {
return dma
}
func (dma *Storage) Serialize() map[string]interface{} {
func (dma *StorageResource) Serialize() map[string]interface{} {
var m map[string]interface{}
b, err := json.Marshal(dma)
if err != nil {
@@ -43,8 +43,8 @@ func (dma *Storage) Serialize() map[string]interface{} {
return m
}
func (d *Storage) GetAccessor() utils.Accessor {
func (d *StorageResource) GetAccessor() utils.Accessor {
data := &StorageMongoAccessor{}
data.SetLogger(resources.STORAGE)
data.SetLogger(utils.STORAGE_RESOURCE)
return data
}