update
This commit is contained in:
parent
d65ee339bc
commit
03d105a431
@ -1,6 +1,7 @@
|
|||||||
New verification:
|
New verification:
|
||||||
ID: {{ .ID }}
|
ID: {{ .ID }}
|
||||||
UserID: {{ .UserID }}
|
UserID: {{ .UserID }}
|
||||||
|
UserURL: {{ .UserURL }}
|
||||||
Accepted: {{ .Accepted }}
|
Accepted: {{ .Accepted }}
|
||||||
Status: {{ .Status }}
|
Status: {{ .Status }}
|
||||||
UpdatedAt: {{ .UpdatedAt.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
|
UpdatedAt: {{ .UpdatedAt.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
Updated verification:
|
Updated verification:
|
||||||
ID: {{ .ID }}
|
ID: {{ .ID }}
|
||||||
UserID: {{ .UserID }}
|
UserID: {{ .UserID }}
|
||||||
|
UserURL: {{ .UserURL }}
|
||||||
Accepted: {{ .Accepted }}
|
Accepted: {{ .Accepted }}
|
||||||
Status: {{ .Status }}
|
Status: {{ .Status }}
|
||||||
UpdatedAt: {{ .UpdatedAt.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
|
UpdatedAt: {{ .UpdatedAt.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
|
||||||
|
@ -11,7 +11,5 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- mongo_data:/data/db
|
- mongo_data:/data/db
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mongo_data:
|
mongo_data:
|
||||||
|
|
||||||
|
5
go.mod
5
go.mod
@ -7,6 +7,7 @@ toolchain go1.21.4
|
|||||||
require (
|
require (
|
||||||
github.com/caarlos0/env/v8 v8.0.0
|
github.com/caarlos0/env/v8 v8.0.0
|
||||||
github.com/go-playground/validator/v10 v10.14.1
|
github.com/go-playground/validator/v10 v10.14.1
|
||||||
|
github.com/gofiber/contrib/fiberzap v1.0.2
|
||||||
github.com/gofiber/fiber/v2 v2.51.0
|
github.com/gofiber/fiber/v2 v2.51.0
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/joho/godotenv v1.5.1
|
||||||
github.com/minio/minio-go/v7 v7.0.56
|
github.com/minio/minio-go/v7 v7.0.56
|
||||||
@ -16,8 +17,7 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/benbjohnson/clock v1.3.0 // indirect
|
github.com/kr/pretty v0.1.0 // indirect
|
||||||
go.uber.org/goleak v1.1.12 // indirect
|
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -45,7 +45,6 @@ require (
|
|||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
|
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/rivo/uniseg v0.4.3 // indirect
|
github.com/rivo/uniseg v0.4.3 // indirect
|
||||||
github.com/rs/xid v1.5.0 // indirect
|
github.com/rs/xid v1.5.0 // indirect
|
||||||
|
17
go.sum
17
go.sum
@ -23,6 +23,8 @@ github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+j
|
|||||||
github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||||
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGiUaOtXxdrINDz1b0J1w0SzqDc=
|
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGiUaOtXxdrINDz1b0J1w0SzqDc=
|
||||||
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1/go.mod h1:A2S0CWkNylc2phvKXWBBdD3K0iGnDBGbzRpISP2zBl8=
|
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1/go.mod h1:A2S0CWkNylc2phvKXWBBdD3K0iGnDBGbzRpISP2zBl8=
|
||||||
|
github.com/gofiber/contrib/fiberzap v1.0.2 h1:EQwhggtszVfIdBeXxN9Xrmld71es34Ufs+ef8VMqZxc=
|
||||||
|
github.com/gofiber/contrib/fiberzap v1.0.2/go.mod h1:jGO8BHU4gRI9U0JtM6zj2CIhYfgVmW5JxziN8NTgVwE=
|
||||||
github.com/gofiber/fiber/v2 v2.51.0 h1:JNACcZy5e2tGApWB2QrRpenTWn0fq0hkFm6k0C86gKQ=
|
github.com/gofiber/fiber/v2 v2.51.0 h1:JNACcZy5e2tGApWB2QrRpenTWn0fq0hkFm6k0C86gKQ=
|
||||||
github.com/gofiber/fiber/v2 v2.51.0/go.mod h1:xaQRZQJGqnKOQnbQw+ltvku3/h8QxvNi8o6JiJ7Ll0U=
|
github.com/gofiber/fiber/v2 v2.51.0/go.mod h1:xaQRZQJGqnKOQnbQw+ltvku3/h8QxvNi8o6JiJ7Ll0U=
|
||||||
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
|
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
|
||||||
@ -105,7 +107,6 @@ github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6
|
|||||||
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
||||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
|
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
|
||||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
|
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
|
||||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk=
|
go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk=
|
||||||
go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo=
|
go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo=
|
||||||
@ -119,34 +120,24 @@ go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95a
|
|||||||
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
|
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
|
||||||
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
|
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
|
||||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/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-20210220032951-036812b2e83c/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.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||||
golang.org/x/sync v0.1.0/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-20190215142949-d0b11bdaac8a/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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
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-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
@ -167,14 +158,10 @@ 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 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
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-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
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-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
@ -2,6 +2,7 @@ package app
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||||
"github.com/minio/minio-go/v7"
|
"github.com/minio/minio-go/v7"
|
||||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
@ -44,7 +45,7 @@ func Run(cfg *config.Config) {
|
|||||||
logger.Fatal("MongoClient", zap.Error(err))
|
logger.Fatal("MongoClient", zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
minioClient, err := minio.New(cfg.S3Endpoint, &minio.Options{
|
minioClient, err := minio.New("localhost:9001", &minio.Options{
|
||||||
Creds: credentials.NewStaticV4(cfg.S3AccessKeyID, cfg.S3SecretKey, ""),
|
Creds: credentials.NewStaticV4(cfg.S3AccessKeyID, cfg.S3SecretKey, ""),
|
||||||
Secure: true,
|
Secure: true,
|
||||||
})
|
})
|
||||||
@ -56,12 +57,18 @@ func Run(cfg *config.Config) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal("Repositories", zap.Error(err))
|
logger.Fatal("Repositories", zap.Error(err))
|
||||||
}
|
}
|
||||||
//tgBot, err := tgbotapi.NewBotAPI(cfg.TelegramToken)
|
|
||||||
//if err != nil {
|
|
||||||
// logger.Fatal("TelegramBotApi", zap.Error(err))
|
|
||||||
//}
|
|
||||||
|
|
||||||
telegram := client.NewTelegram(logger, nil, cfg.TelegramChannelID)
|
tgBot, err := tgbotapi.NewBotAPI(cfg.TelegramToken)
|
||||||
|
if err != nil {
|
||||||
|
logger.Fatal("TelegramBotApi", zap.Error(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
telegram := client.NewTelegram(client.Deps{
|
||||||
|
Logger: logger,
|
||||||
|
Bot: tgBot,
|
||||||
|
ChatID: cfg.TelegramChannelID,
|
||||||
|
StagingURL: cfg.StagingURL,
|
||||||
|
})
|
||||||
cons := initialize.NewControllers(reps, telegram, client.NewCustomer(logger, cfg.CustomerSvcAddress))
|
cons := initialize.NewControllers(reps, telegram, client.NewCustomer(logger, cfg.CustomerSvcAddress))
|
||||||
|
|
||||||
httpSrv := server.NewHTTP(cfg, logger).Register(cons.List()...)
|
httpSrv := server.NewHTTP(cfg, logger).Register(cons.List()...)
|
||||||
|
14
internal/client/assets/new_verification.txt
Normal file
14
internal/client/assets/new_verification.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
New verification:
|
||||||
|
ID: {{ .ID }}
|
||||||
|
UserID: {{ .UserID }}
|
||||||
|
UserURL: {{ .UserURL }}
|
||||||
|
Accepted: {{ .Accepted }}
|
||||||
|
Status: {{ .Status }}
|
||||||
|
UpdatedAt: {{ .UpdatedAt.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
|
||||||
|
Comment: {{ .Comment }}
|
||||||
|
=============================
|
||||||
|
Files
|
||||||
|
=============================
|
||||||
|
{{ range .Files }}
|
||||||
|
Название: {{ .Name }} ({{ .Url }})
|
||||||
|
{{ end }}
|
14
internal/client/assets/updated_verification.txt
Normal file
14
internal/client/assets/updated_verification.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Updated verification:
|
||||||
|
ID: {{ .ID }}
|
||||||
|
UserID: {{ .UserID }}
|
||||||
|
UserURL: {{ .UserURL }}
|
||||||
|
Accepted: {{ .Accepted }}
|
||||||
|
Status: {{ .Status }}
|
||||||
|
UpdatedAt: {{ .UpdatedAt.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
|
||||||
|
Comment: {{ .Comment }}
|
||||||
|
=============================
|
||||||
|
Files
|
||||||
|
=============================
|
||||||
|
{{ range .Files }}
|
||||||
|
Название: {{ .Name }} ({{ .Url }})
|
||||||
|
{{ end }}
|
@ -18,7 +18,6 @@ func NewCustomer(logger *zap.Logger, address string) *Customer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Customer) UpdateAccountVerification(userId, status string) (*models.RespUpdateVerificationStatus, error) {
|
func (c *Customer) UpdateAccountVerification(userId, status string) (*models.RespUpdateVerificationStatus, error) {
|
||||||
fmt.Println(c.address)
|
|
||||||
agent := fiber.Patch(fmt.Sprintf("%s/account/%s", c.address, userId))
|
agent := fiber.Patch(fmt.Sprintf("%s/account/%s", c.address, userId))
|
||||||
agent.JSON(&models.ReqCreateVerification{Status: status})
|
agent.JSON(&models.ReqCreateVerification{Status: status})
|
||||||
|
|
||||||
|
@ -2,48 +2,82 @@ package client
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
_ "embed"
|
||||||
|
"fmt"
|
||||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/verification/internal/models"
|
"penahub.gitlab.yandexcloud.net/backend/verification/internal/models"
|
||||||
"text/template"
|
"text/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed assets/new_verification.txt
|
||||||
|
var NewVerification string
|
||||||
|
|
||||||
|
//go:embed assets/updated_verification.txt
|
||||||
|
var UpdatedVerification string
|
||||||
|
|
||||||
|
type Deps struct {
|
||||||
|
Logger *zap.Logger
|
||||||
|
Bot *tgbotapi.BotAPI
|
||||||
|
ChatID int64
|
||||||
|
StagingURL string
|
||||||
|
}
|
||||||
|
|
||||||
type Telegram struct {
|
type Telegram struct {
|
||||||
logger *zap.Logger
|
logger *zap.Logger
|
||||||
bot *tgbotapi.BotAPI
|
bot *tgbotapi.BotAPI
|
||||||
chatID int64
|
chatID int64
|
||||||
|
stagingURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTelegram(logger *zap.Logger, bot *tgbotapi.BotAPI, chatID int64) *Telegram {
|
func NewTelegram(deps Deps) *Telegram {
|
||||||
return &Telegram{logger: logger, bot: bot, chatID: chatID}
|
return &Telegram{logger: deps.Logger, bot: deps.Bot, chatID: deps.ChatID, stagingURL: deps.StagingURL}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Telegram) SendVerification(data *models.Verification, isUpdate bool) error {
|
func (t *Telegram) SendVerification(data *models.Verification, url string, isUpdate bool) error {
|
||||||
tplPath := "assets/new_verification.txt"
|
var tplPath string
|
||||||
|
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
tplPath = "assets/updated_verification.txt"
|
tplPath = UpdatedVerification
|
||||||
|
} else {
|
||||||
|
tplPath = NewVerification
|
||||||
}
|
}
|
||||||
|
|
||||||
tpl, err := template.ParseFiles(tplPath)
|
var userURL string
|
||||||
|
if url == t.stagingURL {
|
||||||
|
userURL = fmt.Sprintf("https://sadmin.pena/users/%s", data.UserID)
|
||||||
|
} else {
|
||||||
|
userURL = fmt.Sprintf("https://admin.pena/users/%s", data.UserID)
|
||||||
|
}
|
||||||
|
|
||||||
|
tpl, err := template.New("verification_template").Parse(tplPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("error parsing template: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var text bytes.Buffer
|
var text bytes.Buffer
|
||||||
|
|
||||||
err = tpl.Execute(&text, data)
|
toTG := models.ToTelegram{
|
||||||
|
ID: data.ID,
|
||||||
|
UserID: data.UserID,
|
||||||
|
UserURL: userURL,
|
||||||
|
Accepted: data.Accepted,
|
||||||
|
Status: data.Status,
|
||||||
|
UpdatedAt: data.UpdatedAt,
|
||||||
|
Comment: data.Comment,
|
||||||
|
Files: data.Files,
|
||||||
|
TaxNumber: data.TaxNumber,
|
||||||
|
}
|
||||||
|
|
||||||
|
err = tpl.Execute(&text, toTG)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.logger.Error("ClientTelegram", zap.Error(err))
|
return fmt.Errorf("error executing template: %w", err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := tgbotapi.NewMessage(t.chatID, text.String())
|
msg := tgbotapi.NewMessage(t.chatID, text.String())
|
||||||
|
|
||||||
_, err = t.bot.Send(msg)
|
_, err = t.bot.Send(msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.logger.Error("ClientTelegram", zap.Error(err))
|
return fmt.Errorf("error sending message: %w", err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
70
internal/client/telegram_test.go
Normal file
70
internal/client/telegram_test.go
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
"penahub.gitlab.yandexcloud.net/backend/verification/internal/models"
|
||||||
|
"testing"
|
||||||
|
"text/template"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestTelegram_SendVerification(t *testing.T) {
|
||||||
|
logger, _ := zap.NewDevelopment()
|
||||||
|
bot, _ := tgbotapi.NewBotAPI("6712573453:AAFddRtlsF4ZH977xZDexWj6DhqeJD66hYw")
|
||||||
|
chatID := int64(542073142)
|
||||||
|
|
||||||
|
client := NewTelegram(Deps{Logger: logger, Bot: bot, ChatID: chatID, StagingURL: "https://sadmin.pena"})
|
||||||
|
|
||||||
|
t.Run("SendVerification-success", func(t *testing.T) {
|
||||||
|
data := &models.Verification{
|
||||||
|
ID: "641b2d73e0e07a7e90b59616",
|
||||||
|
UserID: "test-user",
|
||||||
|
Accepted: false,
|
||||||
|
Status: "nko",
|
||||||
|
UpdatedAt: time.Now(),
|
||||||
|
Comment: "test",
|
||||||
|
Files: []models.VerificationFile{
|
||||||
|
{Name: "file1.txt", Url: "http://test.com/file1.txt"},
|
||||||
|
{Name: "file2.txt", Url: "http://test.com/file2.txt"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
isUpdate := false
|
||||||
|
|
||||||
|
tpl := template.Must(template.New("verification").Parse("Verification: {{.UserID}}"))
|
||||||
|
var text bytes.Buffer
|
||||||
|
err := tpl.Execute(&text, data)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
err = client.SendVerification(data, "https://admin.pena", isUpdate)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("SendVerification-success", func(t *testing.T) {
|
||||||
|
data := &models.Verification{
|
||||||
|
ID: "641b2d73e0e07a7e90b59616",
|
||||||
|
UserID: "test-user",
|
||||||
|
Accepted: false,
|
||||||
|
Status: "nko",
|
||||||
|
UpdatedAt: time.Now(),
|
||||||
|
Comment: "test",
|
||||||
|
Files: []models.VerificationFile{
|
||||||
|
{Name: "file1.txt", Url: "http://test.com/file1.txt"},
|
||||||
|
{Name: "file2.txt", Url: "http://test.com/file2.txt"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
isUpdate := true
|
||||||
|
|
||||||
|
tpl := template.Must(template.New("verification").Parse("Verification: {{.UserID}}"))
|
||||||
|
var text bytes.Buffer
|
||||||
|
err := tpl.Execute(&text, data)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
err = client.SendVerification(data, "https://sadmin.pena", isUpdate)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
})
|
||||||
|
}
|
@ -19,6 +19,7 @@ type Config struct {
|
|||||||
S3AccessKeyID string `env:"S3_ACCESS_KEY_ID,required"`
|
S3AccessKeyID string `env:"S3_ACCESS_KEY_ID,required"`
|
||||||
S3SecretKey string `env:"S3_SECRET_KEY,required"`
|
S3SecretKey string `env:"S3_SECRET_KEY,required"`
|
||||||
CustomerSvcAddress string `env:"CUSTOMER_SVC_ADDRESS,required"`
|
CustomerSvcAddress string `env:"CUSTOMER_SVC_ADDRESS,required"`
|
||||||
|
StagingURL string `env:"STAGING_URL,required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfig(file ...string) (*Config, error) {
|
func NewConfig(file ...string) (*Config, error) {
|
||||||
|
@ -2,7 +2,6 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
@ -57,6 +56,7 @@ func (r *VerificationController) CreateVerification(c *fiber.Ctx) error {
|
|||||||
var req models.ReqCreateVerification
|
var req models.ReqCreateVerification
|
||||||
|
|
||||||
userID := c.Params("userID")
|
userID := c.Params("userID")
|
||||||
|
baseURL := c.BaseURL()
|
||||||
|
|
||||||
if userID == "" {
|
if userID == "" {
|
||||||
userID = c.Locals("userID").(string)
|
userID = c.Locals("userID").(string)
|
||||||
@ -117,7 +117,7 @@ func (r *VerificationController) CreateVerification(c *fiber.Ctx) error {
|
|||||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
err = r.telegram.SendVerification(result, false)
|
err = r.telegram.SendVerification(result, baseURL, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||||
}
|
}
|
||||||
@ -132,7 +132,6 @@ func (r *VerificationController) SetVerificationStatus(c *fiber.Ctx) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||||
}
|
}
|
||||||
fmt.Println(req)
|
|
||||||
errValidate := validateStruct(&req)
|
errValidate := validateStruct(&req)
|
||||||
if errValidate != nil {
|
if errValidate != nil {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(errValidate)
|
return c.Status(fiber.StatusBadRequest).JSON(errValidate)
|
||||||
@ -146,8 +145,6 @@ func (r *VerificationController) SetVerificationStatus(c *fiber.Ctx) error {
|
|||||||
TaxNumber: req.TaxNumber,
|
TaxNumber: req.TaxNumber,
|
||||||
})
|
})
|
||||||
|
|
||||||
fmt.Println("repository.Update")
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||||
}
|
}
|
||||||
@ -164,6 +161,7 @@ func (r *VerificationController) SetVerificationStatus(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
func (r *VerificationController) SetVerificationFile(c *fiber.Ctx) error {
|
func (r *VerificationController) SetVerificationFile(c *fiber.Ctx) error {
|
||||||
userID := c.Params("userID")
|
userID := c.Params("userID")
|
||||||
|
baseURL := c.BaseURL()
|
||||||
|
|
||||||
if userID == "" {
|
if userID == "" {
|
||||||
userID = c.Locals("userID").(string)
|
userID = c.Locals("userID").(string)
|
||||||
@ -194,7 +192,7 @@ func (r *VerificationController) SetVerificationFile(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = r.telegram.SendVerification(result, true)
|
err = r.telegram.SendVerification(result, baseURL, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||||
}
|
}
|
||||||
|
15
internal/models/telegram.go
Normal file
15
internal/models/telegram.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type ToTelegram struct {
|
||||||
|
ID string
|
||||||
|
UserID string
|
||||||
|
UserURL string
|
||||||
|
Accepted bool
|
||||||
|
Status string
|
||||||
|
UpdatedAt time.Time
|
||||||
|
Comment string
|
||||||
|
Files []VerificationFile
|
||||||
|
TaxNumber string
|
||||||
|
}
|
@ -19,7 +19,6 @@ type VerificationFile struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type VerificationUpdate struct {
|
type VerificationUpdate struct {
|
||||||
UserID string `json:"userID" bson:"user_id,omitempty"`
|
|
||||||
Accepted bool `json:"accepted" bson:"accepted"`
|
Accepted bool `json:"accepted" bson:"accepted"`
|
||||||
Status string `json:"status" bson:"status,omitempty"`
|
Status string `json:"status" bson:"status,omitempty"`
|
||||||
UpdatedAt time.Time `json:"updated_at" bson:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at" bson:"updated_at"`
|
||||||
|
@ -2,8 +2,11 @@ package repository
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/minio/minio-go/v7/pkg/policy"
|
||||||
|
"github.com/minio/minio-go/v7/pkg/set"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -38,67 +41,67 @@ func NewVerificationRepository(logger *zap.Logger, mongoDb *mongo.Database, s3 *
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *VerificationRepository) Init(ctx context.Context) error {
|
func (r *VerificationRepository) Init(ctx context.Context) error {
|
||||||
//ok, err := r.s3.BucketExists(ctx, VerificationBucket)
|
ok, err := r.s3.BucketExists(ctx, VerificationBucket)
|
||||||
//if r.err(err) {
|
if r.err(err) {
|
||||||
// return err
|
return err
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//if !ok {
|
if !ok {
|
||||||
// err = r.s3.MakeBucket(ctx, VerificationBucket, minio.MakeBucketOptions{ObjectLocking: false})
|
err = r.s3.MakeBucket(ctx, VerificationBucket, minio.MakeBucketOptions{ObjectLocking: false})
|
||||||
// if r.err(err) {
|
if r.err(err) {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// policyConsoleStatement := policy.Statement{
|
policyConsoleStatement := policy.Statement{
|
||||||
// Actions: set.CreateStringSet("*"),
|
Actions: set.CreateStringSet("*"),
|
||||||
// Conditions: policy.ConditionMap{
|
Conditions: policy.ConditionMap{
|
||||||
// "StringLike": policy.ConditionKeyMap{
|
"StringLike": policy.ConditionKeyMap{
|
||||||
// "aws:referer": set.CreateStringSet(fmt.Sprintf("https://console.cloud.yandex.*/folders/*/storage/buckets/%s*", VerificationBucket)),
|
"aws:referer": set.CreateStringSet(fmt.Sprintf("https://console.cloud.yandex.*/folders/*/storage/buckets/%s*", VerificationBucket)),
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// Effect: "Allow",
|
Effect: "Allow",
|
||||||
// Principal: policy.User{AWS: set.CreateStringSet("*")},
|
Principal: policy.User{AWS: set.CreateStringSet("*")},
|
||||||
// Resources: set.CreateStringSet(fmt.Sprintf("arn:aws:s3:::%s/*", VerificationBucket),
|
Resources: set.CreateStringSet(fmt.Sprintf("arn:aws:s3:::%s/*", VerificationBucket),
|
||||||
// fmt.Sprintf("arn:aws:s3:::%s", VerificationBucket)),
|
fmt.Sprintf("arn:aws:s3:::%s", VerificationBucket)),
|
||||||
// Sid: "console-statement",
|
Sid: "console-statement",
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// policyServiceAccount := policy.Statement{
|
policyServiceAccount := policy.Statement{
|
||||||
// Actions: set.CreateStringSet("*"),
|
Actions: set.CreateStringSet("*"),
|
||||||
// Conditions: nil,
|
Conditions: nil,
|
||||||
// Effect: "Allow",
|
Effect: "Allow",
|
||||||
// Principal: policy.User{CanonicalUser: set.CreateStringSet("ajelmc4tjbct675tjdh9")},
|
Principal: policy.User{CanonicalUser: set.CreateStringSet("ajelmc4tjbct675tjdh9")},
|
||||||
// Resources: set.CreateStringSet(fmt.Sprintf("arn:aws:s3:::%s/*", VerificationBucket),
|
Resources: set.CreateStringSet(fmt.Sprintf("arn:aws:s3:::%s/*", VerificationBucket),
|
||||||
// fmt.Sprintf("arn:aws:s3:::%s", VerificationBucket)),
|
fmt.Sprintf("arn:aws:s3:::%s", VerificationBucket)),
|
||||||
// Sid: "service-account-statement",
|
Sid: "service-account-statement",
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// policySharingBucket := policy.Statement{
|
policySharingBucket := policy.Statement{
|
||||||
// Actions: set.CreateStringSet("s3:GetObject"),
|
Actions: set.CreateStringSet("s3:GetObject"),
|
||||||
// Conditions: nil,
|
Conditions: nil,
|
||||||
// Effect: "Allow",
|
Effect: "Allow",
|
||||||
// Principal: policy.User{AWS: set.CreateStringSet("*")},
|
Principal: policy.User{AWS: set.CreateStringSet("*")},
|
||||||
// Resources: set.CreateStringSet(fmt.Sprintf("arn:aws:s3:::%s/*", VerificationBucket),
|
Resources: set.CreateStringSet(fmt.Sprintf("arn:aws:s3:::%s/*", VerificationBucket),
|
||||||
// fmt.Sprintf("arn:aws:s3:::%s", VerificationBucket)),
|
fmt.Sprintf("arn:aws:s3:::%s", VerificationBucket)),
|
||||||
// Sid: "sharing-bucket",
|
Sid: "sharing-bucket",
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// p := policy.BucketAccessPolicy{Version: "2012-10-17", Statements: []policy.Statement{
|
p := policy.BucketAccessPolicy{Version: "2012-10-17", Statements: []policy.Statement{
|
||||||
// policyConsoleStatement,
|
policyConsoleStatement,
|
||||||
// policyServiceAccount,
|
policyServiceAccount,
|
||||||
// policySharingBucket,
|
policySharingBucket,
|
||||||
// }}
|
}}
|
||||||
//
|
|
||||||
// outPolicy, err := json.Marshal(&p)
|
outPolicy, err := json.Marshal(&p)
|
||||||
// if r.err(err) {
|
if r.err(err) {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// err = r.s3.SetBucketPolicy(ctx, VerificationBucket, string(outPolicy))
|
err = r.s3.SetBucketPolicy(ctx, VerificationBucket, string(outPolicy))
|
||||||
// if r.err(err) {
|
if r.err(err) {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -244,10 +247,9 @@ func (r *VerificationRepository) Update(ctx context.Context, record *models.Veri
|
|||||||
record.UpdatedAt = time.Now()
|
record.UpdatedAt = time.Now()
|
||||||
|
|
||||||
test := models.VerificationUpdate{
|
test := models.VerificationUpdate{
|
||||||
UserID: record.UserID,
|
|
||||||
Accepted: record.Accepted,
|
Accepted: record.Accepted,
|
||||||
Status: record.Status,
|
Status: record.Status,
|
||||||
UpdatedAt: record.UpdatedAt,
|
UpdatedAt: time.Now(),
|
||||||
Comment: record.Comment,
|
Comment: record.Comment,
|
||||||
Files: record.Files,
|
Files: record.Files,
|
||||||
TaxNumber: record.TaxNumber,
|
TaxNumber: record.TaxNumber,
|
||||||
@ -258,7 +260,6 @@ func (r *VerificationRepository) Update(ctx context.Context, record *models.Veri
|
|||||||
var result models.Verification
|
var result models.Verification
|
||||||
err := r.mongo.FindOneAndUpdate(ctx, bson.M{"_id": objId}, bson.M{"$set": test}, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(&result)
|
err := r.mongo.FindOneAndUpdate(ctx, bson.M{"_id": objId}, bson.M{"$set": test}, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(&result)
|
||||||
if r.err(err) {
|
if r.err(err) {
|
||||||
fmt.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &result, nil
|
return &result, nil
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/gofiber/contrib/fiberzap"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
|
"github.com/gofiber/fiber/v2/middleware/recover"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/verification/internal/config"
|
"penahub.gitlab.yandexcloud.net/backend/verification/internal/config"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/verification/internal/initialize"
|
"penahub.gitlab.yandexcloud.net/backend/verification/internal/initialize"
|
||||||
@ -20,12 +22,12 @@ func NewHTTP(cfg *config.Config, logger *zap.Logger) *HTTP {
|
|||||||
BodyLimit: 50 << 20,
|
BodyLimit: 50 << 20,
|
||||||
})
|
})
|
||||||
|
|
||||||
//srv.Use(
|
srv.Use(
|
||||||
// recover.New(recover.Config{EnableStackTrace: true}),
|
recover.New(recover.Config{EnableStackTrace: true}),
|
||||||
// fiberzap.New(fiberzap.Config{Logger: logger}),
|
fiberzap.New(fiberzap.Config{Logger: logger}),
|
||||||
// LocalJwt(),
|
LocalJwt(),
|
||||||
// Jwt(),
|
Jwt(),
|
||||||
//)
|
)
|
||||||
|
|
||||||
return &HTTP{fiber: srv, cfg: cfg, logger: logger}
|
return &HTTP{fiber: srv, cfg: cfg, logger: logger}
|
||||||
}
|
}
|
||||||
|
18
staging.env
18
staging.env
@ -1,14 +1,4 @@
|
|||||||
HTTP_ADDRESS=:8080
|
MONGO_DATABASE_NAME=verification
|
||||||
CUSTOMER_SVC_ADDRESS=http://localhost:8003
|
HTTP_ADDRESS=:7035
|
||||||
S3_SECRET_KEY=1
|
CUSTOMER_SVC_ADDRESS=https://admin.pena.digital/customer
|
||||||
S3_ACCESS_KEY_ID=1
|
STAGING_URL=https://sadmin.pena
|
||||||
S3_ENDPOINT=1
|
|
||||||
TELEGRAM_CHANNEL_ID=1
|
|
||||||
TELEGRAM_TOKEN=1
|
|
||||||
|
|
||||||
MONGO_HOST=localhost
|
|
||||||
MONGO_PORT=27020
|
|
||||||
MONGO_USER=test
|
|
||||||
MONGO_PASSWORD=test
|
|
||||||
MONGO_AUTH=admin
|
|
||||||
MONGO_DATABASE_NAME=admin
|
|
Loading…
Reference in New Issue
Block a user