34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package resources
|
|
|
|
import (
|
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
|
)
|
|
|
|
// AbstractResource is the struct containing all of the attributes commons to all ressources
|
|
|
|
// Resource is the interface to be implemented by all classes inheriting from Resource to have the same behavior
|
|
|
|
//http://www.inanzzz.com/index.php/post/wqbs/a-basic-usage-of-int-and-string-enum-types-in-golang
|
|
|
|
type Resource interface {
|
|
GetType() utils.DataType
|
|
}
|
|
|
|
type AbstractResource struct {
|
|
utils.AbstractObject
|
|
ShortDescription string `json:"short_description" bson:"short_description" validate:"required"`
|
|
Description string `json:"description,omitempty" bson:"description"`
|
|
Logo string `json:"logo" bson:"logo" validate:"required"`
|
|
Owner string `json:"owner" bson:"owner" validate:"required"`
|
|
OwnerLogo string `json:"owner_logo" bson:"owner_logo"`
|
|
SourceUrl string `json:"source_url" bson:"source_url" validate:"required"`
|
|
}
|
|
|
|
func (r *AbstractResource) GetID() string {
|
|
return r.UUID
|
|
}
|
|
|
|
func (r *AbstractResource) GetName() string {
|
|
return r.Name
|
|
}
|