2024-04-17 09:30:19 +00:00
|
|
|
package amo
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"database/sql"
|
2024-04-17 17:42:13 +00:00
|
|
|
"encoding/json"
|
2024-04-18 11:00:02 +00:00
|
|
|
"fmt"
|
2024-04-17 18:09:09 +00:00
|
|
|
"github.com/sqlc-dev/pqtype"
|
2024-04-17 09:30:19 +00:00
|
|
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
|
|
|
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
2024-04-17 18:09:09 +00:00
|
|
|
"time"
|
2024-04-17 09:30:19 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type AmoRepository struct {
|
|
|
|
queries *sqlcgen.Queries
|
|
|
|
pool *sql.DB
|
|
|
|
}
|
|
|
|
|
|
|
|
type Deps struct {
|
|
|
|
Queries *sqlcgen.Queries
|
|
|
|
Pool *sql.DB
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewAmoRepository(deps Deps) *AmoRepository {
|
|
|
|
return &AmoRepository{
|
|
|
|
queries: deps.Queries,
|
|
|
|
pool: deps.Pool,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// методы пользователя
|
|
|
|
|
|
|
|
func (r *AmoRepository) UpdateListUsers(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-04-17 17:42:13 +00:00
|
|
|
func (r *AmoRepository) GettingUserWithPagination(ctx context.Context, req *model.PaginationReq) (*model.UserListResp, error) {
|
|
|
|
rows, err := r.queries.GetUsersWithPagination(ctx, sqlcgen.GetUsersWithPaginationParams{
|
|
|
|
Column1: req.Page,
|
2024-04-18 11:00:02 +00:00
|
|
|
Limit: req.Size,
|
2024-04-17 17:42:13 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2024-04-17 18:09:09 +00:00
|
|
|
var count int64
|
2024-04-17 17:42:13 +00:00
|
|
|
var users []model.User
|
|
|
|
for _, row := range rows {
|
|
|
|
user := model.User{
|
|
|
|
ID: row.ID,
|
|
|
|
Accountid: row.Accountid,
|
|
|
|
AmoID: row.Amoid,
|
|
|
|
Name: row.Name,
|
|
|
|
Email: row.Email,
|
|
|
|
Role: row.Role,
|
|
|
|
Createdat: row.Createdat.Time.Unix(),
|
|
|
|
Subdomain: row.Subdomain,
|
|
|
|
Amouserid: row.Amouserid,
|
|
|
|
Country: row.Country,
|
|
|
|
}
|
2024-04-17 18:09:09 +00:00
|
|
|
count = row.TotalCount
|
2024-04-17 17:42:13 +00:00
|
|
|
var group []model.UserGroups
|
|
|
|
if !row.Group.Valid {
|
|
|
|
err := json.Unmarshal(row.Group.RawMessage, &group)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user.Group = group
|
|
|
|
|
|
|
|
users = append(users, user)
|
|
|
|
}
|
|
|
|
|
2024-04-17 18:09:09 +00:00
|
|
|
resp := model.UserListResp{
|
|
|
|
Count: count,
|
|
|
|
Items: users,
|
|
|
|
}
|
2024-04-17 17:42:13 +00:00
|
|
|
|
2024-04-17 18:09:09 +00:00
|
|
|
return &resp, nil
|
2024-04-17 09:30:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) SoftDeleteAccount(ctx context.Context, accountID string) error {
|
2024-04-17 18:09:09 +00:00
|
|
|
err := r.queries.SoftDeleteAccount(ctx, accountID)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2024-04-17 09:30:19 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) GetCurrentAccount(ctx context.Context, accountID string) (*model.User, error) {
|
2024-04-17 18:09:09 +00:00
|
|
|
row, err := r.queries.GetCurrentAccount(ctx, accountID)
|
2024-04-17 18:15:20 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
user := model.User{
|
|
|
|
ID: row.ID,
|
|
|
|
Accountid: row.Accountid,
|
|
|
|
AmoID: row.Amoid,
|
|
|
|
Name: row.Name,
|
|
|
|
Email: row.Email,
|
|
|
|
Role: row.Role,
|
|
|
|
Createdat: row.Createdat.Time.Unix(),
|
|
|
|
Subdomain: row.Subdomain,
|
|
|
|
Amouserid: row.Amouserid,
|
|
|
|
Country: row.Country,
|
|
|
|
}
|
|
|
|
|
|
|
|
var group []model.UserGroups
|
|
|
|
if !row.Group.Valid {
|
|
|
|
err := json.Unmarshal(row.Group.RawMessage, &group)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user.Group = group
|
|
|
|
|
|
|
|
return &user, nil
|
2024-04-17 09:30:19 +00:00
|
|
|
}
|
|
|
|
|
2024-04-17 17:14:12 +00:00
|
|
|
func (r *AmoRepository) CreateAccount(ctx context.Context, accountID string, userInfo model.User) error {
|
2024-04-17 18:09:09 +00:00
|
|
|
group, err := json.Marshal(userInfo.Group)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = r.queries.CreateAmoAccount(ctx, sqlcgen.CreateAmoAccountParams{
|
|
|
|
Accountid: accountID,
|
|
|
|
Amoid: userInfo.AmoID,
|
|
|
|
Name: userInfo.Name,
|
|
|
|
Email: userInfo.Email,
|
|
|
|
Role: userInfo.Role,
|
|
|
|
Group: pqtype.NullRawMessage{RawMessage: group, Valid: len(group) > 0},
|
|
|
|
Createdat: sql.NullTime{Time: time.Now(), Valid: true},
|
|
|
|
Subdomain: userInfo.Subdomain,
|
|
|
|
Amouserid: userInfo.Amouserid,
|
|
|
|
Country: userInfo.Country,
|
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2024-04-17 09:30:19 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-04-17 18:09:09 +00:00
|
|
|
func (r *AmoRepository) CheckUsers(ctx context.Context, amouserid int32, user model.User) error {
|
|
|
|
group, err := json.Marshal(user.Group)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = r.queries.CheckUsers(ctx, sqlcgen.CheckUsersParams{
|
|
|
|
Amoid: amouserid,
|
|
|
|
Name: user.Name,
|
|
|
|
Email: user.Email,
|
|
|
|
Role: user.Role,
|
|
|
|
Group: pqtype.NullRawMessage{RawMessage: group, Valid: len(group) > 0},
|
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2024-04-17 09:30:19 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// методы webhook
|
|
|
|
|
|
|
|
func (r *AmoRepository) WebhookCreate(ctx context.Context, tokens model.Token) error {
|
2024-04-17 18:09:09 +00:00
|
|
|
err := r.queries.CreateWebHook(ctx, sqlcgen.CreateWebHookParams{
|
|
|
|
Accountid: tokens.AccountID,
|
|
|
|
Refreshtoken: tokens.RefreshToken,
|
|
|
|
Accesstoken: tokens.AccessToken,
|
|
|
|
Authcode: tokens.AuthCode,
|
2024-04-18 09:16:25 +00:00
|
|
|
Expiration: time.Unix(tokens.Expiration, 0).In(time.UTC),
|
2024-04-17 18:09:09 +00:00
|
|
|
Createdat: sql.NullTime{Time: time.Unix(tokens.CreatedAt, 0), Valid: true},
|
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2024-04-17 09:30:19 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) WebhookUpdate(ctx context.Context, tokens model.Token) error {
|
2024-04-17 18:09:09 +00:00
|
|
|
err := r.queries.WebhookUpdate(ctx, sqlcgen.WebhookUpdateParams{
|
|
|
|
Accountid: tokens.AccountID,
|
|
|
|
Accesstoken: tokens.AccessToken,
|
|
|
|
Refreshtoken: tokens.RefreshToken,
|
2024-04-18 09:16:25 +00:00
|
|
|
Expiration: time.Unix(tokens.Expiration, 0).In(time.UTC),
|
2024-04-17 18:09:09 +00:00
|
|
|
Createdat: sql.NullTime{Time: time.Unix(tokens.CreatedAt, 0), Valid: true},
|
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2024-04-17 09:30:19 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// воркер запускается каждые 5 минут, поэтомму ищем токены котторые исекают менее чем через 10 минут отдаем их на обноление
|
|
|
|
func (r *AmoRepository) CheckExpired(ctx context.Context) ([]model.Token, error) {
|
2024-04-17 18:09:09 +00:00
|
|
|
rows, err := r.queries.CheckExpired(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
var tokens []model.Token
|
|
|
|
|
|
|
|
for _, row := range rows {
|
|
|
|
token := model.Token{
|
|
|
|
AccountID: row.Accountid,
|
|
|
|
AccessToken: row.Accesstoken,
|
|
|
|
RefreshToken: row.Refreshtoken,
|
|
|
|
AuthCode: row.Authcode,
|
|
|
|
Expiration: row.Expiration.Unix(),
|
|
|
|
CreatedAt: row.Createdat.Time.Unix(),
|
|
|
|
}
|
|
|
|
|
|
|
|
tokens = append(tokens, token)
|
|
|
|
}
|
|
|
|
|
|
|
|
return tokens, nil
|
2024-04-17 09:30:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) GetAllTokens(ctx context.Context) ([]model.Token, error) {
|
2024-04-17 18:09:09 +00:00
|
|
|
rows, err := r.queries.GetAllTokens(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
var tokens []model.Token
|
|
|
|
|
|
|
|
for _, row := range rows {
|
|
|
|
token := model.Token{
|
|
|
|
AccountID: row.Accountid,
|
|
|
|
AccessToken: row.Accesstoken,
|
|
|
|
RefreshToken: row.Refreshtoken,
|
|
|
|
AuthCode: row.Authcode,
|
|
|
|
Expiration: row.Expiration.Unix(),
|
|
|
|
CreatedAt: row.Createdat.Time.Unix(),
|
|
|
|
}
|
|
|
|
|
|
|
|
tokens = append(tokens, token)
|
|
|
|
}
|
|
|
|
|
|
|
|
return tokens, nil
|
2024-04-17 09:30:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) WebhookDelete(ctx context.Context) error {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// методы pipelines
|
|
|
|
|
|
|
|
func (r *AmoRepository) UpdateListPipelines(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-04-18 11:00:02 +00:00
|
|
|
func (r *AmoRepository) GetPipelinesWithPagination(ctx context.Context, req *model.PaginationReq) (*model.UserListPipelinesResp, error) {
|
|
|
|
rows, err := r.queries.GetPipelinesWithPagination(ctx, sqlcgen.GetPipelinesWithPaginationParams{
|
|
|
|
Column1: req.Page,
|
|
|
|
Limit: req.Size,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
var count int64
|
|
|
|
var pipelines []model.Pipeline
|
|
|
|
|
|
|
|
for _, row := range rows {
|
|
|
|
count = row.TotalCount
|
|
|
|
pipeline := model.Pipeline{
|
|
|
|
ID: row.ID,
|
|
|
|
Amoid: row.Amoid,
|
|
|
|
AccountID: row.Accountid,
|
|
|
|
Name: row.Name,
|
|
|
|
Isarchive: row.Isarchive,
|
|
|
|
Createdat: row.Createdat.Time.Unix(),
|
|
|
|
}
|
|
|
|
pipelines = append(pipelines, pipeline)
|
|
|
|
}
|
|
|
|
|
|
|
|
resp := model.UserListPipelinesResp{
|
|
|
|
Count: count,
|
|
|
|
Items: pipelines,
|
|
|
|
}
|
|
|
|
return &resp, nil
|
2024-04-17 09:30:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) CheckPipelines(ctx context.Context, accountID string, pipelines []model.Pipeline) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) GetPipelineByID(ctx context.Context, accountID string, amoid int) (*model.Pipeline, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) UpdatePipeline(ctx context.Context, pipeline *model.Pipeline) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) InsertPipeline(ctx context.Context, pipeline *model.Pipeline) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// методы steps
|
|
|
|
|
2024-04-18 11:00:02 +00:00
|
|
|
func (r *AmoRepository) GetStepsWithPagination(ctx context.Context, req *model.PaginationReq) (*model.UserListStepsResp, error) {
|
|
|
|
rows, err := r.queries.GetStepsWithPagination(ctx, sqlcgen.GetStepsWithPaginationParams{
|
|
|
|
Column1: req.Page,
|
|
|
|
Limit: req.Size,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
var count int64
|
|
|
|
var steps []model.Step
|
|
|
|
|
|
|
|
for _, row := range rows {
|
|
|
|
count = row.TotalCount
|
|
|
|
step := model.Step{
|
|
|
|
ID: row.ID,
|
|
|
|
Amoid: row.Amoid,
|
|
|
|
Pipelineid: row.Pipelineid,
|
|
|
|
Accountid: row.Accountid,
|
|
|
|
Name: row.Name,
|
|
|
|
Color: row.Color,
|
|
|
|
Createdat: row.Createdat.Time.Unix(),
|
|
|
|
}
|
|
|
|
steps = append(steps, step)
|
|
|
|
}
|
|
|
|
|
|
|
|
resp := model.UserListStepsResp{
|
|
|
|
Count: count,
|
|
|
|
Items: steps,
|
|
|
|
}
|
|
|
|
|
|
|
|
return &resp, nil
|
2024-04-17 09:30:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) UpdateListSteps(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) CheckSteps(ctx context.Context, accountID string, steps []model.Step) error {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) GetStepByID(ctx context.Context, accountID string, amoid int) (*model.Step, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) UpdateStep(ctx context.Context, step *model.Step) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) InsertStep(ctx context.Context, step *model.Step) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// методы tags
|
|
|
|
|
2024-04-18 11:00:02 +00:00
|
|
|
func (r *AmoRepository) GetTagsWithPagination(ctx context.Context, req *model.PaginationReq) (*model.UserListTagsResp, error) {
|
|
|
|
rows, err := r.queries.GetTagsWithPagination(ctx, sqlcgen.GetTagsWithPaginationParams{
|
|
|
|
Column1: req.Page,
|
|
|
|
Limit: req.Size,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
var count int64
|
|
|
|
var tags []model.Tag
|
|
|
|
for _, row := range rows {
|
|
|
|
count = row.TotalCount
|
|
|
|
|
|
|
|
var entity model.EntityType
|
|
|
|
if v, ok := row.Entity.(string); ok {
|
|
|
|
entity = model.EntityType(v)
|
|
|
|
} else {
|
|
|
|
fmt.Println("unexpected type for EntityType:", row.Entity)
|
|
|
|
}
|
|
|
|
|
|
|
|
tag := model.Tag{
|
|
|
|
ID: row.ID,
|
|
|
|
Amoid: row.Amoid,
|
|
|
|
Accountid: row.Accountid,
|
|
|
|
Entity: entity,
|
|
|
|
Name: row.Name,
|
|
|
|
Color: &row.Color,
|
|
|
|
Createdat: row.Createdat.Time.Unix(),
|
|
|
|
}
|
|
|
|
tags = append(tags, tag)
|
|
|
|
}
|
|
|
|
|
|
|
|
resp := model.UserListTagsResp{
|
|
|
|
Count: count,
|
|
|
|
Items: tags,
|
|
|
|
}
|
|
|
|
|
|
|
|
return &resp, nil
|
2024-04-17 09:30:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) UpdateListTags(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-04-17 12:01:01 +00:00
|
|
|
func (r *AmoRepository) CheckTags(ctx context.Context, tags []model.Tag, tokenID string) error {
|
2024-04-18 11:00:02 +00:00
|
|
|
var column2 []json.RawMessage
|
|
|
|
for _, tag := range tags {
|
|
|
|
jsonTag, err := json.Marshal(tag)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
column2 = append(column2, jsonTag)
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err := r.queries.CheckTags(ctx, sqlcgen.CheckTagsParams{
|
|
|
|
Accountid: tokenID,
|
|
|
|
Column2: column2,
|
|
|
|
})
|
2024-04-17 09:30:19 +00:00
|
|
|
|
2024-04-18 11:00:02 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2024-04-17 09:30:19 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) GetTagByID(ctx context.Context, accountID string, amoid int, entity model.EntityType) (*model.Tag, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) UpdateTag(ctx context.Context, tag *model.Tag) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) InsertTag(ctx context.Context, tag *model.Tag) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// методы fields
|
|
|
|
|
2024-04-18 11:00:02 +00:00
|
|
|
func (r *AmoRepository) GetFieldsWithPagination(ctx context.Context, req *model.PaginationReq) (*model.UserListFieldsResp, error) {
|
|
|
|
rows, err := r.queries.GetFieldsWithPagination(ctx, sqlcgen.GetFieldsWithPaginationParams{
|
|
|
|
Column1: req.Page,
|
|
|
|
Limit: req.Size,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
var count int64
|
|
|
|
var fields []model.Field
|
|
|
|
|
|
|
|
for _, row := range rows {
|
|
|
|
count = row.TotalCount
|
|
|
|
|
|
|
|
var entity model.EntityType
|
|
|
|
if v, ok := row.Entity.(string); ok {
|
|
|
|
entity = model.EntityType(v)
|
|
|
|
} else {
|
|
|
|
fmt.Println("unexpected type for EntityType:", row.Entity)
|
|
|
|
}
|
|
|
|
|
|
|
|
field := model.Field{
|
|
|
|
ID: row.ID,
|
|
|
|
Amoid: row.Amoid,
|
|
|
|
Code: row.Code,
|
|
|
|
Accountid: row.Accountid,
|
|
|
|
Name: row.Name,
|
|
|
|
Entity: entity,
|
|
|
|
Type: row.Type,
|
|
|
|
Createdat: row.Createdat.Time.Unix(),
|
|
|
|
}
|
|
|
|
|
|
|
|
fields = append(fields, field)
|
|
|
|
}
|
|
|
|
|
|
|
|
resp := model.UserListFieldsResp{
|
|
|
|
Count: count,
|
|
|
|
Items: fields,
|
|
|
|
}
|
|
|
|
|
|
|
|
return &resp, nil
|
2024-04-17 09:30:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) UpdateListCustom(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-04-17 12:01:01 +00:00
|
|
|
func (r *AmoRepository) CheckFields(ctx context.Context, Fields []model.Field, tokenID string) error {
|
2024-04-17 09:30:19 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) GetFieldByID(ctx context.Context, accountID string, amoid int, entity model.EntityType) (*model.Field, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) UpdateField(ctx context.Context, field *model.Field) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) InsertField(ctx context.Context, field *model.Field) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// методы rules
|
|
|
|
|
|
|
|
func (r *AmoRepository) ChangeQuizSettings(ctx context.Context, request *model.RulesReq) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) SetQuizSettings(ctx context.Context, request *model.RulesReq) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) GettingQuizRules(ctx context.Context) (*model.Rule, error) {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return &model.Rule{}, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// методы UTMs
|
|
|
|
|
|
|
|
func (r *AmoRepository) DeletingUserUtm(ctx context.Context, request *model.ListDeleteUTMIDsReq) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) SavingUserUtm(ctx context.Context, request *model.SaveUserListUTMReq, accountID string, quizID int) (*model.ListSavedIDUTMResp, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *AmoRepository) GettingUserUtm(ctx context.Context, request *model.PaginationReq, accountID string, quizID int) (*model.GetListUserUTMResp, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|