diff --git a/internal/models/resp.go b/internal/models/resp.go index d2df0ba..db92920 100644 --- a/internal/models/resp.go +++ b/internal/models/resp.go @@ -17,7 +17,7 @@ type GetCurrentAccountResp struct { /* - айдишник пользвателя, который подключал интеграцию*/ Amouserid int `json:"AmoUserID"` /* - связь с аккаунтом в амо*/ - Amocrmid int `json:"AmocrmID"` + Amocrmid int64 `json:"AmocrmID"` /* - страна указанная в настройках амо*/ Country string `json:"Country"` /* - таймштамп создания аккаунта*/ diff --git a/internal/workers/data_updater/data_updater.go b/internal/workers/data_updater/data_updater.go index 0181cec..9ddd885 100644 --- a/internal/workers/data_updater/data_updater.go +++ b/internal/workers/data_updater/data_updater.go @@ -4,6 +4,7 @@ import ( "amocrm/internal/repository" "amocrm/pkg/amoClient" "context" + "fmt" "go.uber.org/zap" "time" ) @@ -74,6 +75,17 @@ func (wc *DataUpdater) processTasks(ctx context.Context) { wc.logger.Error("error update pipeline steps in mongo:", zap.Error(err)) } } + user, err := wc.repo.GetCurrentAccount(ctx, token.AccountID) + if err != nil { + wc.logger.Error("error getting user data from mongo") + } + userInfo, err := wc.amoClient.GetUserByID(token.AccessToken, user.Amocrmid) + for _, tipe := range userInfo.Rights.StatusRights { + // todo понимать как когда нужно какой тип + fmt.Println(tipe) + } + + // todo fields } }