Skip to content

Commit

Permalink
V1.0.3 (#11)
Browse files Browse the repository at this point in the history
* v1.0.3

* add release
  • Loading branch information
zani0x03 authored Jan 10, 2024
1 parent 4781b14 commit 7ebbe3a
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 13 deletions.
Binary file not shown.
Binary file removed integration_platform_clickup_go/__debug_bin882619035
Binary file not shown.
39 changes: 36 additions & 3 deletions integration_platform_clickup_go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ____ _ _ __ ____ _ _ _ _ _
`

func LoadProjects() {
config := functions.LoadConfigsByYamlFile()
config := variables_global.Config

fmt.Println("------Projets------")
// Print the data
Expand Down Expand Up @@ -547,15 +547,48 @@ func CreateProject() {
fmt.Println("Create Task Success!")
}

func InitialCheck() bool {
ret := true

err := error(nil)

variables_global.Config, err = functions.LoadConfigsByYamlFile()

if err != nil {
fmt.Println("YAML File Problem", variables_constant.CLICKUP_TOKEN_NAME, " is empty!")
ret = false
}

if os.Getenv(variables_constant.CLICKUP_TOKEN_NAME) == "" {
fmt.Println("Variable ", variables_constant.CLICKUP_TOKEN_NAME, " is empty!")
ret = false
}

if os.Getenv(variables_constant.CONVISO_PLATFORM_TOKEN_NAME) == "" {
fmt.Println("Variable ", variables_constant.CONVISO_PLATFORM_TOKEN_NAME, " is empty!")
ret = false
}

return ret
}

func main() {

if !InitialCheck() {
fmt.Println("You need to correct the above information before rerunning the application")
fmt.Println("Press the Enter Key to finish!")
fmt.Scanln()
os.Exit(0)
}

// 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))

integrationJustVerify := flag.Bool("iv", false, "Verify if clickup tasks is ok")
integrationUpdateTasks := flag.Bool("iu", false, "Update Conviso Platform and ClickUp Tasks")
deploy := flag.Bool("d", false, "See info about deploys")
version := flag.Bool("v", false, "Script Version")

variables_global.Config = functions.LoadConfigsByYamlFile()

if variables_global.Config.ConfigGeneral.IntegrationDefault != -1 {
variables_global.Customer = variables_global.Config.Integrations[variables_global.Config.ConfigGeneral.IntegrationDefault]
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,13 @@ func SearchRequimentsPlatform(reqSearch string) {
client := &http.Client{Timeout: time.Second * 10}
resp, err := client.Do(req)
defer req.Body.Close()

if err != nil {
fmt.Println("Error SearchRequimentsPlatform ClientDo: ", err.Error())
return
}
data, _ := ioutil.ReadAll(resp.Body)

data, _ := io.ReadAll(resp.Body)

json.Unmarshal([]byte(string(data)), &result)

Expand Down
19 changes: 11 additions & 8 deletions integration_platform_clickup_go/utils/functions/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package functions

import (
"bufio"
"errors"
"fmt"
"integration_platform_clickup_go/types/type_config"
"integration_platform_clickup_go/utils/variables_global"
Expand All @@ -13,7 +14,7 @@ import (
"gopkg.in/yaml.v2"
)

func LoadConfigsByYamlFile() type_config.ConfigType {
func LoadConfigsByYamlFile() (type_config.ConfigType, error) {

// Create a struct to hold the YAML data
var config type_config.ConfigType
Expand All @@ -22,18 +23,16 @@ func LoadConfigsByYamlFile() type_config.ConfigType {
data, err := os.ReadFile("projects.yaml")

if err != nil {
fmt.Println("Error ReadFile LoadConfigsByYamlFile: ", err.Error())
return config
return config, errors.New("Error ReadFile " + err.Error())
}

// Unmarshal the YAML data into the struct
err = yaml.Unmarshal(data, &config)
if err != nil {
fmt.Println("Error DataToStruct LoadConfigsByYamlFile: ", err.Error())
return config
return config, errors.New("Error DataToStruct " + err.Error())
}

return config
return config, nil
}

func CustomerExistsYamlFileByClickUpListId(clickUpListId string, customers []type_config.ConfigTypeIntegration) (result bool) {
Expand Down Expand Up @@ -76,6 +75,7 @@ func ConvertStringToArrayInt(var1 string) []int {
// }

func GetTextWithSpace(label string) string {
ret := ""

EOL := byte('\r')

Expand All @@ -90,8 +90,11 @@ func GetTextWithSpace(label string) string {

if error != nil {
fmt.Print("Error function GetTextWithSpace ", error)
return ""
return ret
}

return strings.TrimSuffix(ret, string(EOL))
ret = strings.Replace(ret, "\r", "", -1)
ret = strings.Replace(ret, "\n", "", -1)

return ret
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package variables_constant

const VERSION = "1.0.2"
const VERSION = "1.0.3"

// const CLICKUP_CUSTOMER_FIELD_ID = "4493a404-3ef7-4d7a-91e4-830ebc666353"

Expand Down

0 comments on commit 7ebbe3a

Please sign in to comment.