diff --git a/dal/db_query/queries.sql b/dal/db_query/queries.sql index e65a653..e44f997 100644 --- a/dal/db_query/queries.sql +++ b/dal/db_query/queries.sql @@ -661,7 +661,7 @@ INSERT INTO tokens (AccountID, RefreshToken, AccessToken, AuthCode, Expiration, VALUES ($1, $2, $3, $4, $5, $6); -- name: WebhookUpdate :exec -UPDATE tokens SET AccessToken = $1,RefreshToken = $2,Expiration = to_timestamp($3) AT TIME ZONE 'UTC' + INTERVAL '3 hours',CreatedAt = to_timestamp($4) AT TIME ZONE 'UTC' + INTERVAL '3 hours' +UPDATE tokens SET AccessToken = $1,RefreshToken = $2,Expiration = to_timestamp(($3)::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours',CreatedAt = to_timestamp(($4)::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours' WHERE accountID = $5; -- name: GetAllTokens :many @@ -1026,4 +1026,4 @@ INSERT INTO amoCRMStatuses (AccountID, DealID, AnswerID, Status) SELECT u.AmoID, $1, $2, $3 FROM tokens AS t JOIN users AS u ON t.AccountID = u.AccountID -WHERE t.AccessToken = $4; \ No newline at end of file +WHERE t.AccessToken = $4; diff --git a/dal/sqlcgen/queries.sql.go b/dal/sqlcgen/queries.sql.go index 0005352..23187ef 100644 --- a/dal/sqlcgen/queries.sql.go +++ b/dal/sqlcgen/queries.sql.go @@ -3355,24 +3355,24 @@ func (q *Queries) WebhookDelete(ctx context.Context, amouserid int32) error { } const webhookUpdate = `-- name: WebhookUpdate :exec -UPDATE tokens SET AccessToken = $1,RefreshToken = $2,Expiration = to_timestamp($3) AT TIME ZONE 'UTC' + INTERVAL '3 hours',CreatedAt = to_timestamp($4) AT TIME ZONE 'UTC' + INTERVAL '3 hours' +UPDATE tokens SET AccessToken = $1,RefreshToken = $2,Expiration = to_timestamp(($3)::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours',CreatedAt = to_timestamp(($4)::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours' WHERE accountID = $5 ` type WebhookUpdateParams struct { - Accesstoken string `db:"accesstoken" json:"accesstoken"` - Refreshtoken string `db:"refreshtoken" json:"refreshtoken"` - ToTimestamp float64 `db:"to_timestamp" json:"to_timestamp"` - ToTimestamp_2 float64 `db:"to_timestamp_2" json:"to_timestamp_2"` - Accountid string `db:"accountid" json:"accountid"` + Accesstoken string `db:"accesstoken" json:"accesstoken"` + Refreshtoken string `db:"refreshtoken" json:"refreshtoken"` + Column3 int64 `db:"column_3" json:"column_3"` + Column4 int64 `db:"column_4" json:"column_4"` + Accountid string `db:"accountid" json:"accountid"` } func (q *Queries) WebhookUpdate(ctx context.Context, arg WebhookUpdateParams) error { _, err := q.db.ExecContext(ctx, webhookUpdate, arg.Accesstoken, arg.Refreshtoken, - arg.ToTimestamp, - arg.ToTimestamp_2, + arg.Column3, + arg.Column4, arg.Accountid, ) return err