adding inputs output struct based on argo naming for now^C
This commit is contained in:
		| @@ -101,15 +101,26 @@ func filterEnrich[T utils.ShallowDBObject](arr []string, isDrafted bool, a utils | ||||
| } | ||||
|  | ||||
| // enrich is a function that enriches the CollaborativeArea with the shared objects | ||||
| func (a *collaborativeAreaMongoAccessor) enrich(sharedWorkspace *CollaborativeArea, isDrafted bool) *CollaborativeArea { | ||||
| func (a *collaborativeAreaMongoAccessor) enrich(sharedWorkspace *CollaborativeArea, isDrafted bool, request *tools.APIRequest) *CollaborativeArea { | ||||
| 	sharedWorkspace.SharedWorkspaces = append(sharedWorkspace.SharedWorkspaces, | ||||
| 		filterEnrich[*workspace.Workspace](sharedWorkspace.Workspaces, isDrafted, a.workspaceAccessor)...) | ||||
| 	sharedWorkspace.SharedWorkflows = append(sharedWorkspace.SharedWorkflows, | ||||
| 		filterEnrich[*workflow.Workflow](sharedWorkspace.Workflows, isDrafted, a.workflowAccessor)...) | ||||
| 	peerskey := []string{} | ||||
| 	for k := range sharedWorkspace.AllowedPeersGroup { | ||||
| 	for k, v := range sharedWorkspace.AllowedPeersGroup { | ||||
| 		canFound := false | ||||
| 		for _, t := range request.Groups { | ||||
| 			if slices.Contains(v, t) { | ||||
| 				canFound = true | ||||
| 				break | ||||
| 			} | ||||
|  | ||||
| 		} | ||||
| 		if slices.Contains(v, "*") || canFound { | ||||
| 			peerskey = append(peerskey, k) | ||||
| 		} | ||||
| 	} | ||||
| 	fmt.Println(peerskey) | ||||
| 	sharedWorkspace.SharedPeers = append(sharedWorkspace.SharedPeers, | ||||
| 		filterEnrich[*peer.Peer](peerskey, isDrafted, a.peerAccessor)...) | ||||
| 	sharedWorkspace.SharedRules = append(sharedWorkspace.SharedRules, | ||||
| @@ -119,20 +130,20 @@ func (a *collaborativeAreaMongoAccessor) enrich(sharedWorkspace *CollaborativeAr | ||||
|  | ||||
| func (a *collaborativeAreaMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) { | ||||
| 	return utils.GenericLoadOne[*CollaborativeArea](id, func(d utils.DBObject) (utils.DBObject, int, error) { | ||||
| 		return a.enrich(d.(*CollaborativeArea), false), 200, nil | ||||
| 		return a.enrich(d.(*CollaborativeArea), false, a.Request), 200, nil | ||||
| 	}, a) | ||||
| } | ||||
|  | ||||
| func (a *collaborativeAreaMongoAccessor) LoadAll(isDrafted bool) ([]utils.ShallowDBObject, int, error) { | ||||
| 	return utils.GenericLoadAll[*CollaborativeArea](func(d utils.DBObject) utils.ShallowDBObject { | ||||
| 		return a.enrich(d.(*CollaborativeArea), isDrafted) | ||||
| 		return a.enrich(d.(*CollaborativeArea), isDrafted, a.Request) | ||||
| 	}, isDrafted, a) | ||||
| } | ||||
|  | ||||
| func (a *collaborativeAreaMongoAccessor) Search(filters *dbs.Filters, search string, isDrafted bool) ([]utils.ShallowDBObject, int, error) { | ||||
| 	return utils.GenericSearch[*CollaborativeArea](filters, search, (&CollaborativeArea{}).GetObjectFilters(search), | ||||
| 		func(d utils.DBObject) utils.ShallowDBObject { | ||||
| 			return a.enrich(d.(*CollaborativeArea), isDrafted) | ||||
| 			return a.enrich(d.(*CollaborativeArea), isDrafted, a.Request) | ||||
| 		}, isDrafted, a) | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user