166 lines
4.2 KiB
Go
166 lines
4.2 KiB
Go
|
package controllers
|
||
|
|
||
|
import (
|
||
|
"amocrm/internal/service"
|
||
|
|
||
|
"github.com/gofiber/fiber/v2"
|
||
|
)
|
||
|
|
||
|
type DifferentController struct {
|
||
|
DifferentService *service.DifferentService
|
||
|
}
|
||
|
|
||
|
func NewDifferentController(service *service.DifferentService) *DifferentController {
|
||
|
return &DifferentController{
|
||
|
DifferentService: service,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (c *DifferentController) Register(router fiber.Router) {
|
||
|
|
||
|
router.Get("/tags", c.Getlisttags)
|
||
|
|
||
|
router.Patch("/tags", c.Updatelisttags)
|
||
|
|
||
|
router.Get("/webhook/create", c.Webhookcreate)
|
||
|
|
||
|
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.Get("/steps", c.Getliststeps)
|
||
|
|
||
|
router.Patch("/steps", c.Updateliststeps)
|
||
|
|
||
|
}
|
||
|
|
||
|
func (c *DifferentController) Name() string {
|
||
|
return ""
|
||
|
}
|
||
|
|
||
|
func (c *DifferentController) Getlisttags(ctx *fiber.Ctx) error {
|
||
|
// Обработчик для метода Getlisttags
|
||
|
|
||
|
err := c.DifferentService.Getlisttags(ctx.Context())
|
||
|
|
||
|
if err != nil {
|
||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||
|
}
|
||
|
return ctx.SendStatus(fiber.StatusOK)
|
||
|
|
||
|
}
|
||
|
|
||
|
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) Webhookcreate(ctx *fiber.Ctx) error {
|
||
|
// Обработчик для метода Webhookcreate
|
||
|
|
||
|
err := c.DifferentService.Webhookcreate(ctx.Context())
|
||
|
|
||
|
if err != nil {
|
||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||
|
}
|
||
|
return ctx.SendStatus(fiber.StatusOK)
|
||
|
|
||
|
}
|
||
|
|
||
|
func (c *DifferentController) Webhookdelete(ctx *fiber.Ctx) error {
|
||
|
// Обработчик для метода Webhookdelete
|
||
|
|
||
|
err := c.DifferentService.Webhookdelete(ctx.Context())
|
||
|
|
||
|
if err != nil {
|
||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||
|
}
|
||
|
return ctx.SendStatus(fiber.StatusOK)
|
||
|
|
||
|
}
|
||
|
|
||
|
func (c *DifferentController) Getlistcustom(ctx *fiber.Ctx) error {
|
||
|
// Обработчик для метода Getlistcustom
|
||
|
|
||
|
err := c.DifferentService.Getlistcustom(ctx.Context())
|
||
|
|
||
|
if err != nil {
|
||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||
|
}
|
||
|
return ctx.SendStatus(fiber.StatusOK)
|
||
|
|
||
|
}
|
||
|
|
||
|
func (c *DifferentController) Updatelistcustom(ctx *fiber.Ctx) error {
|
||
|
// Обработчик для метода Updatelistcustom
|
||
|
|
||
|
err := c.DifferentService.Updatelistcustom(ctx.Context())
|
||
|
|
||
|
if err != nil {
|
||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||
|
}
|
||
|
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)
|
||
|
|
||
|
}
|