diff --git a/main b/main index cd79574..30b56d1 100755 Binary files a/main and b/main differ diff --git a/modules/structs/crm.go b/modules/structs/crm.go index 8302033..d4982be 100644 --- a/modules/structs/crm.go +++ b/modules/structs/crm.go @@ -47,6 +47,8 @@ type CrmTableCustomerResponse struct { type CrmTableCustomer struct { Id string + Pipeline uint8 + DealPhase uint8 FirstName string LastName string CreatedAt time.Time diff --git a/public/swagger/swagger.json b/public/swagger/swagger.json index e1bf3db..99a8001 100644 --- a/public/swagger/swagger.json +++ b/public/swagger/swagger.json @@ -85,6 +85,9 @@ "401": { "description": "No permissions" }, + "409": { + "description": "Crm customer with the company name already exists" + }, "500": { "description": "Failed to create crm customer" } @@ -132,6 +135,9 @@ "404": { "description": "Crm customer not found" }, + "409": { + "description": "Crm customer with the company name already exists" + }, "500": { "description": "Failed to update crm customer" } diff --git a/routers/router/api/v1/crm/crm.go b/routers/router/api/v1/crm/crm.go index 9daba9d..185a0b4 100644 --- a/routers/router/api/v1/crm/crm.go +++ b/routers/router/api/v1/crm/crm.go @@ -16,6 +16,15 @@ import ( "gorm.io/gorm" ) +// testing +func GetAllCustomers(c *fiber.Ctx) error { + var customers []structs.CrmTableCustomer + + database.DB.Find(&customers) + + return c.JSON(customers) +} + func GetCrmTypeCustomers(c *fiber.Ctx) error { // swagger:operation GET /crm/pipeline/{type}/{dealPhase} crm crmGetCrmCustomers // --- diff --git a/routers/router/router.go b/routers/router/router.go index 3e6db51..4ca7f08 100644 --- a/routers/router/router.go +++ b/routers/router/router.go @@ -73,6 +73,8 @@ func SetupRoutes(app *fiber.App) { c.Post("/customer/update/:id", requestAccessValidation, crm.UpdateCrmCustomer) c.Post("/customer/create", requestAccessValidation, crm.CreateCrmCustomer) + c.Get("/customers", requestAccessValidation, crm.GetAllCustomers) + app.Static("/", config.Cfg.FolderPaths.PublicStatic) }