diff --git a/integration_platform_clickup_go/.vscode/launch.json b/integration_platform_clickup_go/.vscode/launch.json index 578f9a3..d5211fe 100755 --- a/integration_platform_clickup_go/.vscode/launch.json +++ b/integration_platform_clickup_go/.vscode/launch.json @@ -11,7 +11,7 @@ "mode": "auto", "program": "${workspaceFolder}/main.go", "console": "externalTerminal", - // "args": ["-ii", "journey"] + "args": ["-tv", "journey"] } ] diff --git a/integration_platform_clickup_go/db/db.db b/integration_platform_clickup_go/db/db.db new file mode 100644 index 0000000..d634efc Binary files /dev/null and b/integration_platform_clickup_go/db/db.db differ diff --git a/integration_platform_clickup_go/gerarCompilado.sh b/integration_platform_clickup_go/gerarCompilado.sh index 383bd56..7a0e044 100755 --- a/integration_platform_clickup_go/gerarCompilado.sh +++ b/integration_platform_clickup_go/gerarCompilado.sh @@ -1,10 +1,14 @@ #!/bin/bash -version="v01.00.06" +version="v02.00.00" mainFileName="IntegrationPlatformClickup" fileNameCompact="" auxFileName="" +echo "Limpando database" +echo "delete from assets;" | sqlite3 db/db.db + + echo "Gerando Windows - AMD64" auxFileName=$mainFileName".exe" rm -rf $auxFileName diff --git a/integration_platform_clickup_go/go.mod b/integration_platform_clickup_go/go.mod index ee90d9e..9b507c7 100755 --- a/integration_platform_clickup_go/go.mod +++ b/integration_platform_clickup_go/go.mod @@ -2,16 +2,33 @@ module integration_platform_clickup_go go 1.21.1 +require ( + github.com/gocolly/colly v1.2.0 + github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 + golang.org/x/exp v0.0.0-20230420155640-133eef4313cb + gopkg.in/yaml.v2 v2.4.0 +) require ( github.com/PuerkitoBio/goquery v1.8.1 // indirect github.com/andybalholm/cascadia v1.3.1 // indirect - github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 // indirect + github.com/antchfx/htmlquery v1.2.3 // indirect + github.com/antchfx/xmlquery v1.2.4 // indirect + github.com/antchfx/xpath v1.1.8 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + github.com/golang/protobuf v1.4.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kennygrant/sanitize v1.2.4 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-sqlite3 v1.14.22 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect - golang.org/x/exp v0.0.0-20230420155640-133eef4313cb // indirect + github.com/temoto/robotstxt v1.1.1 // indirect golang.org/x/net v0.9.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/appengine v1.6.6 // indirect + google.golang.org/protobuf v1.24.0 // indirect ) diff --git a/integration_platform_clickup_go/go.sum b/integration_platform_clickup_go/go.sum index dd576bd..7772482 100755 --- a/integration_platform_clickup_go/go.sum +++ b/integration_platform_clickup_go/go.sum @@ -1,79 +1,152 @@ -github.com/JohannesKaufmann/html-to-markdown v1.4.0 h1:uaIPDub6VrBsQP0r5xKjpPo9lxMcuQF1L1pT6BiBdmw= -github.com/JohannesKaufmann/html-to-markdown v1.4.0/go.mod h1:3p+lDUqSw+cxolZl7OINYzJ70JHXogXjyCl9UnMQ5gU= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM= github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ= github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= +github.com/antchfx/htmlquery v1.2.3 h1:sP3NFDneHx2stfNXCKbhHFo8XgNjCACnU/4AO5gWz6M= +github.com/antchfx/htmlquery v1.2.3/go.mod h1:B0ABL+F5irhhMWg54ymEZinzMSi0Kt3I2if0BLYa3V0= +github.com/antchfx/xmlquery v1.2.4 h1:T/SH1bYdzdjTMoz2RgsfVKbM5uWh3gjDYYepFqQmFv4= +github.com/antchfx/xmlquery v1.2.4/go.mod h1:KQQuESaxSlqugE2ZBcM/qn+ebIpt+d+4Xx7YcSGAIrM= +github.com/antchfx/xpath v1.1.6/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= +github.com/antchfx/xpath v1.1.8 h1:PcL6bIX42Px5usSx6xRYw/wjB3wYGkj0MJ9MBzEKVgk= +github.com/antchfx/xpath v1.1.8/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/gocolly/colly v1.2.0 h1:qRz9YAn8FIH0qzgNUw+HT9UN7wm1oF9OBAilwEWpyrI= +github.com/gocolly/colly v1.2.0/go.mod h1:Hof5T3ZswNVsOHYmba1u03W65HDWgpV5HifSuueE0EA= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 h1:iCHtR9CQyktQ5+f3dMVZfwD2KWJUgm7M0gdL9NGr8KA= github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o= +github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sebdah/goldie/v2 v2.5.3/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca h1:NugYot0LIVPxTvN8n+Kvkn6TrbMyxQiuvKdEwFdR9vI= +github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca/go.mod h1:uugorj2VCxiV1x+LzaIdVa9b4S4qGAcH6cbhh4qVxOU= github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo= github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf/go.mod h1:RJID2RhlZKId02nZ62WenDCkgHFerpIOmW0iT7GKmXM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/sym01/htmlsanitizer v1.0.1 h1:a+r9gDExjeJsvENRTW/cxyGuloCJF0s1dcwr83MctGY= -github.com/sym01/htmlsanitizer v1.0.1/go.mod h1:zazTkJ727MJTDrNcWDaOLlAgGMcsDNG94LJi6vYl6Ug= +github.com/temoto/robotstxt v1.1.1 h1:Gh8RCs8ouX3hRSxxK7B1mO5RFByQ4CmJZDwgom++JaA= +github.com/temoto/robotstxt v1.1.1/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.5.4/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20230420155640-133eef4313cb h1:rhjz/8Mbfa8xROFiH+MQphmAmgqRM0bOMnytznhWEXk= golang.org/x/exp v0.0.0-20230420155640-133eef4313cb/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0 h1:UhZDfRO8JRQru4/+LlLE0BRKGF8L+PICnvYZmx/fEGA= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/integration_platform_clickup_go/main.go b/integration_platform_clickup_go/main.go index 4863ea8..3c01011 100755 --- a/integration_platform_clickup_go/main.go +++ b/integration_platform_clickup_go/main.go @@ -6,7 +6,9 @@ import ( "fmt" "integration_platform_clickup_go/services/service_clickup" "integration_platform_clickup_go/services/service_conviso_platform" + "integration_platform_clickup_go/services/service_crawler" "integration_platform_clickup_go/types/type_clickup" + "integration_platform_clickup_go/types/type_config" "integration_platform_clickup_go/types/type_enum/enum_clickup_ps_team" "integration_platform_clickup_go/types/type_enum/enum_clickup_statuses" "integration_platform_clickup_go/types/type_enum/enum_clickup_type_ps_hierarchy" @@ -88,7 +90,16 @@ func VerifyTasks(list type_clickup.ListResponse) { for { - tasks, err := service_clickup.ReturnTasks(list.Id, int(enum_clickup_type_ps_hierarchy.TASK), page) + tasks, err := service_clickup.ReturnTasks(list.Id, + type_clickup.SearchTask{ + TaskType: int(enum_clickup_type_ps_hierarchy.TASK), + Page: page, + DateUpdatedGt: time.Now().Add(-time.Hour * 240).UTC().UnixMilli(), + IncludeClosed: false, + SubTasks: true, + TaskStatuses: "", + }, + ) if err != nil { fmt.Println("Error VerifyTasks :: ", err.Error()) @@ -103,50 +114,52 @@ func VerifyTasks(list type_clickup.ListResponse) { return } - if strings.ToLower(task.Status.Status) != "backlog" && strings.ToLower(task.Status.Status) != "closed" { + if strings.ToLower(task.Status.Status) != "backlog" && + strings.ToLower(task.Status.Status) != "closed" && + !service_clickup.CheckSpecificTag(task.Tags, "não executada") { 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)) + fmt.Println("TASK Without Store", " :: ", variables_global.Customer.IntegrationName, " :: ", task.Name, " :: ", + strings.ToLower(task.Status.Status), " :: ", task.Url, + " :: ", service_clickup.RetAssigness(task.Assignees)) continue } if task.DueDate == "" { - fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ", - strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", "DueDate empty", " :: ", task.Url, + fmt.Println("Task with errors: ", variables_global.Customer.IntegrationName, " - ", task.Name, " - ", task.Name, " :: ", + strings.ToLower(task.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, " :: ", - strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", "StartDate empty", " :: ", task.Url, + fmt.Println("Task with errors: ", variables_global.Customer.IntegrationName, " - ", task.Name, " - ", task.Name, " :: ", + strings.ToLower(task.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, " :: ", - strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", "TimeEstimate empty", " :: ", task.Url, + fmt.Println("Task with errors: ", variables_global.Customer.IntegrationName, " - ", task.Name, " - ", task.Name, " :: ", + strings.ToLower(task.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, " :: ", - strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", "TimeSpent empty", " :: ", task.Url, + fmt.Println("Task with errors: ", variables_global.Customer.IntegrationName, " - ", task.Name, " - ", task.Name, " :: ", + strings.ToLower(task.Status.Status), " :: ", "TimeSpent empty", " :: ", task.Url, " :: ", service_clickup.RetAssigness(task.Assignees)) } - // if len(task.CustomField.Team) == 0 { - // 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)) - // } - - // if len(task.CustomField.Customer) == 0 { - // fmt.Println("Task with errors: ", task.List.Name, " - ", task.Name, " - ", task.Name, " :: ", - // strings.ToLower(tasks.Tasks[i].Status.Status), " :: ", "Customer empty", " :: ", task.Url, - // " :: ", service_clickup.RetAssigness(task.Assignees)) - // } + if len(task.CustomField.PSTeam) == 0 { + fmt.Println("Task with errors: ", variables_global.Customer.IntegrationName, " - ", task.Name, " - ", task.Name, " :: ", + strings.ToLower(task.Status.Status), " :: ", "PS-Team empty", " :: ", task.Url, + " :: ", service_clickup.RetAssigness(task.Assignees)) + } + + if variables_global.Customer.ValidatePSCustomer && len(task.CustomField.PSCustomer) == 0 { + fmt.Println("Task with errors: ", variables_global.Customer.IntegrationName, " - ", task.Name, " - ", task.Name, " :: ", + strings.ToLower(task.Status.Status), " :: ", "PS-Customer empty", " :: ", task.Url, + " :: ", service_clickup.RetAssigness(task.Assignees)) + } } } @@ -164,7 +177,16 @@ func VerifySubtask(list type_clickup.ListResponse, customFieldTypeConsulting int for { - tasks, err := service_clickup.ReturnTasks(list.Id, customFieldTypeConsulting, page) + tasks, err := service_clickup.ReturnTasks(list.Id, + type_clickup.SearchTask{ + TaskType: customFieldTypeConsulting, + Page: page, + DateUpdatedGt: time.Now().Add(-time.Hour * 240).UTC().UnixMilli(), + IncludeClosed: false, + SubTasks: true, + TaskStatuses: "", + }, + ) if err != nil { fmt.Println("Error VerifySubtask :: ", err.Error()) @@ -179,6 +201,14 @@ func VerifySubtask(list type_clickup.ListResponse, customFieldTypeConsulting int return } + if strings.EqualFold(task.Parent, "") && customFieldTypeConsulting != int(enum_clickup_type_ps_hierarchy.EPIC) { + fmt.Println("Store Without EPIC", + " :: ", variables_global.Customer.IntegrationName, " :: ", task.Name, + " :: ", strings.ToLower(task.Status.Status), " :: ", task.Url, + " :: ", service_clickup.RetAssigness(task.Assignees)) + continue + } + if len(task.SubTasks) == 0 { fmt.Println(enum_clickup_type_ps_hierarchy.ToString(customFieldTypeConsulting), " Without ", @@ -189,27 +219,27 @@ func VerifySubtask(list type_clickup.ListResponse, customFieldTypeConsulting int continue } - // if len(task.CustomField.Team) == 0 { - // fmt.Println("EPIC or Story without TEAM: ", list.Name, " :: ", task.Name, " :: ", - // strings.ToLower(task.Status.Status), " :: ", task.Url, - // " :: ", service_clickup.RetAssigness(task.Assignees)) - // } + if len(task.CustomField.PSTeam) == 0 { + fmt.Println("EPIC or Story without PS-TEAM: ", variables_global.Customer.IntegrationName, " :: ", task.Name, " :: ", + strings.ToLower(task.Status.Status), " :: ", task.Url, + " :: ", service_clickup.RetAssigness(task.Assignees)) + } - // if len(task.CustomField.Customer) == 0 { - // fmt.Println("EPIC or Story without Customer: ", list.Name, " :: ", task.Name, " :: ", - // strings.ToLower(task.Status.Status), " :: ", task.Url, - // " :: ", service_clickup.RetAssigness(task.Assignees)) - // } + if variables_global.Customer.ValidatePSCustomer && len(task.CustomField.PSCustomer) == 0 { + fmt.Println("EPIC or Story without PS-Customer: ", variables_global.Customer.IntegrationName, " :: ", task.Name, " :: ", + strings.ToLower(task.Status.Status), " :: ", task.Url, + " :: ", service_clickup.RetAssigness(task.Assignees)) + } - if customFieldTypeConsulting == int(enum_clickup_type_ps_hierarchy.STORE) && variables_global.Customer.CheckTagsValidationStory != "" { - if !service_clickup.CheckTags(task.Tags, variables_global.Customer.CheckTagsValidationStory) { + if customFieldTypeConsulting == int(enum_clickup_type_ps_hierarchy.STORE) && variables_global.Customer.ValidateTag { + if !service_clickup.CheckTags(task.Tags) { fmt.Println("Story without TAGS", " :: ", variables_global.Customer.IntegrationName, " :: ", task.Name, " :: ", strings.ToLower(task.Status.Status), " :: ", task.Url, " :: ", service_clickup.RetAssigness(task.Assignees)) } - if task.CustomField.PSConvisoPlatformLink == "" || !strings.Contains(task.CustomField.PSConvisoPlatformLink, "/projects/") { + if variables_global.Customer.ValidatePSConvisoPlatformLink && (task.CustomField.PSConvisoPlatformLink == "" || !strings.Contains(task.CustomField.PSConvisoPlatformLink, "/projects/")) { fmt.Println("Story without Conviso Platform URL: ", " :: ", variables_global.Customer.IntegrationName, " :: ", task.Name, " :: ", strings.ToLower(task.Status.Status), " :: ", task.Url, @@ -254,7 +284,16 @@ func ListStoryInProgress(list type_clickup.ListResponse) { page := 0 for { - tasks, err := service_clickup.ReturnTasksByStatus(list.Id, enum_clickup_type_ps_hierarchy.STORE, enum_clickup_statuses.IN_PROGRESS, page) + tasks, err := service_clickup.ReturnTasks(list.Id, + type_clickup.SearchTask{ + TaskType: enum_clickup_type_ps_hierarchy.STORE, + Page: page, + DateUpdatedGt: 0, + IncludeClosed: false, + SubTasks: true, + TaskStatuses: enum_clickup_statuses.IN_PROGRESS, + }, + ) if err != nil { fmt.Println("Error ListStoryInProgress :: ", err.Error()) @@ -262,7 +301,110 @@ func ListStoryInProgress(list type_clickup.ListResponse) { } for i := 0; i < len(tasks.Tasks); i++ { + + var dtStart time.Time + var dtDuoDate time.Time + + dtIntAux, err := strconv.ParseInt(tasks.Tasks[i].StartDate, 10, 64) + if err == nil { + dtStart = time.UnixMilli(dtIntAux) + } + + dtIntAux, err = strconv.ParseInt(tasks.Tasks[i].DueDate, 10, 64) + if err == nil { + dtDuoDate = time.UnixMilli(dtIntAux) + } + fmt.Println("Story In Progress", + ";", variables_global.Customer.IntegrationName, + ";", tasks.Tasks[i].Name, + ";", tasks.Tasks[i].Url, + ";", dtStart.Format("02/01/2006"), + ";", dtDuoDate.Format("02/01/2006"), + ";", service_clickup.RetAssigness(tasks.Tasks[i].Assignees)) + } + + if tasks.LastPage { + break + } + + page++ + } +} + +func ListTasksInClosed(list type_clickup.ListResponse) { + ListTasksInClosedByPSHierarchy(list, enum_clickup_type_ps_hierarchy.EPIC) + ListTasksInClosedByPSHierarchy(list, enum_clickup_type_ps_hierarchy.STORE) + ListTasksInClosedByPSHierarchy(list, enum_clickup_type_ps_hierarchy.TASK) +} + +func UpdateTasksInDoneToClosed(list type_clickup.ListResponse) { + UpdateTasksInDoneToClosedPSHierarchy(list, enum_clickup_type_ps_hierarchy.TASK) + UpdateTasksInDoneToClosedPSHierarchy(list, enum_clickup_type_ps_hierarchy.STORE) + UpdateTasksInDoneToClosedPSHierarchy(list, enum_clickup_type_ps_hierarchy.EPIC) +} + +func UpdateTasksInDoneToClosedPSHierarchy(list type_clickup.ListResponse, psHierarchy int) { + page := 0 + + for { + tasks, err := service_clickup.ReturnTasks(list.Id, + type_clickup.SearchTask{ + TaskType: psHierarchy, + Page: page, + DateUpdatedGt: 0, + IncludeClosed: false, + SubTasks: true, + TaskStatuses: "done", + }, + ) + + if err != nil { + fmt.Println("Error UpdateTasksInDoneToClosedPSHierarchy :: ", err.Error()) + return + } + + for i := 0; i < len(tasks.Tasks); i++ { + err = service_clickup.RequestPutTaskStatus(tasks.Tasks[i].Id, type_clickup.TaskRequestStatus{ + Status: "closed", + }) + + if err != nil { + fmt.Println("Error UpdateTasksInDoneToClosedPSHierarchy :: ", tasks.Tasks[i].Url, " :: ", err.Error()) + return + } + } + + if tasks.LastPage { + break + } + + page++ + } +} + +func ListTasksInClosedByPSHierarchy(list type_clickup.ListResponse, psHierarchy int) { + page := 0 + + for { + tasks, err := service_clickup.ReturnTasks(list.Id, + type_clickup.SearchTask{ + TaskType: psHierarchy, + Page: page, + DateUpdatedGt: time.Now().Add(-time.Hour * 60).UTC().UnixMilli(), + IncludeClosed: true, + SubTasks: true, + TaskStatuses: "closed", + }, + ) + + if err != nil { + fmt.Println("Error ListTasksInClosedByPSHierarchy :: ", err.Error()) + return + } + + for i := 0; i < len(tasks.Tasks); i++ { + fmt.Println(enum_clickup_type_ps_hierarchy.ToString(psHierarchy), " Closed ", " :: ", variables_global.Customer.IntegrationName, " :: ", tasks.Tasks[i].Name, " :: ", tasks.Tasks[i].Url, @@ -287,7 +429,16 @@ func UpdateTask(list type_clickup.ListResponse, typeConsultingTask int, typeCons for { - tasks, err := service_clickup.ReturnTasks(list.Id, typeConsultingTask, page) + tasks, err := service_clickup.ReturnTasks(list.Id, + type_clickup.SearchTask{ + TaskType: typeConsultingTask, + Page: page, + DateUpdatedGt: time.Now().Add(-time.Hour * 240).UTC().UnixMilli(), + IncludeClosed: false, + SubTasks: true, + TaskStatuses: "", + }, + ) if err != nil { fmt.Println("Error UpdateSubtask :: ", err.Error()) @@ -404,6 +555,25 @@ func UpdateTask(list type_clickup.ListResponse, typeConsultingTask int, typeCons } } } + + if taskParent.CustomField.PSProjectHierarchy == enum_clickup_type_ps_hierarchy.STORE && variables_global.Customer.ValidateTag { + deliveryPoint := service_clickup.RetDeliveryPointTag(taskParent.Tags) + deliveruPointString := strconv.Itoa(deliveryPoint) + if deliveryPoint != 0 && !strings.EqualFold(deliveruPointString, taskParent.CustomField.PSDeliveryPoints) { + + err = service_clickup.RequestSetValueCustomField(taskParent.Id, + variables_constant.CLICKUP_CUSTOM_FIELD_PS_DELIVERY_POINTS, + type_clickup.CustomFieldValueRequest{ + deliveruPointString, + }, + ) + + if err != nil { + fmt.Println("Store not possible update delivery points") + } + + } + } } if tasks.LastPage { @@ -434,10 +604,23 @@ func MainAction(mainAction int) { switch mainAction { case enum_main_action.TASKS_VERIFY: VerifyErrorsProjectWithStore(list) + case enum_main_action.TASKS_UPDATE: UpdateProjectWithStore(list) + case enum_main_action.TASKS_INPROGRESS: ListStoryInProgress(list) + + case enum_main_action.TASKS_INCLOSED: + ListTasksInClosed(list) + + case enum_main_action.ASSETS_NEW_CP_FORTIFY: + if variables_global.Customer.AssetNewFortify { + AssetsNew(variables_global.Customer) + } + case enum_main_action.TASKS_UPDATE_DONE_CLOSED: + UpdateTasksInDoneToClosed(list) + } fmt.Println("Finish: ", time.Now().Format("2006-01-02 15:04:05")) @@ -677,6 +860,26 @@ func CreateProject() { fmt.Println("Create Task Success!") } +func AssetsNew(integration type_config.ConfigTypeIntegration) { + var urlBase bytes.Buffer + + urlBase.WriteString(variables_constant.CONVISO_PLATFORM_URL_BASE) + urlBase.WriteString("scopes/") + urlBase.WriteString(strconv.Itoa(integration.PlatformID)) + urlBase.WriteString("/integrations/fortify/select_projects?page={1}") + + page := 1 + + for { + urlPage := strings.Replace(urlBase.String(), "{1}", strconv.Itoa(page), -1) + cont := service_crawler.Exec(integration.PlatformID, urlPage) + if !cont { + break + } + page++ + } +} + func InitialCheck() bool { ret := true @@ -710,6 +913,14 @@ func SetDefaultValue() { } func main() { + /* + TODO LIST + remover gambiarra verificar CP criou projeto + separar as atualizações do cp e clickup, hoje tem uma variável, has update, mas deveria ter algo do tipo hasupdate cp e hasupcate clickup + atualizar tarefas done to closed (feito) + qdo não encontrar um cliente no campo PS Customer, não quebrar a aplicação, selecionar o primeiro da lista ou algo assim + verificar possibilidade de melhorar a função de recuperar o customfield do clickup na função returntask + */ if !InitialCheck() { fmt.Println("You need to correct the above information before rerunning the application") @@ -723,6 +934,9 @@ func main() { integrationJustVerify := flag.Bool("tv", false, "Verify if clickup tasks is ok") integrationUpdateTasks := flag.Bool("tu", false, "Update Conviso Platform and ClickUp Tasks") integrationListTasksInProgress := flag.Bool("tsip", false, "List Clickup Stories In Progress") + integrationListTasksClosed := flag.Bool("tsd", false, "List Clickup Epics, Stories and Tasks in Closed") + crawlerAssetNewCP := flag.Bool("can", false, "Search New Assets Fortify Integration Conviso Platform") + integrationUpdateTasksDone := flag.Bool("tud", false, "Change tasks done to closed") deploy := flag.Bool("d", false, "See info about deploys") version := flag.Bool("v", false, "Script Version") @@ -750,6 +964,21 @@ func main() { os.Exit(0) } + if *integrationListTasksClosed { + MainAction(enum_main_action.TASKS_INCLOSED) + os.Exit(0) + } + + if *crawlerAssetNewCP { + MainAction(enum_main_action.ASSETS_NEW_CP_FORTIFY) + os.Exit(0) + } + + if *integrationUpdateTasksDone { + MainAction(enum_main_action.TASKS_UPDATE_DONE_CLOSED) + os.Exit(0) + } + if *deploy { service_conviso_platform.RetDeploys() os.Exit(0) diff --git a/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-linuxAMD64.tar.xz b/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-linuxAMD64.tar.xz new file mode 100644 index 0000000..7a9b969 Binary files /dev/null and b/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-linuxAMD64.tar.xz differ diff --git a/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-macOSARM64.tar.xz b/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-macOSARM64.tar.xz new file mode 100644 index 0000000..1628ff2 Binary files /dev/null and b/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-macOSARM64.tar.xz differ diff --git a/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-macOSIntel.tar.xz b/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-macOSIntel.tar.xz new file mode 100644 index 0000000..d7cc3f8 Binary files /dev/null and b/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-macOSIntel.tar.xz differ diff --git a/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-windowsAMD64.tar.xz b/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-windowsAMD64.tar.xz new file mode 100644 index 0000000..bb62e3f Binary files /dev/null and b/integration_platform_clickup_go/releases/IntegrationPlatformClickup-v02.00.00-windowsAMD64.tar.xz differ diff --git a/integration_platform_clickup_go/repositories/repository_assets/repository_assets.go b/integration_platform_clickup_go/repositories/repository_assets/repository_assets.go new file mode 100644 index 0000000..4060cbb --- /dev/null +++ b/integration_platform_clickup_go/repositories/repository_assets/repository_assets.go @@ -0,0 +1,59 @@ +package repository_assets + +import ( + "database/sql" + "errors" + "integration_platform_clickup_go/types/type_repository" + "integration_platform_clickup_go/utils/variables_constant" + + _ "github.com/mattn/go-sqlite3" +) + +func Insert(asset type_repository.Asset) error { + db, err := sql.Open("sqlite3", variables_constant.DATABASE_SQLITE_PATH) + + if err != nil { + return err + } + + // insert + stmt, err := db.Prepare("INSERT INTO assets(id, cp_company_id, cp_asset_id, name, dt_created) values(?,?,?,?,?)") + + if err != nil { + db.Close() + return err + } + + res, err := stmt.Exec(asset.Id, asset.CPCompanyId, asset.CPAssetId, asset.Name, asset.DtCreated) + + if err != nil { + db.Close() + return err + } + + affect, err := res.RowsAffected() + + if err != nil || affect == 0 { + db.Close() + return errors.New("error asset insert") + } + + db.Close() + return nil +} + +func AssetExist(asset type_repository.Asset) (bool, error) { + + var exist bool + + db, err := sql.Open("sqlite3", variables_constant.DATABASE_SQLITE_PATH) + if err != nil { + return false, err + } + + db.QueryRow("select count(*) > 0 from assets where name=? and cp_company_id=?", asset.Name, asset.CPCompanyId).Scan(&exist) + + db.Close() + + return exist, nil +} diff --git a/integration_platform_clickup_go/services/service_clickup/service_clickup.go b/integration_platform_clickup_go/services/service_clickup/service_clickup.go index f7b759f..ebd8163 100755 --- a/integration_platform_clickup_go/services/service_clickup/service_clickup.go +++ b/integration_platform_clickup_go/services/service_clickup/service_clickup.go @@ -78,9 +78,9 @@ func RetClickUpDropDownOptionName(clickupFieldId string, order int) (string, err return result, nil } -func RetCustomFieldUrlConviso(customFields []type_clickup.CustomField) string { +func RetCustomFieldValueString(customFieldId string, customFields []type_clickup.CustomField) string { for i := 0; i < len(customFields); i++ { - if customFields[i].Id == variables_constant.CLICKUP_CUSTOM_FIELD_PS_CP_LINK { + if customFields[i].Id == customFieldId { if customFields[i].Value == nil { return "" } else { @@ -215,13 +215,10 @@ func VerifyTasks(taskEpic type_clickup.TaskResponse) error { return nil } -func ReturnTasks(listId string, taskType int, page int) (type_clickup.TasksResponse, error) { +func ReturnTasks(listId string, searchTasks type_clickup.SearchTask) (type_clickup.TasksResponse, error) { var resultTasks type_clickup.TasksResponse var urlGetTasks bytes.Buffer - intTaskType := strconv.FormatInt(int64(taskType), 10) - strPage := strconv.FormatInt(int64(page), 10) - urlGetTasks.WriteString(variables_constant.CLICKUP_API_URL_BASE) urlGetTasks.WriteString("list/") urlGetTasks.WriteString(listId) @@ -229,51 +226,30 @@ func ReturnTasks(listId string, taskType int, page int) (type_clickup.TasksRespo urlGetTasks.WriteString("{\"field_id\":\"") urlGetTasks.WriteString(variables_constant.CLICKUP_CUSTOM_FIELD_PS_HIERARCHY) urlGetTasks.WriteString("\",\"operator\":\"=\",\"value\":\"") - urlGetTasks.WriteString(intTaskType) + urlGetTasks.WriteString(strconv.FormatInt(int64(searchTasks.TaskType), 10)) urlGetTasks.WriteString("\"}") urlGetTasks.WriteString("]") - urlGetTasks.WriteString("&include_closed=true") - urlGetTasks.WriteString("&date_updated_gt=") - urlGetTasks.WriteString(strconv.FormatInt(time.Now().Add(-time.Hour*240).UTC().UnixMilli(), 10)) - urlGetTasks.WriteString("&subtasks=true") - urlGetTasks.WriteString("&page=") - urlGetTasks.WriteString(strPage) - - response, err := functions.HttpRequestRetry(http.MethodGet, urlGetTasks.String(), globalClickupHeaders, nil, *variables_global.Config.ConfclickUp.HttpAttempt) - if err != nil { - return resultTasks, errors.New("Error ReturnTasks: " + err.Error()) + if searchTasks.IncludeClosed { + urlGetTasks.WriteString("&include_closed=true") } - data, _ := io.ReadAll(response.Body) - - json.Unmarshal([]byte(string(data)), &resultTasks) - - return resultTasks, nil -} + if searchTasks.DateUpdatedGt > 0 { + urlGetTasks.WriteString("&date_updated_gt=") + urlGetTasks.WriteString(strconv.FormatInt(searchTasks.DateUpdatedGt, 10)) + } -func ReturnTasksByStatus(listId string, taskType int, taskStatuses string, page int) (type_clickup.TasksResponse, error) { - var resultTasks type_clickup.TasksResponse - var urlGetTasks bytes.Buffer + if searchTasks.SubTasks { + urlGetTasks.WriteString("&subtasks=true") + } - intTaskType := strconv.FormatInt(int64(taskType), 10) - strPage := strconv.FormatInt(int64(page), 10) + if !strings.EqualFold(searchTasks.TaskStatuses, "") { + urlGetTasks.WriteString("&statuses[]=") + urlGetTasks.WriteString(searchTasks.TaskStatuses) + } - urlGetTasks.WriteString(variables_constant.CLICKUP_API_URL_BASE) - urlGetTasks.WriteString("list/") - urlGetTasks.WriteString(listId) - urlGetTasks.WriteString("/task?custom_fields=[") - urlGetTasks.WriteString("{\"field_id\":\"") - urlGetTasks.WriteString(variables_constant.CLICKUP_CUSTOM_FIELD_PS_HIERARCHY) - urlGetTasks.WriteString("\",\"operator\":\"=\",\"value\":\"") - urlGetTasks.WriteString(intTaskType) - urlGetTasks.WriteString("\"}") - urlGetTasks.WriteString("]") - urlGetTasks.WriteString("&subtasks=true") urlGetTasks.WriteString("&page=") - urlGetTasks.WriteString(strPage) - urlGetTasks.WriteString("&statuses[]=") - urlGetTasks.WriteString(taskStatuses) + urlGetTasks.WriteString(strconv.FormatInt(int64(searchTasks.Page), 10)) response, err := functions.HttpRequestRetry(http.MethodGet, urlGetTasks.String(), globalClickupHeaders, nil, *variables_global.Config.ConfclickUp.HttpAttempt) @@ -307,9 +283,10 @@ func ReturnTask(taskId string) (type_clickup.TaskResponse, error) { //add customFields task.CustomField.PSProjectHierarchy = RetCustomFieldTypeConsulting(task.CustomFields) - task.CustomField.PSConvisoPlatformLink = RetCustomFieldUrlConviso(task.CustomFields) + task.CustomField.PSConvisoPlatformLink = RetCustomFieldValueString(variables_constant.CLICKUP_CUSTOM_FIELD_PS_CP_LINK, task.CustomFields) task.CustomField.PSTeam = RetCustomFieldPSTeam(task.CustomFields) task.CustomField.PSCustomer = RetCustomFieldPSCustomer(task.CustomFields) + task.CustomField.PSDeliveryPoints = RetCustomFieldValueString(variables_constant.CLICKUP_CUSTOM_FIELD_PS_DELIVERY_POINTS, task.CustomFields) return task, nil } @@ -394,6 +371,43 @@ func RequestPutTask(taskId string, request type_clickup.TaskRequest) error { return nil } +func RequestPutTaskStatus(taskId string, request type_clickup.TaskRequestStatus) error { + + var urlPutTask bytes.Buffer + urlPutTask.WriteString(variables_constant.CLICKUP_API_URL_BASE) + urlPutTask.WriteString("task/") + urlPutTask.WriteString(taskId) + + body, _ := json.Marshal(request) + + payload := bytes.NewBuffer(body) + + time.Sleep(time.Second) + + req, err := http.NewRequest(http.MethodPut, urlPutTask.String(), payload) + if err != nil { + return errors.New("Error RequestPutTaskStatus request: " + err.Error()) + } + + req.Header.Add("Content-Type", "application/json") + req.Header.Set("Authorization", os.Getenv("CLICKUP_TOKEN")) + client := &http.Client{Timeout: time.Second * 10} + resp, err := client.Do(req) + defer req.Body.Close() + + if resp.StatusCode != 200 { + return errors.New("Error RequestPutTaskStatus StatusCode: " + http.StatusText(resp.StatusCode)) + } + + if err != nil { + return errors.New("Error RequestPutTaskStatus response: " + err.Error()) + } + + io.ReadAll(resp.Body) + + return nil +} + func RequestPutTaskStore(taskId string, request type_clickup.TaskRequestStore) error { var urlPutTask bytes.Buffer @@ -430,6 +444,46 @@ func RequestPutTaskStore(taskId string, request type_clickup.TaskRequestStore) e return nil } + +func RequestSetValueCustomField(taskId string, customFieldId string, request type_clickup.CustomFieldValueRequest) error { + + var urlSetCustomField bytes.Buffer + urlSetCustomField.WriteString(variables_constant.CLICKUP_API_URL_BASE) + urlSetCustomField.WriteString("task/") + urlSetCustomField.WriteString(taskId) + urlSetCustomField.WriteString("/field/") + urlSetCustomField.WriteString(customFieldId) + + body, _ := json.Marshal(request) + + payload := bytes.NewBuffer(body) + + time.Sleep(time.Second) + + req, err := http.NewRequest(http.MethodPost, urlSetCustomField.String(), payload) + if err != nil { + return errors.New("Error RequestSetValueCustomField request: " + err.Error()) + } + + req.Header.Add("Content-Type", "application/json") + req.Header.Set("Authorization", os.Getenv("CLICKUP_TOKEN")) + client := &http.Client{Timeout: time.Second * 10} + resp, err := client.Do(req) + defer req.Body.Close() + + if resp.StatusCode != 200 { + return errors.New("Error RequestSetValueCustomField StatusCode: " + http.StatusText(resp.StatusCode)) + } + + if err != nil { + return errors.New("Error RequestSetValueCustomField response: " + err.Error()) + } + + io.ReadAll(resp.Body) + + return nil +} + func RequestTaskTimeSpent(teamId string, request type_clickup.TaskTimeSpentRequest) error { var urlTaskTimeSpent bytes.Buffer urlTaskTimeSpent.WriteString(variables_constant.CLICKUP_API_URL_BASE) @@ -507,14 +561,12 @@ func TaskCreateRequest(request type_clickup.TaskCreateRequest) (type_clickup.Tas return result, nil } -func CheckTags(tags []type_clickup.TagResponse, value string) bool { +func CheckTags(tags []type_clickup.TagResponse) bool { ret := false - vetValue := strings.Split(value, ";") - for i := 0; i < len(tags); i++ { - for j := 0; j < len(vetValue); j++ { - if strings.ToLower(tags[i].Name) == strings.ToLower(vetValue[j]) { + for j := 0; j < len(variables_global.Config.Tags); j++ { + if strings.EqualFold(tags[i].Name, variables_global.Config.Tags[j].Value) { return true } } @@ -522,3 +574,29 @@ func CheckTags(tags []type_clickup.TagResponse, value string) bool { return ret } + +func CheckSpecificTag(tags []type_clickup.TagResponse, tagVerify string) bool { + ret := false + + for i := 0; i < len(tags); i++ { + if strings.EqualFold(tags[i].Name, tagVerify) { + return true + } + } + + return ret +} + +func RetDeliveryPointTag(tags []type_clickup.TagResponse) int { + ret := 0 + + for i := 0; i < len(tags); i++ { + for j := 0; j < len(variables_global.Config.Tags); j++ { + if strings.EqualFold(tags[i].Name, variables_global.Config.Tags[j].Value) { + return variables_global.Config.Tags[j].DeliveryPoints + } + } + } + + return ret +} diff --git a/integration_platform_clickup_go/services/service_crawler/service_crawler.go b/integration_platform_clickup_go/services/service_crawler/service_crawler.go new file mode 100644 index 0000000..1b4876e --- /dev/null +++ b/integration_platform_clickup_go/services/service_crawler/service_crawler.go @@ -0,0 +1,96 @@ +package service_crawler + +import ( + "fmt" + "integration_platform_clickup_go/repositories/repository_assets" + "integration_platform_clickup_go/services/service_slack" + "integration_platform_clickup_go/types/type_repository" + "integration_platform_clickup_go/types/type_slack" + "integration_platform_clickup_go/utils/variables_constant" + "os" + "regexp" + "strings" + "time" + + "github.com/gocolly/colly" + "github.com/google/uuid" +) + +func Exec(company int, url string) bool { + + ret := true + + c := colly.NewCollector() + + c.OnHTML("div[class]", func(e *colly.HTMLElement) { + class := e.Attr("class") + + if strings.EqualFold(class, "col-lg-6 col-md-6 col-xs-12") { + + if strings.EqualFold(e.DOM.Find("p").Text(), "new") { + + rProject, _ := regexp.Compile("(.*)Project: ([a-zA-Z0-9\\-\\_ ]*)") + rId, _ := regexp.Compile("(.*)Id: ([a-zA-Z0-9\\-\\_ ]*)") + + asset := type_repository.Asset{ + CPCompanyId: company, + Name: strings.TrimSpace((strings.Split(rProject.FindString(e.DOM.Find("strong").Text()), ":"))[1]), + CPAssetId: strings.TrimSpace((strings.Split(rId.FindString(e.DOM.Find("strong").Text()), ":"))[1]), + } + + assetExist, err := repository_assets.AssetExist(asset) + + if err != nil { + fmt.Println("Service Crawler :: Error :: It was impossible to veriry the asset in database!") + } + + if !assetExist { + asset.Id = uuid.New().String() + asset.DtCreated = time.Now().Format("2006-01-02 15:04:05.000000") + err = repository_assets.Insert(asset) + + if err != nil { + fmt.Println("Service Crawler :: Error :: It was impossible to save the asset in database!") + } + + slackMessage := "*Salve! Salve! chegou um Ativo New!*\n" + + "*Id:* " + asset.CPAssetId + "\n" + + "*Project:* " + asset.Name + "\n" + + "*Link:* " + url + "\n\n" + + "Por favor verifiquem se esse ativo pertence a sua squad!" + + err = service_slack.RequestPostMessage( + type_slack.PostMessage{ + Channel: variables_constant.SLACK_CHANNEL_CONSULTING, + Text: slackMessage, + }, + ) + + if err != nil { + fmt.Println("service_crawler :: it was impossible to send slack message") + } + } + + } + } + }) + + // Before making a request print "Visiting ..." + c.OnRequest(func(r *colly.Request) { + r.Headers.Set("X-Armature-Api-Key", os.Getenv("CONVISO_PLATFORM_TOKEN")) + fmt.Println("OnRequest", r.URL.String()) + }) + + c.OnResponse(func(r *colly.Response) { + fmt.Println("Visited", r.StatusCode) + }) + + c.OnError(func(r *colly.Response, err error) { + fmt.Println("Request URL:", r.Request.URL, "failed with response:", r.Request, "\nError:", err) + ret = false + }) + + c.Visit(url) + + return ret +} diff --git a/integration_platform_clickup_go/services/service_slack/service_slack.go b/integration_platform_clickup_go/services/service_slack/service_slack.go new file mode 100644 index 0000000..329153d --- /dev/null +++ b/integration_platform_clickup_go/services/service_slack/service_slack.go @@ -0,0 +1,79 @@ +package service_slack + +import ( + "bytes" + "encoding/json" + "errors" + "integration_platform_clickup_go/types/type_slack" + "integration_platform_clickup_go/utils/functions" + "integration_platform_clickup_go/utils/variables_constant" + "integration_platform_clickup_go/utils/variables_global" + "io" + "net/http" + "os" +) + +var globalSlackHeaders map[string]string + +func init() { + globalSlackHeaders = map[string]string{ + "Content-Type": "application/json", + "Authorization": "Bearer " + os.Getenv(variables_constant.SLACK_ASSET_TOKEN_NAME), + } +} + +func RequestPostMessage(request type_slack.PostMessage) error { + + var urlPostMessage bytes.Buffer + urlPostMessage.WriteString(variables_constant.SLACK_API_URL_BASE) + urlPostMessage.WriteString("chat.postMessage") + + body, _ := json.Marshal(request) + + payload := bytes.NewBuffer(body) + + resp, err := functions.HttpRequestRetry(http.MethodPost, urlPostMessage.String(), globalSlackHeaders, payload, *variables_global.Config.ConfclickUp.HttpAttempt) + + if err != nil { + return errors.New("Error RequestPostMessage: " + err.Error()) + } + + io.ReadAll(resp.Body) + + return nil +} + +// func RequestPostMessage(request type_slack.PostMessage) error { +// var urlPostMessage bytes.Buffer +// urlPostMessage.WriteString(variables_constant.SLACK_API_URL_BASE) +// urlPostMessage.WriteString("chat.postMessage") + +// body, _ := json.Marshal(request) + +// payload := bytes.NewBuffer(body) + +// time.Sleep(time.Second) + +// req, err := http.NewRequest(http.MethodPost, urlPostMessage.String(), payload) +// if err != nil { +// return errors.New("Error RequestTaskTimeSpent request: " + err.Error()) +// } + +// req.Header.Add("Content-Type", "application/json") +// req.Header.Set("Authorization", "Bearer "+os.Getenv(variables_constant.SLACK_ASSET_TOKEN_NAME)) +// client := &http.Client{Timeout: time.Second * 10} +// resp, err := client.Do(req) +// defer req.Body.Close() + +// if resp.StatusCode != 200 { +// return errors.New("Error RequestTaskTimeSpent StatusCode: " + http.StatusText(resp.StatusCode)) +// } + +// if err != nil { +// return errors.New("Error RequestTaskTimeSpent response: " + err.Error()) +// } + +// io.ReadAll(resp.Body) + +// return nil +// } diff --git a/integration_platform_clickup_go/types/type_clickup/type_clickup.go b/integration_platform_clickup_go/types/type_clickup/type_clickup.go index c7548ff..05ce9e5 100755 --- a/integration_platform_clickup_go/types/type_clickup/type_clickup.go +++ b/integration_platform_clickup_go/types/type_clickup/type_clickup.go @@ -27,6 +27,7 @@ type CustomFieldCustomized struct { PSCustomer string PSConvisoPlatformLink string PSTeam string + PSDeliveryPoints string } type TaskResponse struct { @@ -61,6 +62,10 @@ type TaskRequest struct { Status string `json:"status"` } +type TaskRequestStatus struct { + Status string `json:"status"` +} + type TaskRequestStore struct { StartDate int64 `json:"start_date"` DueDate int64 `json:"due_date"` @@ -89,6 +94,10 @@ type CustomFieldRequest struct { Value interface{} `json:"value"` } +type CustomFieldValueRequest struct { + Value string `json:"value"` +} + type CustomFieldsResponse struct { Fields []CustomField `json:"fields"` } @@ -115,3 +124,12 @@ type CustomFieldOptions struct { Color string `json:"color"` OrderIndex int `json:"orderindex"` } + +type SearchTask struct { + TaskType int + Page int + DateUpdatedGt int64 + IncludeClosed bool + SubTasks bool + TaskStatuses string +} diff --git a/integration_platform_clickup_go/types/type_config/type_config.go b/integration_platform_clickup_go/types/type_config/type_config.go index 3ff47dd..fa7d2e6 100755 --- a/integration_platform_clickup_go/types/type_config/type_config.go +++ b/integration_platform_clickup_go/types/type_config/type_config.go @@ -1,11 +1,14 @@ package type_config type ConfigTypeIntegration struct { - IntegrationName string `yaml:"integrationname"` - PlatformID int `yaml:"platformid"` - ClickUpListId string `yaml:"clickuplistid"` - ClickUpCustomerList string `yaml:"clickupcustomerlist"` - CheckTagsValidationStory string `yaml:"checkTagsValidationStory"` + IntegrationName string `yaml:"integrationname"` + PlatformID int `yaml:"platformid"` + ClickUpListId string `yaml:"clickuplistid"` + ClickUpCustomerList string `yaml:"clickupcustomerlist"` + AssetNewFortify bool `yaml:"assetNewFortify"` + ValidateTag bool `yaml:"validateTag"` + ValidatePSCustomer bool `yaml:"validatePSCustomer"` + ValidatePSConvisoPlatformLink bool `yaml:"validatePSConvisoPlatformLink"` } type ConfigTypeClickup struct { @@ -21,4 +24,10 @@ type ConfigType struct { ConfigGeneral ConfigTypeGeneral `yaml:"configGeneral"` ConfclickUp ConfigTypeClickup `yaml:"configclickUp"` Integrations []ConfigTypeIntegration `yaml:"integrations"` + Tags []ConfigTag `yaml:"tags"` +} + +type ConfigTag struct { + Value string `yaml:"value"` + DeliveryPoints int `yaml:"deliveryPoints"` } diff --git a/integration_platform_clickup_go/types/type_enum/enum_clickup_ps_team/enum_clickup_ps_team.go b/integration_platform_clickup_go/types/type_enum/enum_clickup_ps_team/enum_clickup_ps_team.go index d5a91d3..0beef66 100644 --- a/integration_platform_clickup_go/types/type_enum/enum_clickup_ps_team/enum_clickup_ps_team.go +++ b/integration_platform_clickup_go/types/type_enum/enum_clickup_ps_team/enum_clickup_ps_team.go @@ -1,8 +1,9 @@ package enum_clickup_ps_team const ( - CONSULTING int = 0 - OFFSEC int = 1 + CONSULTING int = 0 + OFFSEC int = 1 + EDUCATIONANDCOMMUNIY int = 2 ) func ToString(value int) string { @@ -11,6 +12,8 @@ func ToString(value int) string { return "CONSULTING" case OFFSEC: return "OFFSEC" + case EDUCATIONANDCOMMUNIY: + return "Education and Community" } return "unknown" } diff --git a/integration_platform_clickup_go/types/type_enum/enum_main_action/enum_main_action.go b/integration_platform_clickup_go/types/type_enum/enum_main_action/enum_main_action.go index 2c69519..343fb50 100644 --- a/integration_platform_clickup_go/types/type_enum/enum_main_action/enum_main_action.go +++ b/integration_platform_clickup_go/types/type_enum/enum_main_action/enum_main_action.go @@ -1,7 +1,10 @@ package enum_main_action const ( - TASKS_VERIFY int = 0 - TASKS_UPDATE int = 1 - TASKS_INPROGRESS int = 2 + TASKS_VERIFY int = 0 + TASKS_UPDATE int = 1 + TASKS_INPROGRESS int = 2 + TASKS_INCLOSED int = 3 + TASKS_UPDATE_DONE_CLOSED int = 4 + ASSETS_NEW_CP_FORTIFY int = 5 ) diff --git a/integration_platform_clickup_go/types/type_repository/type_repository.go b/integration_platform_clickup_go/types/type_repository/type_repository.go new file mode 100644 index 0000000..19b39fa --- /dev/null +++ b/integration_platform_clickup_go/types/type_repository/type_repository.go @@ -0,0 +1,9 @@ +package type_repository + +type Asset struct { + Id string + CPAssetId string + CPCompanyId int + Name string + DtCreated string +} diff --git a/integration_platform_clickup_go/types/type_slack/type_slack.go b/integration_platform_clickup_go/types/type_slack/type_slack.go new file mode 100644 index 0000000..165f23e --- /dev/null +++ b/integration_platform_clickup_go/types/type_slack/type_slack.go @@ -0,0 +1,6 @@ +package type_slack + +type PostMessage struct { + Channel string `json:"channel"` + Text string `json:"text"` +} diff --git a/integration_platform_clickup_go/utils/variables_constant/variables_constant.go b/integration_platform_clickup_go/utils/variables_constant/variables_constant.go index a53eb45..704468d 100755 --- a/integration_platform_clickup_go/utils/variables_constant/variables_constant.go +++ b/integration_platform_clickup_go/utils/variables_constant/variables_constant.go @@ -1,6 +1,6 @@ package variables_constant -const VERSION = "1.0.6" +const VERSION = "2.0.0" const CLICKUP_CUSTOM_FIELD_PS_CP_LINK = "9974fcfc-3634-4620-8b89-a9d0b6958ce6" @@ -10,7 +10,7 @@ const CLICKUP_CUSTOM_FIELD_PS_TEAM_ID = "ca0056b6-a9fc-45cd-bd89-f7ea3067ebb4" const CLICKUP_CUSTOM_FIELD_PS_CUSTOMER_ID = "f3b4ecc4-737b-4040-a75d-664e89ad2f3a" -// const CLICKUP_FOLDER_CONSULTING_ID = "114948796" +const CLICKUP_CUSTOM_FIELD_PS_DELIVERY_POINTS = "761d0b8d-5586-4c91-b861-1bc49210a0ee" const CLICKUP_API_URL_BASE = "https://api.clickup.com/api/v2/" @@ -18,10 +18,18 @@ const CLICKUP_TOKEN_NAME = "CLICKUP_TOKEN" const CLICKUP_TEAM_NAME = "consulting" -//const CLICKUP_TEAM_ID_CONSULTING = "c1242935-3e22-47ea-bd02-2b82ed541ac3" - const CONVISO_PLATFORM_API_GRAPHQL = "https://app.convisoappsec.com/graphql" const CONVISO_PLATFORM_URL_BASE = "https://app.convisoappsec.com/" const CONVISO_PLATFORM_TOKEN_NAME = "CONVISO_PLATFORM_TOKEN" + +const SLACK_API_URL_BASE = "https://slack.com/api/" + +const SLACK_ASSET_TOKEN_NAME = "SLACK_ASSET_TOKEN" + +const SLACK_CHANNEL_CONSULTING = "C03QFNQKJTV" + +// const SLACK_CHANNEL_CONSULTING = "C06M6LT3STG" + +const DATABASE_SQLITE_PATH = "db/db.db" diff --git a/integration_platform_clickup_go/utils/variables_global/variables_global.go b/integration_platform_clickup_go/utils/variables_global/variables_global.go index 15fba12..a5c8fd9 100755 --- a/integration_platform_clickup_go/utils/variables_global/variables_global.go +++ b/integration_platform_clickup_go/utils/variables_global/variables_global.go @@ -4,6 +4,12 @@ import ( "integration_platform_clickup_go/types/type_config" ) -var Customer = type_config.ConfigTypeIntegration{"", 0, "", "No selected project", ""} +var Customer = type_config.ConfigTypeIntegration{ + IntegrationName: "", + PlatformID: 0, + ClickUpListId: "", + ClickUpCustomerList: "No selected project", + //CheckTagsValidationStory: "", +} var Config type_config.ConfigType