From 1e37e8cd38d9a99e2b63566b381e76a0a1047a45 Mon Sep 17 00:00:00 2001 From: ice-myles <96409608+ice-myles@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:42:10 +0300 Subject: [PATCH] Added task url to config and metadata response. Fixed the output of icon in the response. --- application.yaml | 2 ++ cmd/santa-sleigh/api/docs.go | 6 ++++-- cmd/santa-sleigh/api/swagger.json | 4 ++++ cmd/santa-sleigh/api/swagger.yaml | 5 +++-- cmd/santa/api/docs.go | 6 ++++-- cmd/santa/api/swagger.json | 4 ++++ cmd/santa/api/swagger.yaml | 5 +++-- go.mod | 22 +++++++++---------- go.sum | 36 +++++++++++++++---------------- tasks/.testdata/application.yaml | 2 ++ tasks/contract.go | 2 ++ tasks/get_tasks.go | 20 ++++++++++------- 12 files changed, 69 insertions(+), 45 deletions(-) diff --git a/application.yaml b/application.yaml index 7a28e8a..3ebab57 100644 --- a/application.yaml +++ b/application.yaml @@ -40,9 +40,11 @@ tasksList: &tasksList - type: follow_us_on_twitter prize: 400 icon: https://app.sunwavestoken.com/web/images/Components/Overview/twitter-follow.svg + url: https://x.com/ice_blockchain - type: join_telegram prize: 500 icon: https://app.sunwavestoken.com/web/images/Components/Overview/join-telegram-waiting.svg + url: https://t.me/iceblockchain - type: invite_friends prize: 600 icon: https://app.sunwavestoken.com/web/images/Components/Overview/invite.svg diff --git a/cmd/santa-sleigh/api/docs.go b/cmd/santa-sleigh/api/docs.go index 146cfa6..67de65c 100644 --- a/cmd/santa-sleigh/api/docs.go +++ b/cmd/santa-sleigh/api/docs.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: ice License 1.0 - // Package api Code generated by swaggo/swag. DO NOT EDIT package api @@ -608,6 +606,10 @@ const docTemplate = `{ "type": "string", "example": "Short description" }, + "taskUrl": { + "type": "string", + "example": "https://x.com/ice_blockchain" + }, "title": { "type": "string", "example": "Claim username" diff --git a/cmd/santa-sleigh/api/swagger.json b/cmd/santa-sleigh/api/swagger.json index 5778d19..0fdad47 100644 --- a/cmd/santa-sleigh/api/swagger.json +++ b/cmd/santa-sleigh/api/swagger.json @@ -601,6 +601,10 @@ "type": "string", "example": "Short description" }, + "taskUrl": { + "type": "string", + "example": "https://x.com/ice_blockchain" + }, "title": { "type": "string", "example": "Claim username" diff --git a/cmd/santa-sleigh/api/swagger.yaml b/cmd/santa-sleigh/api/swagger.yaml index f56fbbf..1e954a1 100644 --- a/cmd/santa-sleigh/api/swagger.yaml +++ b/cmd/santa-sleigh/api/swagger.yaml @@ -1,5 +1,3 @@ -# SPDX-License-Identifier: ice License 1.0 - definitions: badges.AchievingRange: properties: @@ -111,6 +109,9 @@ definitions: shortDescription: example: Short description type: string + taskUrl: + example: https://x.com/ice_blockchain + type: string title: example: Claim username type: string diff --git a/cmd/santa/api/docs.go b/cmd/santa/api/docs.go index 0293433..ac8d2c3 100644 --- a/cmd/santa/api/docs.go +++ b/cmd/santa/api/docs.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: ice License 1.0 - // Package api Code generated by swaggo/swag. DO NOT EDIT package api @@ -492,6 +490,10 @@ const docTemplate = `{ "type": "string", "example": "Short description" }, + "taskUrl": { + "type": "string", + "example": "https://x.com/ice_blockchain" + }, "title": { "type": "string", "example": "Claim username" diff --git a/cmd/santa/api/swagger.json b/cmd/santa/api/swagger.json index 67e23a9..8bde67d 100644 --- a/cmd/santa/api/swagger.json +++ b/cmd/santa/api/swagger.json @@ -486,6 +486,10 @@ "type": "string", "example": "Short description" }, + "taskUrl": { + "type": "string", + "example": "https://x.com/ice_blockchain" + }, "title": { "type": "string", "example": "Claim username" diff --git a/cmd/santa/api/swagger.yaml b/cmd/santa/api/swagger.yaml index 001ebd6..ccf082f 100644 --- a/cmd/santa/api/swagger.yaml +++ b/cmd/santa/api/swagger.yaml @@ -1,5 +1,3 @@ -# SPDX-License-Identifier: ice License 1.0 - basePath: /v1r definitions: badges.AchievingRange: @@ -107,6 +105,9 @@ definitions: shortDescription: example: Short description type: string + taskUrl: + example: https://x.com/ice_blockchain + type: string title: example: Claim username type: string diff --git a/go.mod b/go.mod index f5b12f3..5c7dfdd 100644 --- a/go.mod +++ b/go.mod @@ -30,20 +30,20 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/Microsoft/hcsshim v0.12.6 // indirect github.com/andybalholm/brotli v1.1.0 // indirect - github.com/bytedance/sonic v1.12.1 // indirect + github.com/bytedance/sonic v1.12.2 // indirect github.com/bytedance/sonic/loader v0.2.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cloudflare/circl v1.4.0 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect github.com/containerd/cgroups/v3 v3.0.3 // indirect - github.com/containerd/containerd v1.7.20 // indirect + github.com/containerd/containerd v1.7.21 // indirect github.com/containerd/continuity v0.4.3 // indirect github.com/containerd/errdefs v0.1.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/distribution/reference v0.6.0 // indirect github.com/docker/distribution v2.8.3+incompatible // indirect - github.com/docker/docker v27.1.2+incompatible // indirect + github.com/docker/docker v27.2.0+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect @@ -68,10 +68,10 @@ require ( github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect + github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.3 // indirect github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -99,7 +99,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/morikuni/aec v1.0.0 // indirect - github.com/onsi/ginkgo/v2 v2.20.1 // indirect + github.com/onsi/ginkgo/v2 v2.20.2 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0 // indirect github.com/opencontainers/runc v1.1.13 // indirect @@ -148,12 +148,12 @@ require ( golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.6.0 // indirect golang.org/x/tools v0.24.0 // indirect - google.golang.org/api v0.194.0 // indirect + google.golang.org/api v0.195.0 // indirect google.golang.org/appengine/v2 v2.0.6 // indirect - google.golang.org/genproto v0.0.0-20240823204242-4ba0660f739c // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240823204242-4ba0660f739c // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240823204242-4ba0660f739c // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/grpc v1.66.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 300129e..9e14812 100644 --- a/go.sum +++ b/go.sum @@ -32,8 +32,8 @@ github.com/Microsoft/hcsshim v0.12.6 h1:qEnZjoHXv+4/s0LmKZWE0/AiZmMWEIkFfWBSf1a0 github.com/Microsoft/hcsshim v0.12.6/go.mod h1:ZABCLVcvLMjIkzr9rUGcQ1QA0p0P3Ps+d3N1g2DsFfk= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= -github.com/bytedance/sonic v1.12.1 h1:jWl5Qz1fy7X1ioY74WqO0KjAMtAGQs4sYnjiEBiyX24= -github.com/bytedance/sonic v1.12.1/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= +github.com/bytedance/sonic v1.12.2 h1:oaMFuRTpMHYLpCntGca65YWt5ny+wAceDERTkT2L9lg= +github.com/bytedance/sonic v1.12.2/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= @@ -169,15 +169,15 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= +github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 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/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= -github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/enterprise-certificate-proxy v0.3.3 h1:QRje2j5GZimBzlbhGA2V2QlGNgL8G6e+wGo/+/2bWI0= +github.com/googleapis/enterprise-certificate-proxy v0.3.3/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= @@ -254,8 +254,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo= -github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= +github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag= github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -449,8 +449,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.194.0 h1:dztZKG9HgtIpbI35FhfuSNR/zmaMVdxNlntHj1sIS4s= -google.golang.org/api v0.194.0/go.mod h1:AgvUFdojGANh3vI+P7EVnxj3AISHllxGCJSFmggmnd0= +google.golang.org/api v0.195.0 h1:Ude4N8FvTKnnQJHU48RFI40jOBgIrL8Zqr3/QeST6yU= +google.golang.org/api v0.195.0/go.mod h1:DOGRWuv3P8TU8Lnz7uQc4hyNqrBpMtD9ppW3wBJurgc= 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/v2 v2.0.6 h1:LvPZLGuchSBslPBp+LAhihBeGSiRh1myRoYK4NtuBIw= @@ -458,19 +458,19 @@ google.golang.org/appengine/v2 v2.0.6/go.mod h1:WoEXGoXNfa0mLvaH5sV3ZSGXwVmy8yf7 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/genproto v0.0.0-20240823204242-4ba0660f739c h1:TYOEhrQMrNDTAd2rX9m+WgGr8Ku6YNuj1D7OX6rWSok= -google.golang.org/genproto v0.0.0-20240823204242-4ba0660f739c/go.mod h1:2rC5OendXvZ8wGEo/cSLheztrZDZaSoHanUcd1xtZnw= -google.golang.org/genproto/googleapis/api v0.0.0-20240823204242-4ba0660f739c h1:e0zB268kOca6FbuJkYUGxfwG4DKFZG/8DLyv9Zv66cE= -google.golang.org/genproto/googleapis/api v0.0.0-20240823204242-4ba0660f739c/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240823204242-4ba0660f739c h1:Kqjm4WpoWvwhMPcrAczoTyMySQmYa9Wy2iL6Con4zn8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240823204242-4ba0660f739c/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto v0.0.0-20240827150818-7e3bb234dfed h1:4C4dbrVFtfIp3GXJdMX1Sj25mahfn5DywOo65/2ISQ8= +google.golang.org/genproto v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:ICjniACoWvcDz8c8bOsHVKuuSGDJy1z5M4G0DM3HzTc= +google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed h1:3RgNmBoI9MZhsj3QxC+AP/qQhNwpCLOvYDYYsFrhFt0= +google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= 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.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= diff --git a/tasks/.testdata/application.yaml b/tasks/.testdata/application.yaml index 837bb87..105d105 100644 --- a/tasks/.testdata/application.yaml +++ b/tasks/.testdata/application.yaml @@ -17,9 +17,11 @@ tasksList: &tasksList - type: follow_us_on_twitter prize: 400 icon: https://app.sunwavestoken.com/web/images/Components/Overview/twitter-follow.svg + url: https://x.com/ice_blockchain - type: join_telegram prize: 500 icon: https://app.sunwavestoken.com/web/images/Components/Overview/join-telegram-waiting.svg + url: https://t.me/iceblockchain - type: invite_friends prize: 600 icon: https://app.sunwavestoken.com/web/images/Components/Overview/invite.svg diff --git a/tasks/contract.go b/tasks/contract.go index 1dd4aac..841a626 100644 --- a/tasks/contract.go +++ b/tasks/contract.go @@ -63,6 +63,7 @@ type ( ShortDescription string `json:"shortDescription,omitempty" example:"Short description"` LongDescription string `json:"longDescription,omitempty" example:"Long description"` IconURL string `json:"iconUrl,omitempty" example:"https://app.ice.com/web/invite.svg"` + TaskURL string `json:"taskUrl,omitempty" example:"https://x.com/ice_blockchain"` } Task struct { Data *Data `json:"data,omitempty"` @@ -161,6 +162,7 @@ type ( TasksList []struct { Type string `yaml:"type" mapstructure:"type"` Icon string `yaml:"icon" mapstructure:"icon"` + URL string `yaml:"url" mapstructure:"url"` Prize float64 `yaml:"prize" mapstructure:"prize"` } `yaml:"tasksList" mapstructure:"tasksList"` messagebroker.Config `mapstructure:",squash"` //nolint:tagliatelle // Nope. diff --git a/tasks/get_tasks.go b/tasks/get_tasks.go index 03afdc7..a2cce33 100644 --- a/tasks/get_tasks.go +++ b/tasks/get_tasks.go @@ -10,7 +10,6 @@ import ( storage "github.com/ice-blockchain/wintr/connectors/storage/v2" ) -//nolint:funlen // . func (r *repository) GetTasks(ctx context.Context, userID, language string) (resp []*Task, err error) { if ctx.Err() != nil { return nil, errors.Wrap(ctx.Err(), "unexpected deadline") @@ -34,11 +33,9 @@ func (r *repository) GetTasks(ctx context.Context, userID, language string) (res if _, ok := allTaskTemplates[task.Type][lang]; !ok { tmpl = allTaskTemplates[task.Type][lang] } - task.Metadata = &Metadata{ - Title: tmpl.getTitle(nil), - ShortDescription: tmpl.getShortDescription(nil), - LongDescription: tmpl.getLongDescription(nil), - } + task.Metadata.Title = tmpl.getTitle(nil) + task.Metadata.ShortDescription = tmpl.getShortDescription(nil) + task.Metadata.LongDescription = tmpl.getLongDescription(nil) } } @@ -135,12 +132,19 @@ func (r *repository) defaultTasks() (resp []*Task) { case InviteFriendsType: data = &Data{RequiredQuantity: r.cfg.RequiredFriendsInvited} } - resp = append(resp, &Task{ + task := &Task{ Data: data, Type: Type(r.cfg.TasksList[ix].Type), Completed: completed, Prize: r.cfg.TasksList[ix].Prize, - }) + } + task.Metadata = &Metadata{ + IconURL: r.cfg.TasksList[ix].Icon, + } + if r.cfg.TasksList[ix].URL != "" { + task.Metadata.TaskURL = r.cfg.TasksList[ix].URL + } + resp = append(resp, task) } } else { resp = make([]*Task, 0, len(&AllTypes))