diff --git a/dal/db_query/queries.sql b/dal/db_query/queries.sql index ec93940..4315596 100644 --- a/dal/db_query/queries.sql +++ b/dal/db_query/queries.sql @@ -686,8 +686,8 @@ RETURNING quiz_id; -- amo methods: -- name: CreateAmoAccount :exec -INSERT INTO users (AccountID, AmoID, Name, Email, Role, "Group", Deleted, CreatedAt, Subdomain, AmoUserID, Country) -VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11); +INSERT INTO users (AccountID, AmoID, Name, Email, Role, "Group", Deleted, CreatedAt, Subdomain, AmoUserID, Country,DriveURL) +VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12); -- name: CreateWebHook :exec INSERT INTO tokens (AccountID, RefreshToken, AccessToken, AuthCode, Expiration, CreatedAt) @@ -993,7 +993,7 @@ SELECT a.quiz_id,a.id,a.result,a.question_id,a.content,a.session, FROM answer a2 WHERE a2.start = true AND a2.session = a.session LIMIT 1) AS utm -,t.accesstoken,r.accountid,r.fieldsrule,r.tagstoadd,r.performerid,r.stepid,r.pipelineid,(SELECT u.name FROM users u WHERE u.amoid = r.performerid) AS performer_name,u.subdomain,u.accountid +,t.accesstoken,r.accountid,r.fieldsrule,r.tagstoadd,r.performerid,r.stepid,r.pipelineid,(SELECT u.name FROM users u WHERE u.amoid = r.performerid) AS performer_name,u.subdomain,u.accountid,u.driveurl FROM answer a INNER JOIN quiz q ON a.quiz_id = q.id LEFT JOIN amoCRMStatuses s ON a.id = s.AnswerID diff --git a/dal/schema/000013_init.down.sql b/dal/schema/000013_init.down.sql index 6e8b352..26cb247 100644 --- a/dal/schema/000013_init.down.sql +++ b/dal/schema/000013_init.down.sql @@ -1,2 +1,4 @@ ALTER TABLE rules -DROP COLUMN IF EXISTS TagsToAdd; \ No newline at end of file +DROP COLUMN IF EXISTS TagsToAdd; +ALTER TABLE users +DROP COLUMN IF EXISTS DriveURL; \ No newline at end of file diff --git a/dal/schema/000013_init.up.sql b/dal/schema/000013_init.up.sql index 72aeba6..44d4155 100644 --- a/dal/schema/000013_init.up.sql +++ b/dal/schema/000013_init.up.sql @@ -1,2 +1,4 @@ ALTER TABLE rules ADD COLUMN TagsToAdd JSONB NOT NULL DEFAULT '{}'; +ALTER TABLE users +ADD COLUMN DriveURL text NOT NULL DEFAULT ''; diff --git a/model/amo.go b/model/amo.go index 31014d3..b5bf0ea 100644 --- a/model/amo.go +++ b/model/amo.go @@ -25,6 +25,8 @@ type User struct { Amouserid int32 `json:"AmoUserID"` /* - страна указанная в настройках амо*/ Country string `json:"Country"` + // урл объектного хранилища пользователя в амо + DriveURL string `json:"DriveURL"` } type UserGroups struct { @@ -286,4 +288,5 @@ type AmoUsersTrueResults struct { PerformerName string SubDomain string QuizAccountID string + DriveURL string } diff --git a/model/amoResp.go b/model/amoResp.go index 6ea7cc6..fd49975 100644 --- a/model/amoResp.go +++ b/model/amoResp.go @@ -21,7 +21,8 @@ type GetCurrentAccountResp struct { /* - страна указанная в настройках амо*/ Country string `json:"Country"` /* - таймштамп создания аккаунта*/ - Createdat int64 `json:"CreatedAt"` + Createdat int64 `json:"CreatedAt"` + DriveURL string `json:"DriveURL"` } //type GetListUserUTMResp struct {