Merge branch 'staging'
This commit is contained in:
commit
2235bde2bb
106
README.md
106
README.md
@ -1,92 +1,28 @@
|
||||
# verification
|
||||
|
||||
Это сервис предоставляющий логику верификации пользователя. Он предоставляет следующие возможности:
|
||||
|
||||
Для клиента:
|
||||
- Сделать запрос верификации с указанием статуса, который пользователь желает приобрести и сохранением файлов, необходимых для верификации
|
||||
- Заменить один или несколько файлов, в случае ошибки
|
||||
- Получить текущий статус верификации
|
||||
|
||||
## Getting started
|
||||
Для админа:
|
||||
- Каждая поданная верификация должна вызвать оповещение админов в канале в телеграмме
|
||||
- Админ имеет возможность отклонить или подтвердить верификацию пользователя с добавлением комментария
|
||||
- При подтверждении верификации, сервис оповещает customer сервис о том, что верификация пройдена этим пользователем и запрощенный статус одобрен
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
## Сценарий работы
|
||||
|
||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||
Для уточнения сценария введу понятие актора(действующего лица). в данной ситуации акторов будет 3: (К)лиент, (А)дмин, (С)ервис
|
||||
|
||||
## Add your files
|
||||
|
||||
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
||||
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
||||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin https://penahub.gitlab.yandexcloud.net/backend/verification.git
|
||||
git branch -M main
|
||||
git push -uf origin main
|
||||
```
|
||||
|
||||
## Integrate with your tools
|
||||
|
||||
- [ ] [Set up project integrations](https://penahub.gitlab.yandexcloud.net/backend/verification/-/settings/integrations)
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
||||
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
||||
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
||||
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
||||
|
||||
## Test and Deploy
|
||||
|
||||
Use the built-in continuous integration in GitLab.
|
||||
|
||||
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
||||
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
||||
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
||||
|
||||
***
|
||||
|
||||
# Editing this README
|
||||
|
||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||
|
||||
## Suggestions for a good README
|
||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||
|
||||
## Name
|
||||
Choose a self-explaining name for your project.
|
||||
|
||||
## Description
|
||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||
|
||||
## Badges
|
||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||
|
||||
## Visuals
|
||||
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
||||
|
||||
## Installation
|
||||
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
||||
|
||||
## Usage
|
||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||
|
||||
## Support
|
||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||
|
||||
## Roadmap
|
||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||
|
||||
## Contributing
|
||||
State if you are open to contributions and what your requirements are for accepting them.
|
||||
|
||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||
|
||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||
|
||||
## Authors and acknowledgment
|
||||
Show your appreciation to those who have contributed to the project.
|
||||
|
||||
## License
|
||||
For open source projects, say how it is licensed.
|
||||
|
||||
## Project status
|
||||
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
||||
- (К): заходит в профиль на shub.pena.digital или hub.pena.digital
|
||||
- (К): получает текущий статус верификации - 404, потому что ещё не подавал заявку
|
||||
- (К): подаёт заявку на получение статуса НКО или Юр Лица, отправляя набор файлов через форму
|
||||
- (С): отправляет в телеграм сообщение админам, что получена новая заявка на верификацию
|
||||
- (А): отсматривает файлы и отклоняет по какой-либо причине, комментируя её
|
||||
- (К): исправляет неудволетворяющие админов файлы
|
||||
- (С): отправляет в телеграм сообщение админам, что юзер исправил файлы в заявке
|
||||
- (А): проверяет снова набор файлов и подтверждает верификацию
|
||||
- (С): оповещает customer сервис о новом статусе этого пользователя. чисто, чтобы лишние запросы на сервис верификации не делать
|
||||
- (К): видит в профиле статус что он верифицирован
|
||||
|
@ -1,6 +1,7 @@
|
||||
New verification:
|
||||
ID: {{ .ID }}
|
||||
UserID: {{ .UserID }}
|
||||
UserURL: {{ .UserURL }}
|
||||
Accepted: {{ .Accepted }}
|
||||
Status: {{ .Status }}
|
||||
UpdatedAt: {{ .UpdatedAt.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
|
||||
|
@ -1,6 +1,7 @@
|
||||
Updated verification:
|
||||
ID: {{ .ID }}
|
||||
UserID: {{ .UserID }}
|
||||
UserURL: {{ .UserURL }}
|
||||
Accepted: {{ .Accepted }}
|
||||
Status: {{ .Status }}
|
||||
UpdatedAt: {{ .UpdatedAt.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
|
||||
|
@ -10,10 +10,19 @@ services:
|
||||
MONGO_URI: mongodb://$MONGO_USER-prod:$MONGO_PASSWORD@10.8.0.8:27017/?authSource=verification
|
||||
PENADISK_URL: $PENADISK_URL
|
||||
TELEGRAM_TOKEN: $TELEGRAM_TOKEN
|
||||
TELEGRAM_CHANNEL_ID: $TELEGRAM_CHANNEL_ID
|
||||
TELEGRAM_CHANNEL_ID: -1001940097056
|
||||
S3_ENDPOINT: $S3_ENDPOINT
|
||||
S3_ACCESS_KEY_ID: $S3_ACCESS_KEY_ID
|
||||
S3_SECRET_KEY: $S3_SECRET_KEY
|
||||
JWT_SECRET: $JWT_SECRET
|
||||
HTTP_ADDRESS: ":7035"
|
||||
MONGO_HOST: "10.8.0.8"
|
||||
MONGO_PORT: "27017"
|
||||
MONGO_USER: $MONGO_USER-prod
|
||||
MONGO_PASSWORD: $MONGO_PASSWORD
|
||||
MONGO_AUTH: "verification"
|
||||
MONGO_DATABASE_NAME: "verification"
|
||||
CUSTOMER_SVC_ADDRESS: "http://10.8.0.8:8065"
|
||||
STAGING_URL: "https://admin.pena"
|
||||
|
||||
tty: true
|
||||
|
@ -15,5 +15,14 @@ services:
|
||||
S3_ACCESS_KEY_ID: $S3_ACCESS_KEY_ID
|
||||
S3_SECRET_KEY: $S3_SECRET_KEY
|
||||
JWT_SECRET: $JWT_SECRET
|
||||
HTTP_ADDRESS: ":7035"
|
||||
MONGO_HOST: "10.6.0.11"
|
||||
MONGO_PORT: "27017"
|
||||
MONGO_USER: $MONGO_USER
|
||||
MONGO_PASSWORD: $MONGO_PASSWORD
|
||||
MONGO_AUTH: "verification"
|
||||
MONGO_DATABASE_NAME: "verification"
|
||||
CUSTOMER_SVC_ADDRESS: "http://10.8.0.6:8065"
|
||||
STAGING_URL: "https://sadmin.pena"
|
||||
|
||||
tty: true
|
||||
|
15
deployments/test/docker-compose.yaml
Normal file
15
deployments/test/docker-compose.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
mongo:
|
||||
image: mongo
|
||||
ports:
|
||||
- "27020:27017"
|
||||
environment:
|
||||
- MONGO_INITDB_ROOT_USERNAME=test
|
||||
- MONGO_INITDB_ROOT_PASSWORD=test
|
||||
volumes:
|
||||
- mongo_data:/data/db
|
||||
|
||||
volumes:
|
||||
mongo_data:
|
36
go.mod
36
go.mod
@ -1,17 +1,24 @@
|
||||
module penahub.gitlab.yandexcloud.net/backend/verification
|
||||
|
||||
go 1.19
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.4
|
||||
|
||||
require (
|
||||
github.com/caarlos0/env/v8 v8.0.0
|
||||
github.com/go-playground/validator/v10 v10.14.1
|
||||
github.com/gofiber/contrib/fiberzap v1.0.2
|
||||
github.com/gofiber/fiber/v2 v2.46.0
|
||||
github.com/gofiber/fiber/v2 v2.51.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/minio/minio-go/v7 v7.0.56
|
||||
go.mongodb.org/mongo-driver v1.11.7
|
||||
go.mongodb.org/mongo-driver v1.13.1
|
||||
go.uber.org/zap v1.24.0
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20230712221540-d9932eb7254e
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20240202120244-c4ef330cfe5d
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/kr/pretty v0.1.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
@ -25,42 +32,37 @@ require (
|
||||
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
|
||||
github.com/golang/snappy v0.0.1 // indirect
|
||||
github.com/google/go-cmp v0.5.8 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/google/uuid v1.4.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.16.5 // indirect
|
||||
github.com/klauspost/compress v1.16.7 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.18 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
|
||||
github.com/philhofer/fwd v1.1.2 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rivo/uniseg v0.4.3 // indirect
|
||||
github.com/rs/xid v1.5.0 // indirect
|
||||
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 // indirect
|
||||
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee // indirect
|
||||
github.com/sirupsen/logrus v1.9.2 // indirect
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/tinylib/msgp v1.1.8 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.47.0 // indirect
|
||||
github.com/valyala/fasthttp v1.50.0
|
||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
github.com/xdg-go/scram v1.1.1 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.3 // indirect
|
||||
github.com/xdg-go/scram v1.1.2 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
||||
go.uber.org/atomic v1.10.0 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/sys v0.14.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
88
go.sum
88
go.sum
@ -1,6 +1,7 @@
|
||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
||||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
|
||||
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/caarlos0/env/v8 v8.0.0 h1:POhxHhSpuxrLMIdvTGARuZqR4Jjm8AYmoi/JKlcScs0=
|
||||
github.com/caarlos0/env/v8 v8.0.0/go.mod h1:7K4wMY9bH0esiXSSHlfHLX5xKGQMnkH5Fk4TDSSSzfo=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@ -13,6 +14,7 @@ github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+m
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
@ -23,23 +25,23 @@ github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGi
|
||||
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.46.0 h1:wkkWotblsGVlLjXj2dpgKQAYHtXumsK/HyFugQM68Ns=
|
||||
github.com/gofiber/fiber/v2 v2.46.0/go.mod h1:DNl0/c37WLe0g92U6lx1VMQuxGUQY5V7EIaVoEsUffc=
|
||||
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/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.5.2/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/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
||||
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=
|
||||
github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
|
||||
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||
@ -53,10 +55,10 @@ github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNa
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
|
||||
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
|
||||
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
|
||||
github.com/minio/minio-go/v7 v7.0.56 h1:pkZplIEHu8vinjkmhsexcXpWth2tjVLphrTZx6fBVZY=
|
||||
@ -70,9 +72,6 @@ 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/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
|
||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
|
||||
github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
||||
github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw=
|
||||
github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
@ -82,83 +81,61 @@ github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
|
||||
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
|
||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 h1:rmMl4fXJhKMNWl+K+r/fq4FbbKI+Ia2m9hYBLm2h4G4=
|
||||
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3D/WJsDd1iXHT96alCoN2KJo6/4x1DZC3wZs8=
|
||||
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4=
|
||||
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk=
|
||||
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
|
||||
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
|
||||
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw=
|
||||
github.com/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0=
|
||||
github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasthttp v1.47.0 h1:y7moDoxYzMooFpT5aHgNgVOQDrS3qlkfiP9mDtGGK9c=
|
||||
github.com/valyala/fasthttp v1.47.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
|
||||
github.com/valyala/fasthttp v1.50.0 h1:H7fweIlBm0rXLs2q0XbalvJ6r0CUPFWK3/bB4N13e9M=
|
||||
github.com/valyala/fasthttp v1.50.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
|
||||
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
||||
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=
|
||||
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
|
||||
github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs=
|
||||
github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
|
||||
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
||||
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
|
||||
github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
|
||||
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/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.mongodb.org/mongo-driver v1.11.7 h1:LIwYxASDLGUg/8wOhgOOZhX8tQa/9tgZPgzZoVqJvcs=
|
||||
go.mongodb.org/mongo-driver v1.11.7/go.mod h1:G9TgswdsWjX4tmDA5zfs2+6AEPpYJwqblyjsfuh8oXY=
|
||||
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.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
|
||||
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
|
||||
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
||||
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
|
||||
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
|
||||
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
|
||||
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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
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.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||
golang.org/x/mod v0.3.0/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.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
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-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
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.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||
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-20201020160332-67f06af15bc9/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.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/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=
|
||||
@ -167,29 +144,24 @@ golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
|
||||
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
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.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
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.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
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-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
|
||||
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-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 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
@ -199,11 +171,5 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20230222172022-007eb6fd0b1f h1:/ACy953BoX+0T8nizgukSZe/+seDvLne0zJC2lAa4EU=
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20230222172022-007eb6fd0b1f/go.mod h1:SCqfOb+FHQayOQcxHQKd52Az4sur3hr3Lx1I4UiLf6g=
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20230712182951-a3a952308eb7 h1:sTqoCHA1gbdw8zMhsdMmXWhXL70TQo/QCJru3cKx7dk=
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20230712182951-a3a952308eb7/go.mod h1:SCqfOb+FHQayOQcxHQKd52Az4sur3hr3Lx1I4UiLf6g=
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20230712192820-6f8eaba30d36 h1:TAXuyqAvncxDSUS9AHfs/2b5cHEqoIFGiDxdSR0lG+Q=
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20230712192820-6f8eaba30d36/go.mod h1:SCqfOb+FHQayOQcxHQKd52Az4sur3hr3Lx1I4UiLf6g=
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20230712221540-d9932eb7254e h1:nZLUtqm+u3Tf339bioyyaUsxV10RSqKeukVa52H/+DQ=
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20230712221540-d9932eb7254e/go.mod h1:SCqfOb+FHQayOQcxHQKd52Az4sur3hr3Lx1I4UiLf6g=
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20240202120244-c4ef330cfe5d h1:gbaDt35HMDqOK84WYmDIlXMI7rstUcRqNttaT6Kx1do=
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20240202120244-c4ef330cfe5d/go.mod h1:lTmpjry+8evVkXWbEC+WMOELcFkRD1lFMc7J09mOndM=
|
||||
|
@ -5,14 +5,14 @@ import (
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
mongo "penahub.gitlab.yandexcloud.net/backend/penahub_common/mongo"
|
||||
"penahub.gitlab.yandexcloud.net/backend/verification/internal/client"
|
||||
"penahub.gitlab.yandexcloud.net/backend/verification/internal/config"
|
||||
"penahub.gitlab.yandexcloud.net/backend/verification/internal/initialize"
|
||||
"penahub.gitlab.yandexcloud.net/backend/verification/internal/server"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Run(cfg *config.Config) {
|
||||
@ -29,7 +29,18 @@ func Run(cfg *config.Config) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
mongoClient, err := mongo.Connect(ctx, options.Client().ApplyURI(cfg.MongoUri))
|
||||
mongoDB, err := mongo.Connect(ctx, &mongo.ConnectDeps{
|
||||
Configuration: &mongo.Configuration{
|
||||
Host: cfg.MongoHost,
|
||||
Port: cfg.MongoPort,
|
||||
User: cfg.MongoUser,
|
||||
Password: cfg.MongoPassword,
|
||||
Auth: cfg.MongoAuth,
|
||||
DatabaseName: cfg.DatabaseName,
|
||||
},
|
||||
Timeout: 5 * time.Second,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal("MongoClient", zap.Error(err))
|
||||
}
|
||||
@ -42,16 +53,22 @@ func Run(cfg *config.Config) {
|
||||
logger.Fatal("MinioClient", zap.Error(err))
|
||||
}
|
||||
|
||||
reps, err := initialize.NewRepositories(ctx, logger, mongoClient, cfg.DatabaseName, minioClient)
|
||||
reps, err := initialize.NewRepositories(ctx, logger, mongoDB, minioClient)
|
||||
if err != nil {
|
||||
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, tgBot, cfg.TelegramChannelID)
|
||||
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))
|
||||
|
||||
httpSrv := server.NewHTTP(cfg, logger).Register(cons.List()...)
|
||||
@ -63,5 +80,5 @@ func Run(cfg *config.Config) {
|
||||
}
|
||||
}()
|
||||
|
||||
gracefulShutdown(ctx, logger, httpSrv, mongoClient)
|
||||
gracefulShutdown(ctx, logger, httpSrv, mongoDB)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func gracefulShutdown(ctx context.Context, logger *zap.Logger, httpSrv *server.HTTP, mongoClient *mongo.Client) {
|
||||
func gracefulShutdown(ctx context.Context, logger *zap.Logger, httpSrv *server.HTTP, mongoDB *mongo.Database) {
|
||||
interrupt := make(chan os.Signal, 1)
|
||||
signal.Notify(interrupt, os.Interrupt, syscall.SIGTERM)
|
||||
killSignal := <-interrupt
|
||||
@ -25,7 +25,7 @@ func gracefulShutdown(ctx context.Context, logger *zap.Logger, httpSrv *server.H
|
||||
logger.Error("HttpServerShutdown", zap.Error(err))
|
||||
}
|
||||
|
||||
if err := mongoClient.Disconnect(ctx); err != nil {
|
||||
if err := mongoDB.Client().Disconnect(ctx); err != nil {
|
||||
logger.Error("MongoDB", zap.Error(err))
|
||||
}
|
||||
|
||||
|
1
internal/client/assets/new_verification.txt
Normal file
1
internal/client/assets/new_verification.txt
Normal file
@ -0,0 +1 @@
|
||||
Пользователь {{ .UserURL }} подал запрос на верификацию
|
1
internal/client/assets/updated_verification.txt
Normal file
1
internal/client/assets/updated_verification.txt
Normal file
@ -0,0 +1 @@
|
||||
Пользователь {{ .UserURL }} подал запрос на верификацию
|
@ -2,48 +2,84 @@ package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
"go.uber.org/zap"
|
||||
"penahub.gitlab.yandexcloud.net/backend/verification/internal/models"
|
||||
"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 {
|
||||
logger *zap.Logger
|
||||
bot *tgbotapi.BotAPI
|
||||
chatID int64
|
||||
logger *zap.Logger
|
||||
bot *tgbotapi.BotAPI
|
||||
chatID int64
|
||||
stagingURL string
|
||||
}
|
||||
|
||||
func NewTelegram(logger *zap.Logger, bot *tgbotapi.BotAPI, chatID int64) *Telegram {
|
||||
return &Telegram{logger: logger, bot: bot, chatID: chatID}
|
||||
func NewTelegram(deps Deps) *Telegram {
|
||||
return &Telegram{logger: deps.Logger, bot: deps.Bot, chatID: deps.ChatID, stagingURL: deps.StagingURL}
|
||||
}
|
||||
|
||||
func (t *Telegram) SendVerification(data *models.Verification, isUpdate bool) error {
|
||||
tplPath := "assets/new_verification.txt"
|
||||
|
||||
func (t *Telegram) SendVerification(data *models.Verification, url string, isUpdate bool) error {
|
||||
fmt.Println("VERT", data, url,isUpdate)
|
||||
var tplPath string
|
||||
if isUpdate {
|
||||
tplPath = "assets/updated_verification.txt"
|
||||
tplPath = UpdatedVerification
|
||||
} else {
|
||||
tplPath = NewVerification
|
||||
}
|
||||
|
||||
tpl, err := template.ParseFiles(tplPath)
|
||||
fmt.Println("VERT1", tplPath)
|
||||
var userURL string
|
||||
userURL = fmt.Sprintf("%s/users/%s", t.stagingURL, data.UserID)
|
||||
fmt.Println("VERT2", userURL)
|
||||
|
||||
tpl, err := template.New("verification_template").Parse(tplPath)
|
||||
fmt.Println("VERT333", tpl,err)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("error parsing template: %w", err)
|
||||
}
|
||||
|
||||
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)
|
||||
fmt.Println("VERT433", err)
|
||||
if err != nil {
|
||||
t.logger.Error("ClientTelegram", zap.Error(err))
|
||||
return err
|
||||
return fmt.Errorf("error executing template: %w", err)
|
||||
}
|
||||
|
||||
msg := tgbotapi.NewMessage(t.chatID, text.String())
|
||||
|
||||
fmt.Println("VERT433", err, t.chatID, text.String())
|
||||
_, err = t.bot.Send(msg)
|
||||
if err != nil {
|
||||
t.logger.Error("ClientTelegram", zap.Error(err))
|
||||
return err
|
||||
return fmt.Errorf("error sending message: %w", err)
|
||||
}
|
||||
|
||||
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)
|
||||
})
|
||||
}
|
@ -8,13 +8,18 @@ import (
|
||||
type Config struct {
|
||||
TelegramToken string `env:"TELEGRAM_TOKEN,required"`
|
||||
TelegramChannelID int64 `env:"TELEGRAM_CHANNEL_ID,required"`
|
||||
HttpAddress string `env:"HTTP_ADDRESS" envDefault:":80"`
|
||||
MongoUri string `env:"MONGO_URI,required"`
|
||||
HttpAddress string `env:"HTTP_ADDRESS,required"`
|
||||
MongoHost string `env:"MONGO_HOST,required"`
|
||||
MongoPort string `env:"MONGO_PORT,required"`
|
||||
MongoUser string `env:"MONGO_USER,required"`
|
||||
MongoPassword string `env:"MONGO_PASSWORD,required"`
|
||||
MongoAuth string `env:"MONGO_AUTH,required"`
|
||||
DatabaseName string `env:"MONGO_DATABASE_NAME,required"`
|
||||
S3Endpoint string `env:"S3_ENDPOINT,required"`
|
||||
S3AccessKeyID string `env:"S3_ACCESS_KEY_ID,required"`
|
||||
S3SecretKey string `env:"S3_SECRET_KEY,required"`
|
||||
CustomerSvcAddress string `env:"CUSTOMER_SVC_ADDRESS,required"`
|
||||
StagingURL string `env:"STAGING_URL,required"`
|
||||
}
|
||||
|
||||
func NewConfig(file ...string) (*Config, error) {
|
||||
|
@ -56,6 +56,7 @@ func (r *VerificationController) CreateVerification(c *fiber.Ctx) error {
|
||||
var req models.ReqCreateVerification
|
||||
|
||||
userID := c.Params("userID")
|
||||
baseURL := c.BaseURL()
|
||||
|
||||
if userID == "" {
|
||||
userID = c.Locals("userID").(string)
|
||||
@ -116,7 +117,7 @@ func (r *VerificationController) CreateVerification(c *fiber.Ctx) error {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
err = r.telegram.SendVerification(result, false)
|
||||
err = r.telegram.SendVerification(result, baseURL, false)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
@ -131,7 +132,6 @@ func (r *VerificationController) SetVerificationStatus(c *fiber.Ctx) error {
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
errValidate := validateStruct(&req)
|
||||
if errValidate != nil {
|
||||
return c.Status(fiber.StatusBadRequest).JSON(errValidate)
|
||||
@ -161,6 +161,7 @@ func (r *VerificationController) SetVerificationStatus(c *fiber.Ctx) error {
|
||||
|
||||
func (r *VerificationController) SetVerificationFile(c *fiber.Ctx) error {
|
||||
userID := c.Params("userID")
|
||||
baseURL := c.BaseURL()
|
||||
|
||||
if userID == "" {
|
||||
userID = c.Locals("userID").(string)
|
||||
@ -191,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 {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
@ -15,10 +15,9 @@ type Repositories struct {
|
||||
func NewRepositories(
|
||||
ctx context.Context,
|
||||
logger *zap.Logger,
|
||||
mongoClient *mongo.Client,
|
||||
dbName string,
|
||||
mongoDB *mongo.Database,
|
||||
s3 *minio.Client) (*Repositories, error) {
|
||||
reps := &Repositories{Verification: repository.NewVerificationRepository(logger, mongoClient.Database(dbName), s3)}
|
||||
reps := &Repositories{Verification: repository.NewVerificationRepository(logger, mongoDB, s3)}
|
||||
|
||||
err := reps.Verification.Init(ctx)
|
||||
if err != nil {
|
||||
|
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
|
||||
}
|
@ -17,3 +17,12 @@ type VerificationFile struct {
|
||||
Name string `json:"name" bson:"name"`
|
||||
Url string `json:"url" bson:"url"`
|
||||
}
|
||||
|
||||
type VerificationUpdate struct {
|
||||
Accepted bool `json:"accepted" bson:"accepted"`
|
||||
Status string `json:"status" bson:"status,omitempty"`
|
||||
UpdatedAt time.Time `json:"updated_at" bson:"updated_at"`
|
||||
Comment string `json:"comment" bson:"comment,omitempty"`
|
||||
Files []VerificationFile `json:"files" bson:"files,omitempty"`
|
||||
TaxNumber string `json:"taxnumber" bson:"taxnumber,omitempty"`
|
||||
}
|
||||
|
@ -5,13 +5,13 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/minio/minio-go/v7/pkg/policy"
|
||||
"github.com/minio/minio-go/v7/pkg/set"
|
||||
"mime/multipart"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/policy"
|
||||
"github.com/minio/minio-go/v7/pkg/set"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
@ -246,12 +246,20 @@ func (r *VerificationRepository) Get(ctx context.Context, id string) (*models.Ve
|
||||
func (r *VerificationRepository) Update(ctx context.Context, record *models.Verification) (*models.Verification, error) {
|
||||
record.UpdatedAt = time.Now()
|
||||
|
||||
test := models.VerificationUpdate{
|
||||
Accepted: record.Accepted,
|
||||
Status: record.Status,
|
||||
UpdatedAt: time.Now(),
|
||||
Comment: record.Comment,
|
||||
Files: record.Files,
|
||||
TaxNumber: record.TaxNumber,
|
||||
}
|
||||
|
||||
var result models.Verification
|
||||
err := r.mongo.FindOneAndUpdate(ctx, bson.M{"_id": record.ID}, bson.M{"$set": record}, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(&result)
|
||||
err := r.mongo.FindOneAndUpdate(ctx, bson.M{"_id": record.ID}, bson.M{"$set": test}, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(&result)
|
||||
if r.err(err) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
@ -276,7 +284,12 @@ func (r *VerificationRepository) UpdateFile(ctx context.Context, userID, fileNam
|
||||
if r.err(err) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if verification == nil {
|
||||
return nil, fmt.Errorf("no verification found")
|
||||
}
|
||||
|
||||
fmt.Println("BUG",verification.Files)
|
||||
found := false
|
||||
for iterator, file := range verification.Files {
|
||||
if file.Name != fileName {
|
||||
|
Loading…
Reference in New Issue
Block a user