Fixed usecase linking and added basic priorities to start making a priority system

This commit is contained in:
frikky
2022-05-21 14:31:43 +02:00
parent 2167be32f5
commit 7e42553fee
10 changed files with 413 additions and 86 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ module main
go 1.16
//replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
//replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch
+15
View File
@@ -1038,6 +1038,18 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
chatDisabled = true
}
orgPriorities := org.Priorities
if len(org.Priorities) < 5 {
log.Printf("[WARNING] Should find and add priorities as length is less than 5 for org %s", userInfo.ActiveOrg.Id)
newPriorities, err := shuffle.GetPriorities(ctx, org)
if err != nil {
log.Printf("[WARNING] Failed getting new priorities for org %s: %s", org.Id, err)
//orgPriorities = []shuffle.Priority{}
} else {
orgPriorities = newPriorities
}
}
tutorialsFinished := []string{}
returnValue := shuffle.HandleInfo{
Success: true,
@@ -1056,6 +1068,7 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
EthInfo: userInfo.EthInfo,
Tutorials: tutorialsFinished,
ChatDisabled: chatDisabled,
Priorities: orgPriorities,
}
returnData, err := json.Marshal(returnValue)
@@ -5966,7 +5979,9 @@ func initHandlers() {
r.HandleFunc("/api/v1/workflows/collections/{key}", shuffle.HandleGetCollection).Methods("GET", "OPTIONS")
// Related to use-cases that are not directly workflows.
r.HandleFunc("/api/v1/workflows/usecases/{key}", shuffle.HandleGetUsecase).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/workflows/usecases", shuffle.LoadUsecases).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/workflows/usecases", shuffle.UpdateUsecases).Methods("POST", "OPTIONS")
// Legacy app things
r.HandleFunc("/api/v1/workflows/apps/validate", validateAppInput).Methods("POST", "OPTIONS")
+2 -1
View File
@@ -2051,8 +2051,9 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string,
workflowapps, err := shuffle.GetAllWorkflowApps(ctx, 1000, 0)
appCounter := 0
if err != nil {
log.Printf("Failed to get existing generated apps")
log.Printf("[WARNING] Failed to get existing generated apps for OpenAPI verification: %s", err)
}
for _, file := range dir {
if len(onlyname) > 0 && file.Name() != onlyname {
continue