Skip to content

Commit

Permalink
V1.0.4 (#12)
Browse files Browse the repository at this point in the history
* adicionado retry qdo der erro 429, para ganhar velocidade nos requests get

* new validations

add tag validation and cp url validation

* Team Consulting

add team consulting automatic
  • Loading branch information
zani0x03 authored Jan 29, 2024
1 parent 7ebbe3a commit 0c76043
Show file tree
Hide file tree
Showing 11 changed files with 310 additions and 153 deletions.
2 changes: 1 addition & 1 deletion integration_platform_clickup_go/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"mode": "auto",
"program": "${workspaceFolder}/main.go",
"console": "externalTerminal",
// "args": ["-iv", "journey"]
"args": ["-iv", "journey"]
}

]
Expand Down
91 changes: 66 additions & 25 deletions integration_platform_clickup_go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,31 +96,42 @@ func VerifyTasks(list type_clickup.ListResponse) {
return
}

if task.Parent == "" {
fmt.Println("TASK Without Store", " :: ", list.Name, " :: ", tasks.Tasks[i].Name, " :: ",
strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", tasks.Tasks[i].Url,
" :: ", service_clickup.RetAssigness(tasks.Tasks[i].Assignees))
continue
}
if strings.ToLower(task.Status.Status) != "backlog" && strings.ToLower(task.Status.Status) != "closed" {

if task.Parent == "" {
fmt.Println("TASK Without Store", " :: ", list.Name, " :: ", tasks.Tasks[i].Name, " :: ",
strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", tasks.Tasks[i].Url,
" :: ", service_clickup.RetAssigness(tasks.Tasks[i].Assignees))
continue
}

if strings.ToLower(task.Status.Status) != "backlog" && strings.ToLower(task.Status.Status) != "canceled" && strings.ToLower(task.Status.Status) != "blocked" {
if task.DueDate == "" {
fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ", "DueDate empty", " :: ", task.Url,
fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ",
strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", "DueDate empty", " :: ", task.Url,
" :: ", service_clickup.RetAssigness(task.Assignees))
}

if task.StartDate == "" {
fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ", "StartDate empty", " :: ", task.Url,
fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ",
strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", "StartDate empty", " :: ", task.Url,
" :: ", service_clickup.RetAssigness(task.Assignees))
}

if task.TimeEstimate == 0 {
fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ", "TimeEstimate empty", " :: ", task.Url,
fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ",
strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", "TimeEstimate empty", " :: ", task.Url,
" :: ", service_clickup.RetAssigness(task.Assignees))
}

if task.Status.Status == "done" && task.TimeSpent == 0 {
fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ", "TimeSpent empty", " :: ", task.Url,
fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ",
strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", "TimeSpent empty", " :: ", task.Url,
" :: ", service_clickup.RetAssigness(task.Assignees))
}

if len(task.CustomField.Team) == 0 || !slices.Contains(task.CustomField.Team, variables_constant.CLICKUP_TEAM_ID_CONSULTING) {
fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ",
strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", "Team empty", " :: ", task.Url,
" :: ", service_clickup.RetAssigness(task.Assignees))
}
}
Expand Down Expand Up @@ -153,6 +164,27 @@ func VerifySubtask(list type_clickup.ListResponse, customFieldTypeConsulting int
continue
}

if len(task.CustomField.Team) == 0 || slices.Contains(task.CustomField.Team, variables_constant.CLICKUP_TEAM_ID_CONSULTING) {
fmt.Println("EPIC or Story without TEAM: ", list.Name, " - ", task.Name, " - ",
strings.ToLower(task.Status.Status), " :: ", task.Url,
" :: ", service_clickup.RetAssigness(task.Assignees))
}

if customFieldTypeConsulting == int(enum_clickup_type_consulting.STORE) && variables_global.Customer.CheckTagsValidationStory != "" {
if !service_clickup.CheckTags(task.Tags, variables_global.Customer.CheckTagsValidationStory) {
fmt.Println("Story without TAGS: ", list.Name, " - ", task.Name, " - ",
strings.ToLower(task.Status.Status), " :: ", task.Url,
" :: ", service_clickup.RetAssigness(task.Assignees))

}

if task.CustomField.LinkConvisoPlatform == "" || !strings.Contains(task.CustomField.LinkConvisoPlatform, "/projects/") {
fmt.Println("Story without Conviso Platform URL: ", list.Name, " - ", task.Name, " - ",
strings.ToLower(task.Status.Status), " :: ", task.Url,
" :: ", service_clickup.RetAssigness(task.Assignees))
}
}

for j := 0; j < len(task.SubTasks); j++ {
subTask, err := service_clickup.ReturnTask(task.SubTasks[j].Id)
if err != nil {
Expand All @@ -171,7 +203,6 @@ func VerifySubtask(list type_clickup.ListResponse, customFieldTypeConsulting int
enum_clickup_type_consulting.ToString(customFieldsSubTask),
" :: ", list.Name, " :: ", strings.ToLower(subTask.Status.Status), " :: ", subTask.Url,
" :: ", service_clickup.RetAssigness(subTask.Assignees))
continue
}
}
}
Expand Down Expand Up @@ -300,6 +331,7 @@ func UpdateClickUpConvisoPlatform(justVerify bool) {
for i := 0; i < len(variables_global.Config.Integrations); i++ {

fmt.Println("Found List ", variables_global.Config.Integrations[i].IntegrationName)
fmt.Println("Begin: ", time.Now().Format("2006-01-02 15:04:05"))

list, error := service_clickup.ReturnList(variables_global.Config.Integrations[i].ClickUpListId)

Expand All @@ -319,6 +351,7 @@ func UpdateClickUpConvisoPlatform(justVerify bool) {
UpdateProjectWithStore(list)
//return
}
fmt.Println("Finish: ", time.Now().Format("2006-01-02 15:04:05"))
}

fmt.Println("...Finishing ClickUp Automation...")
Expand Down Expand Up @@ -446,17 +479,6 @@ func CreateProject() {
return
}

// CustomFieldCustomerPosition, err := service_clickup.RetCustomerPosition()
// if err != nil {
// fmt.Println("Error CreateProject: CustomerCustomField error...")
// CustomFieldCustomerPosition = ""
// }

// customFieldCustomer := type_clickup.CustomFieldRequest{
// variables_constant.CLICKUP_CUSTOMER_FIELD_ID,
// CustomFieldCustomerPosition,
// }

customFieldUrlConvisoPlatform := type_clickup.CustomFieldRequest{
variables_constant.CLICKUP_URL_CONVISO_PLATFORM_FIELD_ID,
"https://app.convisoappsec.com/scopes/" + strconv.Itoa(variables_global.Customer.PlatformID) + "/projects/" + project.Id,
Expand All @@ -467,10 +489,15 @@ func CreateProject() {
strconv.Itoa(enum_clickup_type_consulting.STORE),
}

customFieldTeam := type_clickup.CustomFieldRequest{
variables_constant.CLICKUP_TEAM_FIELD_ID,
[1]string{variables_constant.CLICKUP_TEAM_ID_CONSULTING},
}

customFieldsMainTask := []type_clickup.CustomFieldRequest{
customFieldUrlConvisoPlatform,
customFieldTypeConsulting,
//customFieldCustomer,
customFieldTeam,
}

assignessTask := []int64{variables_global.Config.ConfclickUp.User}
Expand Down Expand Up @@ -518,7 +545,7 @@ func CreateProject() {
customFieldsSubTask := []type_clickup.CustomFieldRequest{
customFieldUrlConvisoPlatformSubTask,
customFieldTypeConsultingSubTask,
// customFieldCustomer,
customFieldTeam,
}

sanitizedHTMLTitle := ""
Expand Down Expand Up @@ -572,6 +599,13 @@ func InitialCheck() bool {
return ret
}

func SetDefaultValue() {
if variables_global.Config.ConfclickUp.HttpAttempt == nil {
httpAttempt := 3
variables_global.Config.ConfclickUp.HttpAttempt = &httpAttempt
}
}

func main() {

if !InitialCheck() {
Expand All @@ -581,6 +615,10 @@ func main() {
os.Exit(0)
}

SetDefaultValue()

//service_clickup.RetCustomFieldCustomerPosition()

// fmt.Println(variables_constant.CLICKUP_TOKEN_NAME + " " + os.Getenv(variables_constant.CLICKUP_TOKEN_NAME))
// fmt.Println(variables_constant.CONVISO_PLATFORM_TOKEN_NAME + " " + os.Getenv(variables_constant.CONVISO_PLATFORM_TOKEN_NAME))

Expand All @@ -590,6 +628,9 @@ func main() {
version := flag.Bool("v", false, "Script Version")

if variables_global.Config.ConfigGeneral.IntegrationDefault != -1 {
if len(variables_global.Config.Integrations) <= variables_global.Config.ConfigGeneral.IntegrationDefault {
variables_global.Config.ConfigGeneral.IntegrationDefault = 0
}
variables_global.Customer = variables_global.Config.Integrations[variables_global.Config.ConfigGeneral.IntegrationDefault]
}

Expand Down
82 changes: 76 additions & 6 deletions integration_platform_clickup_go/projects.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,79 @@
configGeneral:
integrationdefault: 0
integrationdefault: 13
configCP:
httpattempt: 3
configclickUp:
user: 0
user: 42939438
httpattempt: 3
integrations:
- integrationname: 0
clickupcustomerlist: 0
clickuplistid: 0
platformid: 0
# - integrationname: Banco Pan
# clickupcustomerlist: Banco Pan
# clickuplistid: 901301469417
# platformid: 181

# - integrationname: Ben Visa Vale
# clickupcustomerlist: Ben Visa Vale
# clickuplistid: 901301469266
# platformid: 622

# - integrationname: Construtora Tenda
# clickupcustomerlist: Construtora Tenda
# clickuplistid: 901301469002
# platformid: 601

# - integrationname: Conviso
# clickupcustomerlist: Conviso
# clickuplistid: 901301469218
# platformid: 11

# - integrationname: Conviso Academy
# clickupcustomerlist: CONVISO Academy
# clickuplistid: 901001661979
# platformid: 0

# - integrationname: Hospital Albert Einstein
# clickupcustomerlist: Hospital Albert Einstein
# clickuplistid: 901301741282
# platformid: 749

# - integrationname: Lojas RENNER
# clickupcustomerlist: Lojas RENNER
# clickuplistid: 901301468979
# platformid: 19

# - integrationname: PDTec
# clickupcustomerlist: PDTec
# clickuplistid: 901301469505
# platformid: 517

# - integrationname: Raia Drogasil
# clickupcustomerlist: Raia Drogasil
# clickuplistid: 901301439158
# platformid: 477

# - integrationname: Stix
# clickupcustomerlist: Stix
# clickuplistid: 901301468963
# platformid: 499

# - integrationname: Universidade Cruzeiro do Sul
# clickupcustomerlist: Universidade Cruzeiro do Sul
# clickuplistid: 901301468946
# platformid: 544

# - integrationname: Vivo 4a Plataforma
# clickupcustomerlist: VIVO
# clickuplistid: 901301468955
# platformid: 439
# checkTagsValidationStory: "projetos de melhoria contínua;projetos de atividades recorrentes"

# - integrationname: Vivo Digital
# clickupcustomerlist: VIVO
# clickuplistid: 901301468955
# platformid: 430
# checkTagsValidationStory: "projetos de melhoria contínua;projetos de atividades recorrentes;Projetos do Gap Analysis"

- integrationname: XP
clickupcustomerlist: XP Investimentos
clickuplistid: 901301468987
platformid: 506
Binary file not shown.
Loading

0 comments on commit 0c76043

Please sign in to comment.