This commit is contained in:
Pavel 2024-04-11 19:32:53 +03:00
parent 94e901d231
commit b36a3e67b4
2 changed files with 13 additions and 1 deletions

@ -17,7 +17,7 @@ type GetCurrentAccountResp struct {
/* - айдишник пользвателя, который подключал интеграцию*/
Amouserid int `json:"AmoUserID"`
/* - связь с аккаунтом в амо*/
Amocrmid int `json:"AmocrmID"`
Amocrmid int64 `json:"AmocrmID"`
/* - страна указанная в настройках амо*/
Country string `json:"Country"`
/* - таймштамп создания аккаунта*/

@ -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
}
}