generate with blueprint
This commit is contained in:
parent
086f7ae150
commit
1d4a20d865
162
.gitignore
vendored
162
.gitignore
vendored
@ -1 +1,161 @@
|
|||||||
.idea/
|
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,goland,go
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,goland,go
|
||||||
|
|
||||||
|
### Go ###
|
||||||
|
# If you prefer the allow list template instead of the deny list, see community template:
|
||||||
|
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||||
|
#
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, built with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# Dependency directories (remove the comment below to include it)
|
||||||
|
# vendor/
|
||||||
|
|
||||||
|
# Go workspace file
|
||||||
|
go.work
|
||||||
|
|
||||||
|
### GoLand ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# AWS User-specific
|
||||||
|
.idea/**/aws.xml
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/artifacts
|
||||||
|
# .idea/compiler.xml
|
||||||
|
# .idea/jarRepositories.xml
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
# *.iml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# SonarLint plugin
|
||||||
|
.idea/sonarlint/
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
|
### GoLand Patch ###
|
||||||
|
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||||
|
|
||||||
|
# *.iml
|
||||||
|
# modules.xml
|
||||||
|
# .idea/misc.xml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# Sonarlint plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
||||||
|
.idea/**/sonarlint/
|
||||||
|
|
||||||
|
# SonarQube Plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
||||||
|
.idea/**/sonarIssues.xml
|
||||||
|
|
||||||
|
# Markdown Navigator plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
||||||
|
.idea/**/markdown-navigator.xml
|
||||||
|
.idea/**/markdown-navigator-enh.xml
|
||||||
|
.idea/**/markdown-navigator/
|
||||||
|
|
||||||
|
# Cache file creation bug
|
||||||
|
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
||||||
|
.idea/$CACHE_FILE$
|
||||||
|
|
||||||
|
# CodeStream plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/12206-codestream
|
||||||
|
.idea/codestream.xml
|
||||||
|
|
||||||
|
# Azure Toolkit for IntelliJ plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
|
||||||
|
.idea/**/azureSettings.xml
|
||||||
|
|
||||||
|
### VisualStudioCode ###
|
||||||
|
.vscode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
!.vscode/*.code-snippets
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
# Built Visual Studio Code Extensions
|
||||||
|
*.vsix
|
||||||
|
|
||||||
|
### VisualStudioCode Patch ###
|
||||||
|
# Ignore all local history of files
|
||||||
|
.history
|
||||||
|
.ionide
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,goland,go
|
||||||
|
@ -4,9 +4,10 @@ import (
|
|||||||
"amocrm/models/amo"
|
"amocrm/models/amo"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"net/url"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Amo struct {
|
type Amo struct {
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"amocrm/internal/app"
|
|
||||||
"context"
|
"context"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"amocrm/internal/app"
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"go.uber.org/zap/zapcore"
|
"go.uber.org/zap/zapcore"
|
||||||
|
|
||||||
|
@ -1,4 +1,87 @@
|
|||||||
@startuml Database
|
@startuml Database
|
||||||
|
|
||||||
|
map FieldRule {
|
||||||
|
QuestionID => **integer**
|
||||||
|
}
|
||||||
|
|
||||||
|
map UTM {
|
||||||
|
CreatedAt => **integer**
|
||||||
|
Deleted => **boolean**
|
||||||
|
ID => **integer**
|
||||||
|
Name => **string**
|
||||||
|
QuizID => **integer**
|
||||||
|
AccountID => **string**
|
||||||
|
AmoFieldID => **integer**
|
||||||
|
}
|
||||||
|
|
||||||
|
map Pipeline {
|
||||||
|
CreatedAt => **integer**
|
||||||
|
Deleted => **boolean**
|
||||||
|
ID => **integer**
|
||||||
|
IsArchive => **boolean**
|
||||||
|
Name => **string**
|
||||||
|
AccountID => **string**
|
||||||
|
AmoID => **integer**
|
||||||
|
}
|
||||||
|
|
||||||
|
map Step {
|
||||||
|
Deleted => **boolean**
|
||||||
|
ID => **integer**
|
||||||
|
Name => **string**
|
||||||
|
PipelineID => **integer**
|
||||||
|
AccountID => **string**
|
||||||
|
AmoID => **integer**
|
||||||
|
Color => **string**
|
||||||
|
CreatedAt => **integer**
|
||||||
|
}
|
||||||
|
|
||||||
|
map Tag {
|
||||||
|
AccountID => **string**
|
||||||
|
AmoID => **integer**
|
||||||
|
Color => **string**
|
||||||
|
CreatedAt => **integer**
|
||||||
|
Deleted => **boolean**
|
||||||
|
Entity => **string**
|
||||||
|
ID => **integer**
|
||||||
|
Name => **string**
|
||||||
|
}
|
||||||
|
|
||||||
|
map Field {
|
||||||
|
CreatedAt => **integer**
|
||||||
|
Deleted => **boolean**
|
||||||
|
EntityType => **string**
|
||||||
|
ID => **integer**
|
||||||
|
Name => **string**
|
||||||
|
Type => **string**
|
||||||
|
AccountID => **string**
|
||||||
|
AmoID => **integer**
|
||||||
|
Code => **string**
|
||||||
|
}
|
||||||
|
|
||||||
|
map User {
|
||||||
|
Role => **string**
|
||||||
|
AmoID => **integer**
|
||||||
|
Group => **string**
|
||||||
|
Name => **string**
|
||||||
|
Email => **string**
|
||||||
|
ID => **integer**
|
||||||
|
AccountID => **string**
|
||||||
|
CreatedAt => **integer**
|
||||||
|
Deleted => **boolean**
|
||||||
|
}
|
||||||
|
|
||||||
|
map Rule {
|
||||||
|
CreatedAt => **integer**
|
||||||
|
Deleted => **boolean**
|
||||||
|
FieldsRule => **FieldsRule**
|
||||||
|
PipelineID => **integer**
|
||||||
|
QuizID => **integer**
|
||||||
|
StepID => **integer**
|
||||||
|
UTMs => **[]integer**
|
||||||
|
AccountID => **string**
|
||||||
|
PerformerID => **integer**
|
||||||
|
ID => **integer**
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@enduml
|
@enduml
|
@ -1,6 +1,7 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"amocrm/internal/models"
|
||||||
"amocrm/internal/service"
|
"amocrm/internal/service"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
@ -18,10 +19,16 @@ func NewAccountController(service *service.AccountService) *AccountController {
|
|||||||
|
|
||||||
func (c *AccountController) Register(router fiber.Router) {
|
func (c *AccountController) Register(router fiber.Router) {
|
||||||
|
|
||||||
router.Get("/users", c.Getlistusers)
|
|
||||||
|
|
||||||
router.Patch("/users", c.Updatelistusers)
|
router.Patch("/users", c.Updatelistusers)
|
||||||
|
|
||||||
|
router.Get("/users", c.Gettinguserfromcash)
|
||||||
|
|
||||||
|
router.Delete("/utms", c.Deletinguserutm)
|
||||||
|
|
||||||
|
router.Post("/utms", c.Savinguserutm)
|
||||||
|
|
||||||
|
router.Get("/utms/{quizID}", c.Gettinguserutm)
|
||||||
|
|
||||||
router.Delete("/account", c.Softdeleteaccount)
|
router.Delete("/account", c.Softdeleteaccount)
|
||||||
|
|
||||||
router.Get("/account", c.Getcurrentaccount)
|
router.Get("/account", c.Getcurrentaccount)
|
||||||
@ -34,18 +41,6 @@ func (c *AccountController) Name() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AccountController) Getlistusers(ctx *fiber.Ctx) error {
|
|
||||||
// Обработчик для метода Getlistusers
|
|
||||||
|
|
||||||
err := c.AccountService.Getlistusers(ctx.Context())
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
|
||||||
}
|
|
||||||
return ctx.SendStatus(fiber.StatusOK)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *AccountController) Updatelistusers(ctx *fiber.Ctx) error {
|
func (c *AccountController) Updatelistusers(ctx *fiber.Ctx) error {
|
||||||
// Обработчик для метода Updatelistusers
|
// Обработчик для метода Updatelistusers
|
||||||
|
|
||||||
@ -58,6 +53,64 @@ func (c *AccountController) Updatelistusers(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *AccountController) Gettinguserfromcash(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Gettinguserfromcash
|
||||||
|
|
||||||
|
response, err := c.AccountService.Gettinguserfromcash(ctx.Context())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.Status(fiber.StatusOK).JSON(response)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *AccountController) Deletinguserutm(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Deletinguserutm
|
||||||
|
|
||||||
|
var request models.ListDeleteUTMIDsReq
|
||||||
|
if err := ctx.BodyParser(&request); err != nil {
|
||||||
|
return ctx.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Invalid request payload"})
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.AccountService.Deletinguserutm(ctx.Context(), &request)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.SendStatus(fiber.StatusOK)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *AccountController) Savinguserutm(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Savinguserutm
|
||||||
|
|
||||||
|
var request models.SaveUserListUTMReq
|
||||||
|
if err := ctx.BodyParser(&request); err != nil {
|
||||||
|
return ctx.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Invalid request payload"})
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := c.AccountService.Savinguserutm(ctx.Context(), &request)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.Status(fiber.StatusOK).JSON(response)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *AccountController) Gettinguserutm(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Gettinguserutm
|
||||||
|
|
||||||
|
response, err := c.AccountService.Gettinguserutm(ctx.Context())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.Status(fiber.StatusOK).JSON(response)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (c *AccountController) Softdeleteaccount(ctx *fiber.Ctx) error {
|
func (c *AccountController) Softdeleteaccount(ctx *fiber.Ctx) error {
|
||||||
// Обработчик для метода Softdeleteaccount
|
// Обработчик для метода Softdeleteaccount
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"amocrm/internal/models"
|
||||||
"amocrm/internal/service"
|
"amocrm/internal/service"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
@ -18,25 +19,31 @@ func NewDifferentController(service *service.DifferentService) *DifferentControl
|
|||||||
|
|
||||||
func (c *DifferentController) Register(router fiber.Router) {
|
func (c *DifferentController) Register(router fiber.Router) {
|
||||||
|
|
||||||
router.Get("/tags", c.Getlisttags)
|
router.Get("/steps", c.Gettingstepsfromcash)
|
||||||
|
|
||||||
router.Patch("/tags", c.Updatelisttags)
|
router.Patch("/steps", c.Updateliststeps)
|
||||||
|
|
||||||
router.Get("/webhook/create", c.Webhookcreate)
|
router.Get("/webhook/create", c.Webhookcreate)
|
||||||
|
|
||||||
router.Get("/webhook/delete", c.Webhookdelete)
|
router.Get("/webhook/delete", c.Webhookdelete)
|
||||||
|
|
||||||
router.Get("/fields", c.Getlistcustom)
|
|
||||||
|
|
||||||
router.Patch("/fields", c.Updatelistcustom)
|
|
||||||
|
|
||||||
router.Get("/pipelines", c.Getlistpipelines)
|
|
||||||
|
|
||||||
router.Patch("/pipelines", c.Updatelistpipelines)
|
router.Patch("/pipelines", c.Updatelistpipelines)
|
||||||
|
|
||||||
router.Get("/steps", c.Getliststeps)
|
router.Get("/pipelines", c.Gettingpipelinesfromcash)
|
||||||
|
|
||||||
router.Patch("/steps", c.Updateliststeps)
|
router.Patch("/rules", c.Changequizsettings)
|
||||||
|
|
||||||
|
router.Post("/rules", c.Setquizsettings)
|
||||||
|
|
||||||
|
router.Get("/rules/{quizID}", c.Gettingquizrules)
|
||||||
|
|
||||||
|
router.Get("/tags", c.Gettingtagsfromcash)
|
||||||
|
|
||||||
|
router.Patch("/tags", c.Updatelisttags)
|
||||||
|
|
||||||
|
router.Get("/fields", c.Gettingfieldsfromcash)
|
||||||
|
|
||||||
|
router.Patch("/fields", c.Updatelistcustom)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,22 +51,22 @@ func (c *DifferentController) Name() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DifferentController) Getlisttags(ctx *fiber.Ctx) error {
|
func (c *DifferentController) Gettingstepsfromcash(ctx *fiber.Ctx) error {
|
||||||
// Обработчик для метода Getlisttags
|
// Обработчик для метода Gettingstepsfromcash
|
||||||
|
|
||||||
err := c.DifferentService.Getlisttags(ctx.Context())
|
response, err := c.DifferentService.Gettingstepsfromcash(ctx.Context())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
}
|
}
|
||||||
return ctx.SendStatus(fiber.StatusOK)
|
return ctx.Status(fiber.StatusOK).JSON(response)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DifferentController) Updatelisttags(ctx *fiber.Ctx) error {
|
func (c *DifferentController) Updateliststeps(ctx *fiber.Ctx) error {
|
||||||
// Обработчик для метода Updatelisttags
|
// Обработчик для метода Updateliststeps
|
||||||
|
|
||||||
err := c.DifferentService.Updatelisttags(ctx.Context())
|
err := c.DifferentService.Updateliststeps(ctx.Context())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
@ -92,10 +99,10 @@ func (c *DifferentController) Webhookdelete(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DifferentController) Getlistcustom(ctx *fiber.Ctx) error {
|
func (c *DifferentController) Updatelistpipelines(ctx *fiber.Ctx) error {
|
||||||
// Обработчик для метода Getlistcustom
|
// Обработчик для метода Updatelistpipelines
|
||||||
|
|
||||||
err := c.DifferentService.Getlistcustom(ctx.Context())
|
err := c.DifferentService.Updatelistpipelines(ctx.Context())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
@ -104,6 +111,100 @@ func (c *DifferentController) Getlistcustom(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *DifferentController) Gettingpipelinesfromcash(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Gettingpipelinesfromcash
|
||||||
|
|
||||||
|
response, err := c.DifferentService.Gettingpipelinesfromcash(ctx.Context())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.Status(fiber.StatusOK).JSON(response)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DifferentController) Changequizsettings(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Changequizsettings
|
||||||
|
|
||||||
|
var request models.RulesReq
|
||||||
|
if err := ctx.BodyParser(&request); err != nil {
|
||||||
|
return ctx.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Invalid request payload"})
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.DifferentService.Changequizsettings(ctx.Context(), &request)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.SendStatus(fiber.StatusOK)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DifferentController) Setquizsettings(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Setquizsettings
|
||||||
|
|
||||||
|
var request models.RulesReq
|
||||||
|
if err := ctx.BodyParser(&request); err != nil {
|
||||||
|
return ctx.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Invalid request payload"})
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.DifferentService.Setquizsettings(ctx.Context(), &request)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.SendStatus(fiber.StatusOK)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DifferentController) Gettingquizrules(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Gettingquizrules
|
||||||
|
|
||||||
|
response, err := c.DifferentService.Gettingquizrules(ctx.Context())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.Status(fiber.StatusOK).JSON(response)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DifferentController) Gettingtagsfromcash(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Gettingtagsfromcash
|
||||||
|
|
||||||
|
response, err := c.DifferentService.Gettingtagsfromcash(ctx.Context())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.Status(fiber.StatusOK).JSON(response)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DifferentController) Updatelisttags(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Updatelisttags
|
||||||
|
|
||||||
|
err := c.DifferentService.Updatelisttags(ctx.Context())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.SendStatus(fiber.StatusOK)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *DifferentController) Gettingfieldsfromcash(ctx *fiber.Ctx) error {
|
||||||
|
// Обработчик для метода Gettingfieldsfromcash
|
||||||
|
|
||||||
|
response, err := c.DifferentService.Gettingfieldsfromcash(ctx.Context())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
}
|
||||||
|
return ctx.Status(fiber.StatusOK).JSON(response)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (c *DifferentController) Updatelistcustom(ctx *fiber.Ctx) error {
|
func (c *DifferentController) Updatelistcustom(ctx *fiber.Ctx) error {
|
||||||
// Обработчик для метода Updatelistcustom
|
// Обработчик для метода Updatelistcustom
|
||||||
|
|
||||||
@ -115,51 +216,3 @@ func (c *DifferentController) Updatelistcustom(ctx *fiber.Ctx) error {
|
|||||||
return ctx.SendStatus(fiber.StatusOK)
|
return ctx.SendStatus(fiber.StatusOK)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DifferentController) Getlistpipelines(ctx *fiber.Ctx) error {
|
|
||||||
// Обработчик для метода Getlistpipelines
|
|
||||||
|
|
||||||
err := c.DifferentService.Getlistpipelines(ctx.Context())
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
|
||||||
}
|
|
||||||
return ctx.SendStatus(fiber.StatusOK)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *DifferentController) Updatelistpipelines(ctx *fiber.Ctx) error {
|
|
||||||
// Обработчик для метода Updatelistpipelines
|
|
||||||
|
|
||||||
err := c.DifferentService.Updatelistpipelines(ctx.Context())
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
|
||||||
}
|
|
||||||
return ctx.SendStatus(fiber.StatusOK)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *DifferentController) Getliststeps(ctx *fiber.Ctx) error {
|
|
||||||
// Обработчик для метода Getliststeps
|
|
||||||
|
|
||||||
err := c.DifferentService.Getliststeps(ctx.Context())
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
|
||||||
}
|
|
||||||
return ctx.SendStatus(fiber.StatusOK)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *DifferentController) Updateliststeps(ctx *fiber.Ctx) error {
|
|
||||||
// Обработчик для метода Updateliststeps
|
|
||||||
|
|
||||||
err := c.DifferentService.Updateliststeps(ctx.Context())
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
|
||||||
}
|
|
||||||
return ctx.SendStatus(fiber.StatusOK)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
22
internal/models/field.go
Normal file
22
internal/models/field.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Field struct {
|
||||||
|
/* - таймштамп создания воронки в нашей системе*/
|
||||||
|
Createdat int `json:"CreatedAt"`
|
||||||
|
/* - флаг мягкого удаления*/
|
||||||
|
Deleted bool `json:"Deleted"`
|
||||||
|
/* - тип сущности в амо, для которой это кастомное поле*/
|
||||||
|
Entitytype string `json:"EntityType"`
|
||||||
|
/* - айдишник в нашей системе*/
|
||||||
|
ID int `json:"ID"`
|
||||||
|
/* - название воронки в амо*/
|
||||||
|
Name string `json:"Name"`
|
||||||
|
/* - тип поля https://www.amocrm.ru/developers/content/crm_platform/custom-fields#%D0%94%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%BD%D1%8B%D0%B5-%D1%82%D0%B8%D0%BF%D1%8B-%D0%BF%D0%BE%D0%BB%D0%B5%D0%B9*/
|
||||||
|
Type string `json:"Type"`
|
||||||
|
/* - связь с аккаунтом в интеграции амо*/
|
||||||
|
Accountid string `json:"AccountID"`
|
||||||
|
/* - айдишник кастомного поля в амо*/
|
||||||
|
Amoid int `json:"AmoID"`
|
||||||
|
/* - кодовое слово в амо*/
|
||||||
|
Code string `json:"Code"`
|
||||||
|
}
|
6
internal/models/fieldrule.go
Normal file
6
internal/models/fieldrule.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type FieldRule struct {
|
||||||
|
/* - сопоставление айдишника вопроса полю, которое будет заполняться ответом. соответственно QuestionID это айдишник вопроса. это я так мэпу пытался записать*/
|
||||||
|
Questionid int `json:"QuestionID"`
|
||||||
|
}
|
@ -1,6 +1,12 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type GetCurrentAccountResp struct {
|
type GetCurrentAccountResp struct {
|
||||||
|
/* - uuid*/
|
||||||
|
ID string `json:"ID"`
|
||||||
|
/* - имя аккаунта в амо*/
|
||||||
|
Name string `json:"Name"`
|
||||||
|
/* - поддомен организации в амо*/
|
||||||
|
Subdomain string `json:"Subdomain"`
|
||||||
/* - связь с аккаунтом в квизе*/
|
/* - связь с аккаунтом в квизе*/
|
||||||
Accountid string `json:"AccountID"`
|
Accountid string `json:"AccountID"`
|
||||||
/* - айдишник пользвателя, который подключал интеграцию*/
|
/* - айдишник пользвателя, который подключал интеграцию*/
|
||||||
@ -9,10 +15,6 @@ type GetCurrentAccountResp struct {
|
|||||||
Amocrmid int `json:"AmocrmID"`
|
Amocrmid int `json:"AmocrmID"`
|
||||||
/* - страна указанная в настройках амо*/
|
/* - страна указанная в настройках амо*/
|
||||||
Country string `json:"Country"`
|
Country string `json:"Country"`
|
||||||
/* - uuid*/
|
/* - таймштамп создания аккаунта*/
|
||||||
ID string `json:"ID"`
|
Createdat int `json:"CreatedAt"`
|
||||||
/* - имя аккаунта в амо*/
|
|
||||||
Name string `json:"Name"`
|
|
||||||
/* - поддомен организации в амо*/
|
|
||||||
Subdomain string `json:"Subdomain"`
|
|
||||||
}
|
}
|
||||||
|
8
internal/models/getlistuserutmresp.go
Normal file
8
internal/models/getlistuserutmresp.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type GetListUserUTMResp struct {
|
||||||
|
/* - общее количество юзеров, которые у нас закешированы для этого пользователя*/
|
||||||
|
Count int `json:"count"`
|
||||||
|
/* - список юзеров, которые были закешированы нашим сервисом*/
|
||||||
|
Items []UTM `json:"items"`
|
||||||
|
}
|
6
internal/models/listdeleteutmidsreq.go
Normal file
6
internal/models/listdeleteutmidsreq.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type ListDeleteUTMIDsReq struct {
|
||||||
|
/* - список айдишников utm которые удалить*/
|
||||||
|
Utms []int `json:"utms"`
|
||||||
|
}
|
6
internal/models/listsavedidutmresp.go
Normal file
6
internal/models/listsavedidutmresp.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type ListSavedIDUTMResp struct {
|
||||||
|
/* - список айдишников сохранённых меток*/
|
||||||
|
Ids []string `json:"IDs"`
|
||||||
|
}
|
8
internal/models/paginationreq.go
Normal file
8
internal/models/paginationreq.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type PaginationReq struct {
|
||||||
|
/* - указание страницы пагинации. Если страница не указана, применять 0*/
|
||||||
|
Page int `json:"page"`
|
||||||
|
/* - указание размера страницы пагинации. По умолчанию применять 25*/
|
||||||
|
Size int `json:"size"`
|
||||||
|
}
|
18
internal/models/pipeline.go
Normal file
18
internal/models/pipeline.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Pipeline struct {
|
||||||
|
/* - таймштамп создания воронки в нашей системе*/
|
||||||
|
Createdat int `json:"CreatedAt"`
|
||||||
|
/* - флаг мягкого удаления*/
|
||||||
|
Deleted bool `json:"Deleted"`
|
||||||
|
/* - айдишник в нашей системе*/
|
||||||
|
ID int `json:"ID"`
|
||||||
|
/* - флаг архивной воронки в амо*/
|
||||||
|
Isarchive bool `json:"IsArchive"`
|
||||||
|
/* - название воронки в амо*/
|
||||||
|
Name string `json:"Name"`
|
||||||
|
/* - связь с аккаунтом в интеграции амо*/
|
||||||
|
Accountid string `json:"AccountID"`
|
||||||
|
/* - айдишник воронки в амо*/
|
||||||
|
Amoid int `json:"AmoID"`
|
||||||
|
}
|
24
internal/models/rule.go
Normal file
24
internal/models/rule.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Rule struct {
|
||||||
|
/* - айдишник воронки*/
|
||||||
|
Pipelineid int `json:"PipelineID"`
|
||||||
|
/* - айдишник опроса*/
|
||||||
|
Quizid int `json:"QuizID"`
|
||||||
|
/* - айдишник этапа*/
|
||||||
|
Stepid int `json:"StepID"`
|
||||||
|
/* - список UTM для этого опроса*/
|
||||||
|
Utms []int `json:"UTMs"`
|
||||||
|
/* - связь с аккаунтом в интеграции амо*/
|
||||||
|
Accountid string `json:"AccountID"`
|
||||||
|
/* - таймштамп создания воронки в нашей системе*/
|
||||||
|
Createdat int `json:"CreatedAt"`
|
||||||
|
/* - флаг мягкого удаления*/
|
||||||
|
Deleted bool `json:"Deleted"`
|
||||||
|
/* - правила заполнения полей сущностей в амо*/
|
||||||
|
Fieldsrule Fieldsrule `json:"FieldsRule"`
|
||||||
|
/* - айдишник в нашей системе*/
|
||||||
|
ID int `json:"ID"`
|
||||||
|
/* - айдишник ответственного за сделку*/
|
||||||
|
Performerid int `json:"PerformerID"`
|
||||||
|
}
|
6
internal/models/rulesreq.go
Normal file
6
internal/models/rulesreq.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type RulesReq struct {
|
||||||
|
/* - ID квиза*/
|
||||||
|
ID string `json:"ID"`
|
||||||
|
}
|
6
internal/models/saveuserlistutmreq.go
Normal file
6
internal/models/saveuserlistutmreq.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type SaveUserListUTMReq struct {
|
||||||
|
/* - список utm для сохранения. сохранять только те, которых в этом аккаунте ещё нет*/
|
||||||
|
Utms []string `json:"utms"`
|
||||||
|
}
|
20
internal/models/step.go
Normal file
20
internal/models/step.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Step struct {
|
||||||
|
/* - айдишник воронки в амо*/
|
||||||
|
Pipelineid int `json:"PipelineID"`
|
||||||
|
/* - связь с аккаунтом в интеграции амо*/
|
||||||
|
Accountid string `json:"AccountID"`
|
||||||
|
/* - айдишник шага воронки в амо*/
|
||||||
|
Amoid int `json:"AmoID"`
|
||||||
|
/* - цвет шага в амо*/
|
||||||
|
Color string `json:"Color"`
|
||||||
|
/* - таймштамп создания воронки в нашей системе*/
|
||||||
|
Createdat int `json:"CreatedAt"`
|
||||||
|
/* - флаг мягкого удаления*/
|
||||||
|
Deleted bool `json:"Deleted"`
|
||||||
|
/* - айдишник в нашей системе*/
|
||||||
|
ID int `json:"ID"`
|
||||||
|
/* - название воронки в амо*/
|
||||||
|
Name string `json:"Name"`
|
||||||
|
}
|
20
internal/models/tag.go
Normal file
20
internal/models/tag.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Tag struct {
|
||||||
|
/* - таймштамп создания тега в нашей системе*/
|
||||||
|
Createdat int `json:"CreatedAt"`
|
||||||
|
/* - флаг мягкого удаления*/
|
||||||
|
Deleted bool `json:"Deleted"`
|
||||||
|
/* - сущность, к которой принадлежит этот тег. Наверное, стоит сделать через enum в базе*/
|
||||||
|
Entity string `json:"Entity"`
|
||||||
|
/* - айдишник в нашей системе*/
|
||||||
|
ID int `json:"ID"`
|
||||||
|
/* - название тега в амо*/
|
||||||
|
Name string `json:"Name"`
|
||||||
|
/* - связь с аккаунтом в интеграции амо*/
|
||||||
|
Accountid string `json:"AccountID"`
|
||||||
|
/* - айдишник тега в амо*/
|
||||||
|
Amoid int `json:"AmoID"`
|
||||||
|
/* - цвет тега в амо*/
|
||||||
|
Color string `json:"Color"`
|
||||||
|
}
|
22
internal/models/user.go
Normal file
22
internal/models/user.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type User struct {
|
||||||
|
/* - связь с аккаунтом в интеграции амо*/
|
||||||
|
Accountid string `json:"AccountID"`
|
||||||
|
/* - таймштамп создания тега в нашей системе*/
|
||||||
|
Createdat int `json:"CreatedAt"`
|
||||||
|
/* - флаг мягкого удаления*/
|
||||||
|
Deleted bool `json:"Deleted"`
|
||||||
|
/* - почта пользователя из амо*/
|
||||||
|
Email string `json:"Email"`
|
||||||
|
/* - айдишник в нашей системе*/
|
||||||
|
ID int `json:"ID"`
|
||||||
|
/* - айдишник пользователя в амо*/
|
||||||
|
Amoid int `json:"AmoID"`
|
||||||
|
/* - руппа пользователя в амо*/
|
||||||
|
Group string `json:"Group"`
|
||||||
|
/* - имя пользователя в амо*/
|
||||||
|
Name string `json:"Name"`
|
||||||
|
/* - роль пользователя в амо*/
|
||||||
|
Role string `json:"Role"`
|
||||||
|
}
|
8
internal/models/userlistfieldsresp.go
Normal file
8
internal/models/userlistfieldsresp.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type UserListFieldsResp struct {
|
||||||
|
/* - общее количество кастомных полей, которые у нас закешированы для этого пользователя*/
|
||||||
|
Count int `json:"count"`
|
||||||
|
/* - список кастомных полей, которые были закешированы нашим сервисом*/
|
||||||
|
Items []Field `json:"items"`
|
||||||
|
}
|
8
internal/models/userlistpipelinesresp.go
Normal file
8
internal/models/userlistpipelinesresp.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type UserListPipelinesResp struct {
|
||||||
|
/* - общее количество воронок, которые у нас закешированы для этого пользователя*/
|
||||||
|
Count int `json:"count"`
|
||||||
|
/* - список воронок, которые были закешированы нашим сервисом*/
|
||||||
|
Items []Pipeline `json:"items"`
|
||||||
|
}
|
8
internal/models/userlistresp.go
Normal file
8
internal/models/userlistresp.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type UserListResp struct {
|
||||||
|
/* - общее количество юзеров, которые у нас закешированы для этого пользователя*/
|
||||||
|
Count int `json:"count"`
|
||||||
|
/* - список юзеров, которые были закешированы нашим сервисом*/
|
||||||
|
Items []User `json:"items"`
|
||||||
|
}
|
8
internal/models/userliststepsresp.go
Normal file
8
internal/models/userliststepsresp.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type UserListStepsResp struct {
|
||||||
|
/* - список шагов воронок, которые были закешированы нашим сервисом*/
|
||||||
|
Items []Step `json:"items"`
|
||||||
|
/* - общее количество шагов воронок, которые у нас закешированы для этого пользователя*/
|
||||||
|
Count int `json:"count"`
|
||||||
|
}
|
8
internal/models/userlisttagsresp.go
Normal file
8
internal/models/userlisttagsresp.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type UserListTagsResp struct {
|
||||||
|
/* - общее количество тегов, которые у нас закешированы для этого пользователя*/
|
||||||
|
Count int `json:"count"`
|
||||||
|
/* - список тегов, которые были закешированы нашим сервисом*/
|
||||||
|
Items []Tag `json:"items"`
|
||||||
|
}
|
18
internal/models/utm.go
Normal file
18
internal/models/utm.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type UTM struct {
|
||||||
|
/* - название тега в амо*/
|
||||||
|
Name string `json:"Name"`
|
||||||
|
/* - айдишник квиза*/
|
||||||
|
Quizid int `json:"QuizID"`
|
||||||
|
/* - связь с аккаунтом в интеграции амо*/
|
||||||
|
Accountid string `json:"AccountID"`
|
||||||
|
/* - айдишник кастомного поля в амо*/
|
||||||
|
Amofieldid int `json:"AmoFieldID"`
|
||||||
|
/* - таймштамп создания тега в нашей системе*/
|
||||||
|
Createdat int `json:"CreatedAt"`
|
||||||
|
/* - флаг мягкого удаления*/
|
||||||
|
Deleted bool `json:"Deleted"`
|
||||||
|
/* - айдишник в нашей системе*/
|
||||||
|
ID int `json:"ID"`
|
||||||
|
}
|
@ -12,20 +12,41 @@ func NewAccountRepository() *AccountRepository {
|
|||||||
return &AccountRepository{}
|
return &AccountRepository{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *AccountRepository) Getlistusers(ctx context.Context) error {
|
func (r *AccountRepository) Updatelistusers(ctx context.Context) error {
|
||||||
//TODO:IMPLEMENT ME
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *AccountRepository) Updatelistusers(ctx context.Context) error {
|
func (r *AccountRepository) Gettinguserfromcash(ctx context.Context) (*models.UserListResp, error) {
|
||||||
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
return &models.UserListResp{}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *AccountRepository) Deletinguserutm(ctx context.Context, request *models.ListDeleteUTMIDsReq) error {
|
||||||
//TODO:IMPLEMENT ME
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *AccountRepository) Savinguserutm(ctx context.Context, request *models.SaveUserListUTMReq) (*models.ListSavedIDUTMResp, error) {
|
||||||
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
return &models.ListSavedIDUTMResp{}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *AccountRepository) Gettinguserutm(ctx context.Context) (*models.GetListUserUTMResp, error) {
|
||||||
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
return &models.GetListUserUTMResp{}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (r *AccountRepository) Softdeleteaccount(ctx context.Context) error {
|
func (r *AccountRepository) Softdeleteaccount(ctx context.Context) error {
|
||||||
//TODO:IMPLEMENT ME
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package repository
|
package repository
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"amocrm/internal/models"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,14 +12,14 @@ func NewDifferentRepository() *DifferentRepository {
|
|||||||
return &DifferentRepository{}
|
return &DifferentRepository{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *DifferentRepository) Getlisttags(ctx context.Context) error {
|
func (r *DifferentRepository) Gettingstepsfromcash(ctx context.Context) (*models.UserListStepsResp, error) {
|
||||||
//TODO:IMPLEMENT ME
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
return nil
|
return &models.UserListStepsResp{}, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *DifferentRepository) Updatelisttags(ctx context.Context) error {
|
func (r *DifferentRepository) Updateliststeps(ctx context.Context) error {
|
||||||
//TODO:IMPLEMENT ME
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -39,44 +40,65 @@ func (r *DifferentRepository) Webhookdelete(ctx context.Context) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *DifferentRepository) Getlistcustom(ctx context.Context) error {
|
func (r *DifferentRepository) Updatelistpipelines(ctx context.Context) error {
|
||||||
//TODO:IMPLEMENT ME
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *DifferentRepository) Gettingpipelinesfromcash(ctx context.Context) (*models.UserListPipelinesResp, error) {
|
||||||
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
return &models.UserListPipelinesResp{}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *DifferentRepository) Changequizsettings(ctx context.Context, request *models.RulesReq) error {
|
||||||
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *DifferentRepository) Setquizsettings(ctx context.Context, request *models.RulesReq) error {
|
||||||
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *DifferentRepository) Gettingquizrules(ctx context.Context) (*models.Rule, error) {
|
||||||
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
return &models.Rule{}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *DifferentRepository) Gettingtagsfromcash(ctx context.Context) (*models.UserListTagsResp, error) {
|
||||||
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
return &models.UserListTagsResp{}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *DifferentRepository) Updatelisttags(ctx context.Context) error {
|
||||||
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *DifferentRepository) Gettingfieldsfromcash(ctx context.Context) (*models.UserListFieldsResp, error) {
|
||||||
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
|
return &models.UserListFieldsResp{}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (r *DifferentRepository) Updatelistcustom(ctx context.Context) error {
|
func (r *DifferentRepository) Updatelistcustom(ctx context.Context) error {
|
||||||
//TODO:IMPLEMENT ME
|
//TODO:IMPLEMENT ME
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *DifferentRepository) Getlistpipelines(ctx context.Context) error {
|
|
||||||
//TODO:IMPLEMENT ME
|
|
||||||
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *DifferentRepository) Updatelistpipelines(ctx context.Context) error {
|
|
||||||
//TODO:IMPLEMENT ME
|
|
||||||
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *DifferentRepository) Getliststeps(ctx context.Context) error {
|
|
||||||
//TODO:IMPLEMENT ME
|
|
||||||
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *DifferentRepository) Updateliststeps(ctx context.Context) error {
|
|
||||||
//TODO:IMPLEMENT ME
|
|
||||||
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -16,16 +16,6 @@ func NewAccountService(repository *repository.AccountRepository) *AccountService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AccountService) Getlistusers(ctx context.Context) error {
|
|
||||||
|
|
||||||
err := s.AccountRepository.Getlistusers(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *AccountService) Updatelistusers(ctx context.Context) error {
|
func (s *AccountService) Updatelistusers(ctx context.Context) error {
|
||||||
|
|
||||||
err := s.AccountRepository.Updatelistusers(ctx)
|
err := s.AccountRepository.Updatelistusers(ctx)
|
||||||
@ -36,6 +26,46 @@ func (s *AccountService) Updatelistusers(ctx context.Context) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *AccountService) Gettinguserfromcash(ctx context.Context) (*models.UserListResp, error) {
|
||||||
|
|
||||||
|
response, err := s.AccountRepository.Gettinguserfromcash(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return response, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *AccountService) Deletinguserutm(ctx context.Context, request *models.ListDeleteUTMIDsReq) error {
|
||||||
|
|
||||||
|
err := s.AccountRepository.Deletinguserutm(ctx, request)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *AccountService) Savinguserutm(ctx context.Context, request *models.SaveUserListUTMReq) (*models.ListSavedIDUTMResp, error) {
|
||||||
|
|
||||||
|
response, err := s.AccountRepository.Savinguserutm(ctx, request)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return response, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *AccountService) Gettinguserutm(ctx context.Context) (*models.GetListUserUTMResp, error) {
|
||||||
|
|
||||||
|
response, err := s.AccountRepository.Gettinguserutm(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return response, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (s *AccountService) Softdeleteaccount(ctx context.Context) error {
|
func (s *AccountService) Softdeleteaccount(ctx context.Context) error {
|
||||||
|
|
||||||
err := s.AccountRepository.Softdeleteaccount(ctx)
|
err := s.AccountRepository.Softdeleteaccount(ctx)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"amocrm/internal/models"
|
||||||
"amocrm/internal/repository"
|
"amocrm/internal/repository"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
@ -15,19 +16,19 @@ func NewDifferentService(repository *repository.DifferentRepository) *DifferentS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DifferentService) Getlisttags(ctx context.Context) error {
|
func (s *DifferentService) Gettingstepsfromcash(ctx context.Context) (*models.UserListStepsResp, error) {
|
||||||
|
|
||||||
err := s.DifferentRepository.Getlisttags(ctx)
|
response, err := s.DifferentRepository.Gettingstepsfromcash(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil
|
return response, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DifferentService) Updatelisttags(ctx context.Context) error {
|
func (s *DifferentService) Updateliststeps(ctx context.Context) error {
|
||||||
|
|
||||||
err := s.DifferentRepository.Updatelisttags(ctx)
|
err := s.DifferentRepository.Updateliststeps(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -55,9 +56,9 @@ func (s *DifferentService) Webhookdelete(ctx context.Context) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DifferentService) Getlistcustom(ctx context.Context) error {
|
func (s *DifferentService) Updatelistpipelines(ctx context.Context) error {
|
||||||
|
|
||||||
err := s.DifferentRepository.Getlistcustom(ctx)
|
err := s.DifferentRepository.Updatelistpipelines(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -65,6 +66,76 @@ func (s *DifferentService) Getlistcustom(ctx context.Context) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *DifferentService) Gettingpipelinesfromcash(ctx context.Context) (*models.UserListPipelinesResp, error) {
|
||||||
|
|
||||||
|
response, err := s.DifferentRepository.Gettingpipelinesfromcash(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return response, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DifferentService) Changequizsettings(ctx context.Context, request *models.RulesReq) error {
|
||||||
|
|
||||||
|
err := s.DifferentRepository.Changequizsettings(ctx, request)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DifferentService) Setquizsettings(ctx context.Context, request *models.RulesReq) error {
|
||||||
|
|
||||||
|
err := s.DifferentRepository.Setquizsettings(ctx, request)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DifferentService) Gettingquizrules(ctx context.Context) (*models.Rule, error) {
|
||||||
|
|
||||||
|
response, err := s.DifferentRepository.Gettingquizrules(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return response, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DifferentService) Gettingtagsfromcash(ctx context.Context) (*models.UserListTagsResp, error) {
|
||||||
|
|
||||||
|
response, err := s.DifferentRepository.Gettingtagsfromcash(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return response, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DifferentService) Updatelisttags(ctx context.Context) error {
|
||||||
|
|
||||||
|
err := s.DifferentRepository.Updatelisttags(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DifferentService) Gettingfieldsfromcash(ctx context.Context) (*models.UserListFieldsResp, error) {
|
||||||
|
|
||||||
|
response, err := s.DifferentRepository.Gettingfieldsfromcash(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return response, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (s *DifferentService) Updatelistcustom(ctx context.Context) error {
|
func (s *DifferentService) Updatelistcustom(ctx context.Context) error {
|
||||||
|
|
||||||
err := s.DifferentRepository.Updatelistcustom(ctx)
|
err := s.DifferentRepository.Updatelistcustom(ctx)
|
||||||
@ -74,43 +145,3 @@ func (s *DifferentService) Updatelistcustom(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DifferentService) Getlistpipelines(ctx context.Context) error {
|
|
||||||
|
|
||||||
err := s.DifferentRepository.Getlistpipelines(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DifferentService) Updatelistpipelines(ctx context.Context) error {
|
|
||||||
|
|
||||||
err := s.DifferentRepository.Updatelistpipelines(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DifferentService) Getliststeps(ctx context.Context) error {
|
|
||||||
|
|
||||||
err := s.DifferentRepository.Getliststeps(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DifferentService) Updateliststeps(ctx context.Context) error {
|
|
||||||
|
|
||||||
err := s.DifferentRepository.Updateliststeps(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
91
openapi.yaml
91
openapi.yaml
@ -70,6 +70,12 @@ paths:
|
|||||||
- account
|
- account
|
||||||
description: получение списка заданных юзером utm меток. Это чисто наша сущность, в амо она представлена кастомными полями сделки
|
description: получение списка заданных юзером utm меток. Это чисто наша сущность, в амо она представлена кастомными полями сделки
|
||||||
parameters:
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: quizID
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Id квиза
|
||||||
- in: query
|
- in: query
|
||||||
name: Pagination
|
name: Pagination
|
||||||
description: Параметры пагинации
|
description: Параметры пагинации
|
||||||
@ -95,6 +101,7 @@ paths:
|
|||||||
'application/json':
|
'application/json':
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/GetListUserUTMResp'
|
$ref: '#/components/schemas/GetListUserUTMResp'
|
||||||
|
/utms:
|
||||||
post:
|
post:
|
||||||
operationId: SavingUserUTM
|
operationId: SavingUserUTM
|
||||||
tags:
|
tags:
|
||||||
@ -325,13 +332,20 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Success
|
description: Success
|
||||||
# блупринт с таким роутом не работает надо будет пересмотреть такие пути
|
# таких запросах для блупринта обязательно нужно указывать параметры
|
||||||
/rules/{quizID}:
|
/rules/{quizID}:
|
||||||
get:
|
get:
|
||||||
operationId: GettingQuizRules
|
operationId: GettingQuizRules
|
||||||
tags:
|
tags:
|
||||||
- different
|
- different
|
||||||
description: получение настроек интеграции для конкретного квиза
|
description: получение настроек интеграции для конкретного квиза
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: quizID
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Id квиза
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: успешное получение настройки интеграции
|
description: успешное получение настройки интеграции
|
||||||
@ -339,11 +353,17 @@ paths:
|
|||||||
'application/json':
|
'application/json':
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Rule"
|
$ref: "#/components/schemas/Rule"
|
||||||
|
/rules:
|
||||||
post:
|
post:
|
||||||
operationId: SetQuizSettings
|
operationId: SetQuizSettings
|
||||||
description: создание настроек интеграции для конкретного квиза
|
description: создание настроек интеграции для конкретного квиза
|
||||||
tags:
|
tags:
|
||||||
- different
|
- different
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/RulesReq"
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Success
|
description: Success
|
||||||
@ -352,6 +372,11 @@ paths:
|
|||||||
description: изменение настроек интеграции для конкретного квиза
|
description: изменение настроек интеграции для конкретного квиза
|
||||||
tags:
|
tags:
|
||||||
- different
|
- different
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/RulesReq"
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Success
|
description: Success
|
||||||
@ -718,3 +743,67 @@ components:
|
|||||||
size:
|
size:
|
||||||
type: integer
|
type: integer
|
||||||
description: указание размера страницы пагинации. По умолчанию применять 25
|
description: указание размера страницы пагинации. По умолчанию применять 25
|
||||||
|
RulesReq:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
ID:
|
||||||
|
type: string
|
||||||
|
description: ID квиза
|
||||||
|
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Success
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Success
|
||||||
|
'201':
|
||||||
|
description: Created
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Created
|
||||||
|
'204':
|
||||||
|
description: No content
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: No content
|
||||||
|
'400':
|
||||||
|
description: Bad Request
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Bad Request
|
||||||
|
'401':
|
||||||
|
description: Unauthorized
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Unauthorized
|
||||||
|
'403':
|
||||||
|
description: Forbidden
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Forbidden
|
||||||
|
'404':
|
||||||
|
description: Not Found
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Not Found
|
||||||
|
'500':
|
||||||
|
description: Internal Server Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Internal Server Error
|
||||||
|
Loading…
Reference in New Issue
Block a user