adding inputs output struct based on argo naming for now
This commit is contained in:
		@@ -27,14 +27,16 @@ 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 {
 | 
				
			||||||
	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" bson:"creator_id" default:"unknown"`
 | 
						CreatorID     string     `json:"creator_id" bson:"creator_id" default:"unknown"`
 | 
				
			||||||
	CreationDate time.Time  `json:"creation_date" bson:"creation_date"`
 | 
						UserCreatorID string     `json:"user_creator_id,omitempty" bson:"user_creator_id,omitempty"`
 | 
				
			||||||
	UpdateDate   time.Time  `json:"update_date" bson:"update_date"`
 | 
						CreationDate  time.Time  `json:"creation_date" bson:"creation_date"`
 | 
				
			||||||
	UpdaterID    string     `json:"updater_id" bson:"updater_id"`
 | 
						UpdateDate    time.Time  `json:"update_date" bson:"update_date"`
 | 
				
			||||||
	AccessMode   AccessMode `json:"access_mode" bson:"access_mode" default:"0"`
 | 
						UpdaterID     string     `json:"updater_id" bson:"updater_id"`
 | 
				
			||||||
 | 
						UserUpdaterID string     `json:"user_updater_id,omitempty" bson:"user_updater_id,omitempty"`
 | 
				
			||||||
 | 
						AccessMode    AccessMode `json:"access_mode" bson:"access_mode" default:"0"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (ri *AbstractObject) GetAccessor(request *tools.APIRequest) Accessor {
 | 
					func (ri *AbstractObject) GetAccessor(request *tools.APIRequest) Accessor {
 | 
				
			||||||
@@ -77,12 +79,14 @@ func (ao *AbstractObject) GetCreatorID() string {
 | 
				
			|||||||
	return ao.CreatorID
 | 
						return ao.CreatorID
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (ao *AbstractObject) UpToDate(user string, create bool) {
 | 
					func (ao *AbstractObject) UpToDate(user string, peer string, create bool) {
 | 
				
			||||||
	ao.UpdateDate = time.Now()
 | 
						ao.UpdateDate = time.Now()
 | 
				
			||||||
	ao.UpdaterID = user
 | 
						ao.UpdaterID = peer
 | 
				
			||||||
 | 
						ao.UserUpdaterID = user
 | 
				
			||||||
	if create {
 | 
						if create {
 | 
				
			||||||
		ao.CreationDate = time.Now()
 | 
							ao.CreationDate = time.Now()
 | 
				
			||||||
		ao.CreatorID = user
 | 
							ao.CreatorID = peer
 | 
				
			||||||
 | 
							ao.UserCreatorID = user
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ type Owner struct {
 | 
				
			|||||||
func GenericStoreOne(data DBObject, a Accessor) (DBObject, int, error) {
 | 
					func GenericStoreOne(data DBObject, a Accessor) (DBObject, int, error) {
 | 
				
			||||||
	data.GenerateID()
 | 
						data.GenerateID()
 | 
				
			||||||
	data.StoreDraftDefault()
 | 
						data.StoreDraftDefault()
 | 
				
			||||||
	data.UpToDate(a.GetPeerID(), true)
 | 
						data.UpToDate(a.GetUser(), a.GetPeerID(), true)
 | 
				
			||||||
	f := dbs.Filters{
 | 
						f := dbs.Filters{
 | 
				
			||||||
		Or: map[string][]dbs.Filter{
 | 
							Or: map[string][]dbs.Filter{
 | 
				
			||||||
			"abstractresource.abstractobject.name": {{
 | 
								"abstractresource.abstractobject.name": {{
 | 
				
			||||||
@@ -81,7 +81,7 @@ func GenericUpdateOne(set DBObject, id string, a Accessor, new DBObject) (DBObje
 | 
				
			|||||||
		return nil, 403, errors.New("you are not allowed to delete this collaborative area")
 | 
							return nil, 403, errors.New("you are not allowed to delete this collaborative area")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	set = newSet
 | 
						set = newSet
 | 
				
			||||||
	r.UpToDate(a.GetPeerID(), false)
 | 
						r.UpToDate(a.GetUser(), a.GetPeerID(), false)
 | 
				
			||||||
	if a.ShouldVerifyAuth() && !r.VerifyAuth(a.GetRequest()) {
 | 
						if a.ShouldVerifyAuth() && !r.VerifyAuth(a.GetRequest()) {
 | 
				
			||||||
		return nil, 403, errors.New("you are not allowed to access this collaborative area")
 | 
							return nil, 403, errors.New("you are not allowed to access this collaborative area")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ type DBObject interface {
 | 
				
			|||||||
	CanDelete() bool
 | 
						CanDelete() bool
 | 
				
			||||||
	StoreDraftDefault()
 | 
						StoreDraftDefault()
 | 
				
			||||||
	GetCreatorID() string
 | 
						GetCreatorID() string
 | 
				
			||||||
	UpToDate(user string, create bool)
 | 
						UpToDate(user string, peer string, create bool)
 | 
				
			||||||
	CanUpdate(set DBObject) (bool, DBObject)
 | 
						CanUpdate(set DBObject) (bool, DBObject)
 | 
				
			||||||
	VerifyAuth(request *tools.APIRequest) bool
 | 
						VerifyAuth(request *tools.APIRequest) bool
 | 
				
			||||||
	Serialize(obj DBObject) map[string]interface{}
 | 
						Serialize(obj DBObject) map[string]interface{}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user