256 lines
6.1 KiB
Go
256 lines
6.1 KiB
Go
|
package amo
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"database/sql"
|
||
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
|
||
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
||
|
)
|
||
|
|
||
|
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
|
||
|
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) GettingUserFromCash(ctx context.Context, req *model.PaginationReq) (*model.UserListResp, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) SoftDeleteAccount(ctx context.Context, accountID string) error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) GetCurrentAccount(ctx context.Context, accountID string) (*model.User, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) CreateAccount(ctx context.Context, accountID string) error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) UpdateAccount(ctx context.Context, accountID string, userInfo model.User) error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) CheckUsers(ctx context.Context, amouserid int, user model.User) error {
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// методы webhook
|
||
|
|
||
|
func (r *AmoRepository) WebhookCreate(ctx context.Context, tokens model.Token) error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) WebhookUpdate(ctx context.Context, tokens model.Token) error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// воркер запускается каждые 5 минут, поэтомму ищем токены котторые исекают менее чем через 10 минут отдаем их на обноление
|
||
|
func (r *AmoRepository) CheckExpired(ctx context.Context) ([]model.Token, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) GetAllTokens(ctx context.Context) ([]model.Token, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) WebhookDelete(ctx context.Context) error {
|
||
|
//TODO:IMPLEMENT ME
|
||
|
|
||
|
return nil
|
||
|
|
||
|
}
|
||
|
|
||
|
// методы pipelines
|
||
|
|
||
|
func (r *AmoRepository) UpdateListPipelines(ctx context.Context) error {
|
||
|
//TODO:IMPLEMENT ME
|
||
|
|
||
|
return nil
|
||
|
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) GettingPipelinesFromCash(ctx context.Context, req *model.PaginationReq) (*model.UserListPipelinesResp, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
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
|
||
|
|
||
|
func (r *AmoRepository) GettingStepsFromCash(ctx context.Context, req *model.PaginationReq) (*model.UserListStepsResp, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
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
|
||
|
|
||
|
func (r *AmoRepository) GettingTagsFromCash(ctx context.Context, req *model.PaginationReq) (*model.UserListTagsResp, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) UpdateListTags(ctx context.Context) error {
|
||
|
//TODO:IMPLEMENT ME
|
||
|
|
||
|
return nil
|
||
|
|
||
|
}
|
||
|
|
||
|
type CheckTagsDeps struct {
|
||
|
AccountID string // id quiz
|
||
|
ID int // id amo
|
||
|
EntityType model.EntityType
|
||
|
Tags []model.Tag
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) CheckTags(ctx context.Context, deps CheckTagsDeps) error {
|
||
|
|
||
|
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
|
||
|
|
||
|
func (r *AmoRepository) GettingFieldsFromCash(ctx context.Context, req *model.PaginationReq) (*model.UserListFieldsResp, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) UpdateListCustom(ctx context.Context) error {
|
||
|
//TODO:IMPLEMENT ME
|
||
|
|
||
|
return nil
|
||
|
|
||
|
}
|
||
|
|
||
|
type CheckFieldsDeps struct {
|
||
|
AccountID string // id quiz
|
||
|
ID int // id amo
|
||
|
EntityType model.EntityType
|
||
|
Fields []model.Field
|
||
|
}
|
||
|
|
||
|
func (r *AmoRepository) CheckFields(ctx context.Context, deps CheckFieldsDeps) error {
|
||
|
|
||
|
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
|
||
|
}
|