2024-04-09 07:42:21 +00:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import (
|
|
|
|
"amocrm/internal/models"
|
|
|
|
"context"
|
2024-04-09 09:17:39 +00:00
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
2024-04-09 07:42:21 +00:00
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Deps struct {
|
|
|
|
MdbUser *mongo.Collection
|
|
|
|
Logger *zap.Logger
|
|
|
|
}
|
|
|
|
|
|
|
|
type Repository struct {
|
|
|
|
mdbUser *mongo.Collection
|
|
|
|
logger *zap.Logger
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewRepository(deps Deps) *Repository {
|
|
|
|
return &Repository{
|
|
|
|
mdbUser: deps.MdbUser,
|
|
|
|
logger: deps.Logger,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) UpdateListUsers(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) GettingUserFromCash(ctx context.Context) (*models.UserListResp, error) {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return &models.UserListResp{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) DeletingUserUtm(ctx context.Context, request *models.ListDeleteUTMIDsReq) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) SavingUserUtm(ctx context.Context, request *models.SaveUserListUTMReq) (*models.ListSavedIDUTMResp, error) {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return &models.ListSavedIDUTMResp{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) GettingUserUtm(ctx context.Context) (*models.GetListUserUTMResp, error) {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return &models.GetListUserUTMResp{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) SoftDeleteAccount(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) GetCurrentAccount(ctx context.Context) (*models.GetCurrentAccountResp, error) {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return &models.GetCurrentAccountResp{}, nil
|
|
|
|
}
|
|
|
|
|
2024-04-09 09:17:39 +00:00
|
|
|
func (r *Repository) CreateAccount(ctx context.Context, accountID string) error {
|
|
|
|
userData := models.User{}
|
|
|
|
userData.ObjID = primitive.NewObjectID()
|
|
|
|
userData.Accountid = accountID
|
|
|
|
_, err := r.mdbUser.InsertOne(ctx, userData)
|
|
|
|
if err != nil {
|
|
|
|
r.logger.Error("error createAccount in mongodb")
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
2024-04-09 07:42:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) GettingStepsFromCash(ctx context.Context) (*models.UserListStepsResp, error) {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return &models.UserListStepsResp{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) UpdateListSteps(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) WebhookCreate(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) WebhookDelete(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) UpdateListPipelines(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) GettingPipelinesFromCash(ctx context.Context) (*models.UserListPipelinesResp, error) {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return &models.UserListPipelinesResp{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) ChangeQuizSettings(ctx context.Context, request *models.RulesReq) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) SetQuizSettings(ctx context.Context, request *models.RulesReq) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) GettingQuizRules(ctx context.Context) (*models.Rule, error) {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return &models.Rule{}, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) GettingTagsFromCash(ctx context.Context) (*models.UserListTagsResp, error) {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return &models.UserListTagsResp{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) UpdateListTags(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) GettingFieldsFromCash(ctx context.Context) (*models.UserListFieldsResp, error) {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return &models.UserListFieldsResp{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Repository) UpdateListCustom(ctx context.Context) error {
|
|
|
|
//TODO:IMPLEMENT ME
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|