id as _id
This commit is contained in:
@@ -27,8 +27,7 @@ const (
|
|||||||
* every data in base root model should inherit from this struct (only exception is the ResourceModel)
|
* every data in base root model should inherit from this struct (only exception is the ResourceModel)
|
||||||
*/
|
*/
|
||||||
type AbstractObject struct {
|
type AbstractObject struct {
|
||||||
ID string `bson:"_id"`
|
UUID string `json:"_id,omitempty" bson:"id,omitempty" validate:"required"`
|
||||||
UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"`
|
|
||||||
Name string `json:"name,omitempty" bson:"name,omitempty" validate:"required"`
|
Name string `json:"name,omitempty" bson:"name,omitempty" validate:"required"`
|
||||||
IsDraft bool `json:"is_draft" bson:"is_draft" default:"false"`
|
IsDraft bool `json:"is_draft" bson:"is_draft" default:"false"`
|
||||||
CreatorID string `json:"creator_id,omitempty" bson:"creator_id,omitempty"`
|
CreatorID string `json:"creator_id,omitempty" bson:"creator_id,omitempty"`
|
||||||
@@ -45,7 +44,6 @@ func (ri *AbstractObject) GetAccessor(request *tools.APIRequest) Accessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *AbstractObject) SetID(id string) {
|
func (r *AbstractObject) SetID(id string) {
|
||||||
r.ID = id
|
|
||||||
r.UUID = id
|
r.UUID = id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user