2024-07-18 11:51:12 +02:00
|
|
|
package resources
|
|
|
|
|
2024-07-19 10:54:58 +02:00
|
|
|
import (
|
|
|
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
|
|
|
)
|
|
|
|
|
2024-07-18 11:51:12 +02:00
|
|
|
// 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 {
|
2024-07-19 10:54:58 +02:00
|
|
|
GetType() utils.DataType
|
2024-07-18 11:51:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type AbstractResource struct {
|
2024-07-19 10:54:58 +02:00
|
|
|
utils.AbstractObject
|
2024-07-22 09:03:57 +02:00
|
|
|
ShortDescription string `json:"short_description" bson:"short_description" validate:"required"`
|
2024-07-18 11:51:12 +02:00
|
|
|
Description string `json:"description,omitempty" bson:"description"`
|
2024-07-22 09:03:57 +02:00
|
|
|
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"`
|
2024-07-18 11:51:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AbstractResource) GetID() string {
|
2024-07-19 10:54:58 +02:00
|
|
|
return r.UUID
|
2024-07-18 11:51:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AbstractResource) GetName() string {
|
|
|
|
return r.Name
|
|
|
|
}
|