fix : fixing update products, banner, sales_agents
This commit is contained in:
parent
1bef2a45e5
commit
bb53b92cc1
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/gofiber/fiber/v2"
|
||||
|
||||
utilRes "jaecoo-be/utils/response"
|
||||
utilVal "jaecoo-be/utils/validator"
|
||||
)
|
||||
|
||||
type bannersController struct {
|
||||
|
|
@ -171,12 +170,17 @@ func (_i *bannersController) Save(c *fiber.Ctx) error {
|
|||
|
||||
// Update Banner
|
||||
// @Summary Update Banner
|
||||
// @Description API for updating Banner
|
||||
// @Description API for updating Banner with file upload
|
||||
// @Tags Banners
|
||||
// @Security Bearer
|
||||
// @Param X-Client-Key header string true "Insert the X-Client-Key"
|
||||
// @Param id path int true "Banner ID"
|
||||
// @Param payload body request.BannersUpdateRequest true "Required payload"
|
||||
// @Param file formData file false "Upload file"
|
||||
// @Param title formData string false "Banner title"
|
||||
// @Param description formData string false "Banner description"
|
||||
// @Param position formData string false "Banner position"
|
||||
// @Param status formData string false "Banner status"
|
||||
// @Param is_active formData bool false "Banner is_active"
|
||||
// @Success 200 {object} response.Response
|
||||
// @Failure 400 {object} response.BadRequestError
|
||||
// @Failure 401 {object} response.UnauthorizedError
|
||||
|
|
@ -188,12 +192,45 @@ func (_i *bannersController) Update(c *fiber.Ctx) error {
|
|||
return err
|
||||
}
|
||||
|
||||
req := new(request.BannersUpdateRequest)
|
||||
if err := utilVal.ParseAndValidate(c, req); err != nil {
|
||||
return err
|
||||
// Parse multipart form
|
||||
form, err := c.MultipartForm()
|
||||
if err != nil {
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: false,
|
||||
Messages: utilRes.Messages{"Failed to parse form data"},
|
||||
})
|
||||
}
|
||||
|
||||
dataResult, err := _i.bannersService.Update(uint(id), *req)
|
||||
// Extract form values
|
||||
req := request.BannersUpdateRequest{}
|
||||
|
||||
if title := c.FormValue("title"); title != "" {
|
||||
req.Title = &title
|
||||
}
|
||||
|
||||
if description := c.FormValue("description"); description != "" {
|
||||
req.Description = &description
|
||||
}
|
||||
|
||||
if position := c.FormValue("position"); position != "" {
|
||||
req.Position = &position
|
||||
}
|
||||
|
||||
if status := c.FormValue("status"); status != "" {
|
||||
req.Status = &status
|
||||
}
|
||||
|
||||
if isActiveStr := c.FormValue("is_active"); isActiveStr != "" {
|
||||
isActive := isActiveStr == "true" || isActiveStr == "1"
|
||||
req.IsActive = &isActive
|
||||
}
|
||||
|
||||
// Check if file is uploaded
|
||||
if len(form.File["file"]) > 0 {
|
||||
// File will be handled in service
|
||||
}
|
||||
|
||||
dataResult, err := _i.bannersService.Update(c, uint(id), req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ type BannersService interface {
|
|||
GetAll(req request.BannersQueryRequest) (banners []*response.BannersResponse, paging paginator.Pagination, err error)
|
||||
GetOne(id uint) (banner *response.BannersResponse, err error)
|
||||
Create(c *fiber.Ctx, req request.BannersCreateRequest) (banner *response.BannersResponse, err error)
|
||||
Update(id uint, req request.BannersUpdateRequest) (banner *response.BannersResponse, err error)
|
||||
Update(c *fiber.Ctx, id uint, req request.BannersUpdateRequest) (banner *response.BannersResponse, err error)
|
||||
Delete(id uint) (err error)
|
||||
UploadFileToMinio(c *fiber.Ctx, fileKey string) (filePath *string, err error)
|
||||
Viewer(c *fiber.Ctx) (err error)
|
||||
|
|
@ -168,7 +168,12 @@ func (_i *bannersService) UploadFileToMinio(c *fiber.Ctx, fileKey string) (fileP
|
|||
return &objectName, nil
|
||||
}
|
||||
|
||||
func (_i *bannersService) Update(id uint, req request.BannersUpdateRequest) (banner *response.BannersResponse, err error) {
|
||||
func (_i *bannersService) Update(c *fiber.Ctx, id uint, req request.BannersUpdateRequest) (banner *response.BannersResponse, err error) {
|
||||
// Handle file upload if exists
|
||||
if filePath, uploadErr := _i.UploadFileToMinio(c, "file"); uploadErr == nil && filePath != nil {
|
||||
req.ThumbnailPath = filePath
|
||||
}
|
||||
|
||||
bannerEntity := req.ToEntity()
|
||||
|
||||
err = _i.Repo.Update(id, bannerEntity)
|
||||
|
|
|
|||
|
|
@ -175,12 +175,17 @@ func (_i *productsController) Save(c *fiber.Ctx) error {
|
|||
|
||||
// Update Product
|
||||
// @Summary Update Product
|
||||
// @Description API for updating Product
|
||||
// @Description API for updating Product with file upload
|
||||
// @Tags Products
|
||||
// @Security Bearer
|
||||
// @Param X-Client-Key header string true "Insert the X-Client-Key"
|
||||
// @Param id path int true "Product ID"
|
||||
// @Param payload body request.ProductsUpdateRequest true "Required payload"
|
||||
// @Param file formData file false "Upload file"
|
||||
// @Param title formData string false "Product title"
|
||||
// @Param variant formData string false "Product variant"
|
||||
// @Param price formData string false "Product price"
|
||||
// @Param colors formData string false "Product colors (JSON array)"
|
||||
// @Param is_active formData bool false "Product is_active"
|
||||
// @Success 200 {object} response.Response
|
||||
// @Failure 400 {object} response.BadRequestError
|
||||
// @Failure 401 {object} response.UnauthorizedError
|
||||
|
|
@ -192,12 +197,49 @@ func (_i *productsController) Update(c *fiber.Ctx) error {
|
|||
return err
|
||||
}
|
||||
|
||||
req := new(request.ProductsUpdateRequest)
|
||||
if err := utilVal.ParseAndValidate(c, req); err != nil {
|
||||
return err
|
||||
// Parse multipart form
|
||||
form, err := c.MultipartForm()
|
||||
if err != nil {
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: false,
|
||||
Messages: utilRes.Messages{"Failed to parse form data"},
|
||||
})
|
||||
}
|
||||
|
||||
dataResult, err := _i.productsService.Update(uint(id), *req)
|
||||
// Extract form values
|
||||
req := request.ProductsUpdateRequest{}
|
||||
|
||||
if title := c.FormValue("title"); title != "" {
|
||||
req.Title = &title
|
||||
}
|
||||
|
||||
if variant := c.FormValue("variant"); variant != "" {
|
||||
req.Variant = &variant
|
||||
}
|
||||
|
||||
if price := c.FormValue("price"); price != "" {
|
||||
req.Price = &price
|
||||
}
|
||||
|
||||
// Handle colors (JSON array string)
|
||||
if colorsStr := c.FormValue("colors"); colorsStr != "" {
|
||||
var colors []string
|
||||
if err := json.Unmarshal([]byte(colorsStr), &colors); err == nil {
|
||||
req.Colors = colors
|
||||
}
|
||||
}
|
||||
|
||||
if isActiveStr := c.FormValue("is_active"); isActiveStr != "" {
|
||||
isActive := isActiveStr == "true" || isActiveStr == "1"
|
||||
req.IsActive = &isActive
|
||||
}
|
||||
|
||||
// Check if file is uploaded
|
||||
if len(form.File["file"]) > 0 {
|
||||
// File will be handled in service
|
||||
}
|
||||
|
||||
dataResult, err := _i.productsService.Update(c, uint(id), req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ type ProductsService interface {
|
|||
GetAll(req request.ProductsQueryRequest) (products []*response.ProductsResponse, paging paginator.Pagination, err error)
|
||||
GetOne(id uint) (product *response.ProductsResponse, err error)
|
||||
Create(c *fiber.Ctx, req request.ProductsCreateRequest) (product *response.ProductsResponse, err error)
|
||||
Update(id uint, req request.ProductsUpdateRequest) (product *response.ProductsResponse, err error)
|
||||
Update(c *fiber.Ctx, id uint, req request.ProductsUpdateRequest) (product *response.ProductsResponse, err error)
|
||||
Delete(id uint) (err error)
|
||||
UploadFileToMinio(c *fiber.Ctx, fileKey string) (filePath *string, err error)
|
||||
Viewer(c *fiber.Ctx) (err error)
|
||||
|
|
@ -168,7 +168,12 @@ func (_i *productsService) UploadFileToMinio(c *fiber.Ctx, fileKey string) (file
|
|||
return &objectName, nil
|
||||
}
|
||||
|
||||
func (_i *productsService) Update(id uint, req request.ProductsUpdateRequest) (product *response.ProductsResponse, err error) {
|
||||
func (_i *productsService) Update(c *fiber.Ctx, id uint, req request.ProductsUpdateRequest) (product *response.ProductsResponse, err error) {
|
||||
// Handle file upload if exists
|
||||
if filePath, uploadErr := _i.UploadFileToMinio(c, "file"); uploadErr == nil && filePath != nil {
|
||||
req.ThumbnailPath = filePath
|
||||
}
|
||||
|
||||
productEntity := req.ToEntity()
|
||||
|
||||
err = _i.Repo.Update(id, productEntity)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package controller
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"jaecoo-be/app/module/sales_agents/request"
|
||||
"jaecoo-be/app/module/sales_agents/service"
|
||||
"jaecoo-be/utils/paginator"
|
||||
|
|
@ -9,7 +10,6 @@ import (
|
|||
"github.com/gofiber/fiber/v2"
|
||||
|
||||
utilRes "jaecoo-be/utils/response"
|
||||
utilVal "jaecoo-be/utils/validator"
|
||||
)
|
||||
|
||||
type salesAgentsController struct {
|
||||
|
|
@ -102,23 +102,65 @@ func (_i *salesAgentsController) Show(c *fiber.Ctx) error {
|
|||
|
||||
// Save SalesAgent
|
||||
// @Summary Create SalesAgent
|
||||
// @Description API for creating SalesAgent
|
||||
// @Description API for creating SalesAgent with file upload
|
||||
// @Tags SalesAgents
|
||||
// @Security Bearer
|
||||
// @Param X-Client-Key header string true "Insert the X-Client-Key"
|
||||
// @Param payload body request.SalesAgentsCreateRequest true "Required payload"
|
||||
// @Param file formData file false "Upload file"
|
||||
// @Param name formData string true "SalesAgent name"
|
||||
// @Param job_title formData string false "SalesAgent job title"
|
||||
// @Param phone formData string false "SalesAgent phone"
|
||||
// @Param agent_type formData string false "SalesAgent agent type (JSON array)"
|
||||
// @Success 200 {object} response.Response
|
||||
// @Failure 400 {object} response.BadRequestError
|
||||
// @Failure 401 {object} response.UnauthorizedError
|
||||
// @Failure 500 {object} response.InternalServerError
|
||||
// @Router /sales-agents [post]
|
||||
func (_i *salesAgentsController) Save(c *fiber.Ctx) error {
|
||||
req := new(request.SalesAgentsCreateRequest)
|
||||
if err := utilVal.ParseAndValidate(c, req); err != nil {
|
||||
return err
|
||||
// Parse multipart form
|
||||
form, err := c.MultipartForm()
|
||||
if err != nil {
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: false,
|
||||
Messages: utilRes.Messages{"Failed to parse form data"},
|
||||
})
|
||||
}
|
||||
|
||||
dataResult, err := _i.salesAgentsService.Create(*req)
|
||||
// Extract form values
|
||||
req := request.SalesAgentsCreateRequest{
|
||||
Name: c.FormValue("name"),
|
||||
}
|
||||
|
||||
if jobTitle := c.FormValue("job_title"); jobTitle != "" {
|
||||
req.JobTitle = &jobTitle
|
||||
}
|
||||
|
||||
if phone := c.FormValue("phone"); phone != "" {
|
||||
req.Phone = &phone
|
||||
}
|
||||
|
||||
// Handle agent_type (JSON array string)
|
||||
if agentTypeStr := c.FormValue("agent_type"); agentTypeStr != "" {
|
||||
var agentType []string
|
||||
if err := json.Unmarshal([]byte(agentTypeStr), &agentType); err == nil {
|
||||
req.AgentType = agentType
|
||||
}
|
||||
}
|
||||
|
||||
// Validate required fields
|
||||
if req.Name == "" {
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: false,
|
||||
Messages: utilRes.Messages{"Name is required"},
|
||||
})
|
||||
}
|
||||
|
||||
// Check if file is uploaded
|
||||
if len(form.File["file"]) > 0 {
|
||||
// File will be handled in service
|
||||
}
|
||||
|
||||
dataResult, err := _i.salesAgentsService.Create(c, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -132,12 +174,17 @@ func (_i *salesAgentsController) Save(c *fiber.Ctx) error {
|
|||
|
||||
// Update SalesAgent
|
||||
// @Summary Update SalesAgent
|
||||
// @Description API for updating SalesAgent
|
||||
// @Description API for updating SalesAgent with file upload
|
||||
// @Tags SalesAgents
|
||||
// @Security Bearer
|
||||
// @Param X-Client-Key header string true "Insert the X-Client-Key"
|
||||
// @Param id path int true "SalesAgent ID"
|
||||
// @Param payload body request.SalesAgentsUpdateRequest true "Required payload"
|
||||
// @Param file formData file false "Upload file"
|
||||
// @Param name formData string false "SalesAgent name"
|
||||
// @Param job_title formData string false "SalesAgent job title"
|
||||
// @Param phone formData string false "SalesAgent phone"
|
||||
// @Param agent_type formData string false "SalesAgent agent type (JSON array)"
|
||||
// @Param is_active formData bool false "SalesAgent is_active"
|
||||
// @Success 200 {object} response.Response
|
||||
// @Failure 400 {object} response.BadRequestError
|
||||
// @Failure 401 {object} response.UnauthorizedError
|
||||
|
|
@ -149,12 +196,49 @@ func (_i *salesAgentsController) Update(c *fiber.Ctx) error {
|
|||
return err
|
||||
}
|
||||
|
||||
req := new(request.SalesAgentsUpdateRequest)
|
||||
if err := utilVal.ParseAndValidate(c, req); err != nil {
|
||||
return err
|
||||
// Parse multipart form
|
||||
form, err := c.MultipartForm()
|
||||
if err != nil {
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: false,
|
||||
Messages: utilRes.Messages{"Failed to parse form data"},
|
||||
})
|
||||
}
|
||||
|
||||
dataResult, err := _i.salesAgentsService.Update(uint(id), *req)
|
||||
// Extract form values
|
||||
req := request.SalesAgentsUpdateRequest{}
|
||||
|
||||
if name := c.FormValue("name"); name != "" {
|
||||
req.Name = &name
|
||||
}
|
||||
|
||||
if jobTitle := c.FormValue("job_title"); jobTitle != "" {
|
||||
req.JobTitle = &jobTitle
|
||||
}
|
||||
|
||||
if phone := c.FormValue("phone"); phone != "" {
|
||||
req.Phone = &phone
|
||||
}
|
||||
|
||||
// Handle agent_type (JSON array string)
|
||||
if agentTypeStr := c.FormValue("agent_type"); agentTypeStr != "" {
|
||||
var agentType []string
|
||||
if err := json.Unmarshal([]byte(agentTypeStr), &agentType); err == nil {
|
||||
req.AgentType = agentType
|
||||
}
|
||||
}
|
||||
|
||||
if isActiveStr := c.FormValue("is_active"); isActiveStr != "" {
|
||||
isActive := isActiveStr == "true" || isActiveStr == "1"
|
||||
req.IsActive = &isActive
|
||||
}
|
||||
|
||||
// Check if file is uploaded
|
||||
if len(form.File["file"]) > 0 {
|
||||
// File will be handled in service
|
||||
}
|
||||
|
||||
dataResult, err := _i.salesAgentsService.Update(c, uint(id), req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,24 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"jaecoo-be/app/module/sales_agents/mapper"
|
||||
"jaecoo-be/app/module/sales_agents/repository"
|
||||
"jaecoo-be/app/module/sales_agents/request"
|
||||
"jaecoo-be/app/module/sales_agents/response"
|
||||
"jaecoo-be/config/config"
|
||||
minioStorage "jaecoo-be/config/config"
|
||||
"jaecoo-be/utils/paginator"
|
||||
"math/rand"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
|
|
@ -16,21 +26,24 @@ type salesAgentsService struct {
|
|||
Repo repository.SalesAgentsRepository
|
||||
Log zerolog.Logger
|
||||
Cfg *config.Config
|
||||
MinioStorage *minioStorage.MinioStorage
|
||||
}
|
||||
|
||||
type SalesAgentsService interface {
|
||||
GetAll(req request.SalesAgentsQueryRequest) (agents []*response.SalesAgentsResponse, paging paginator.Pagination, err error)
|
||||
GetOne(id uint) (agent *response.SalesAgentsResponse, err error)
|
||||
Create(req request.SalesAgentsCreateRequest) (agent *response.SalesAgentsResponse, err error)
|
||||
Update(id uint, req request.SalesAgentsUpdateRequest) (agent *response.SalesAgentsResponse, err error)
|
||||
Create(c *fiber.Ctx, req request.SalesAgentsCreateRequest) (agent *response.SalesAgentsResponse, err error)
|
||||
Update(c *fiber.Ctx, id uint, req request.SalesAgentsUpdateRequest) (agent *response.SalesAgentsResponse, err error)
|
||||
Delete(id uint) (err error)
|
||||
UploadFileToMinio(c *fiber.Ctx, fileKey string) (filePath *string, err error)
|
||||
}
|
||||
|
||||
func NewSalesAgentsService(repo repository.SalesAgentsRepository, log zerolog.Logger, cfg *config.Config) SalesAgentsService {
|
||||
func NewSalesAgentsService(repo repository.SalesAgentsRepository, log zerolog.Logger, cfg *config.Config, minioStorage *minioStorage.MinioStorage) SalesAgentsService {
|
||||
return &salesAgentsService{
|
||||
Repo: repo,
|
||||
Log: log,
|
||||
Cfg: cfg,
|
||||
MinioStorage: minioStorage,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +79,12 @@ func (_i *salesAgentsService) GetOne(id uint) (agent *response.SalesAgentsRespon
|
|||
return
|
||||
}
|
||||
|
||||
func (_i *salesAgentsService) Create(req request.SalesAgentsCreateRequest) (agent *response.SalesAgentsResponse, err error) {
|
||||
func (_i *salesAgentsService) Create(c *fiber.Ctx, req request.SalesAgentsCreateRequest) (agent *response.SalesAgentsResponse, err error) {
|
||||
// Handle file upload if exists
|
||||
if filePath, uploadErr := _i.UploadFileToMinio(c, "file"); uploadErr == nil && filePath != nil {
|
||||
req.ProfilePicturePath = filePath
|
||||
}
|
||||
|
||||
agentEntity := req.ToEntity()
|
||||
isActive := true
|
||||
agentEntity.IsActive = &isActive
|
||||
|
|
@ -82,7 +100,12 @@ func (_i *salesAgentsService) Create(req request.SalesAgentsCreateRequest) (agen
|
|||
return
|
||||
}
|
||||
|
||||
func (_i *salesAgentsService) Update(id uint, req request.SalesAgentsUpdateRequest) (agent *response.SalesAgentsResponse, err error) {
|
||||
func (_i *salesAgentsService) Update(c *fiber.Ctx, id uint, req request.SalesAgentsUpdateRequest) (agent *response.SalesAgentsResponse, err error) {
|
||||
// Handle file upload if exists
|
||||
if filePath, uploadErr := _i.UploadFileToMinio(c, "file"); uploadErr == nil && filePath != nil {
|
||||
req.ProfilePicturePath = filePath
|
||||
}
|
||||
|
||||
agentEntity := req.ToEntity()
|
||||
|
||||
err = _i.Repo.Update(id, agentEntity)
|
||||
|
|
@ -101,6 +124,71 @@ func (_i *salesAgentsService) Update(id uint, req request.SalesAgentsUpdateReque
|
|||
return
|
||||
}
|
||||
|
||||
func (_i *salesAgentsService) UploadFileToMinio(c *fiber.Ctx, fileKey string) (filePath *string, err error) {
|
||||
form, err := c.MultipartForm()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
files := form.File[fileKey]
|
||||
if len(files) == 0 {
|
||||
return nil, nil // No file uploaded, return nil without error
|
||||
}
|
||||
|
||||
fileHeader := files[0]
|
||||
|
||||
// Create minio connection
|
||||
minioClient, err := _i.MinioStorage.ConnectMinio()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
bucketName := _i.MinioStorage.Cfg.ObjectStorage.MinioStorage.BucketName
|
||||
|
||||
// Open file
|
||||
src, err := fileHeader.Open()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer src.Close()
|
||||
|
||||
// Process filename
|
||||
filename := filepath.Base(fileHeader.Filename)
|
||||
filename = strings.ReplaceAll(filename, " ", "")
|
||||
filenameWithoutExt := filepath.Clean(filename[:len(filename)-len(filepath.Ext(filename))])
|
||||
extension := filepath.Ext(fileHeader.Filename)[1:]
|
||||
|
||||
// Generate unique filename
|
||||
now := time.Now()
|
||||
rand.New(rand.NewSource(now.UnixNano()))
|
||||
randUniqueId := rand.Intn(1000000)
|
||||
|
||||
newFilenameWithoutExt := filenameWithoutExt + "_" + strconv.Itoa(randUniqueId)
|
||||
newFilename := newFilenameWithoutExt + "." + extension
|
||||
|
||||
// Create object name with path structure
|
||||
objectName := fmt.Sprintf("sales_agents/upload/%d/%d/%s", now.Year(), now.Month(), newFilename)
|
||||
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service:Resource", "SalesAgents:UploadFileToMinio").
|
||||
Interface("Uploading file", objectName).Msg("")
|
||||
|
||||
// Upload file to MinIO
|
||||
_, err = minioClient.PutObject(context.Background(), bucketName, objectName, src, fileHeader.Size, minio.PutObjectOptions{})
|
||||
if err != nil {
|
||||
_i.Log.Error().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service:Resource", "SalesAgents:UploadFileToMinio").
|
||||
Interface("Error uploading file", err).Msg("")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service:Resource", "SalesAgents:UploadFileToMinio").
|
||||
Interface("Successfully uploaded", objectName).Msg("")
|
||||
|
||||
return &objectName, nil
|
||||
}
|
||||
|
||||
func (_i *salesAgentsService) Delete(id uint) (err error) {
|
||||
err = _i.Repo.Delete(id)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -3521,7 +3521,7 @@ const docTemplate = `{
|
|||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for updating Banner",
|
||||
"description": "API for updating Banner with file upload",
|
||||
"tags": [
|
||||
"Banners"
|
||||
],
|
||||
|
|
@ -3542,13 +3542,40 @@ const docTemplate = `{
|
|||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.BannersUpdateRequest"
|
||||
}
|
||||
"type": "file",
|
||||
"description": "Upload file",
|
||||
"name": "file",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Banner title",
|
||||
"name": "title",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Banner description",
|
||||
"name": "description",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Banner position",
|
||||
"name": "position",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Banner status",
|
||||
"name": "status",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "Banner is_active",
|
||||
"name": "is_active",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
@ -6336,7 +6363,7 @@ const docTemplate = `{
|
|||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for updating Product",
|
||||
"description": "API for updating Product with file upload",
|
||||
"tags": [
|
||||
"Products"
|
||||
],
|
||||
|
|
@ -6357,13 +6384,40 @@ const docTemplate = `{
|
|||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.ProductsUpdateRequest"
|
||||
}
|
||||
"type": "file",
|
||||
"description": "Upload file",
|
||||
"name": "file",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Product title",
|
||||
"name": "title",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Product variant",
|
||||
"name": "variant",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Product price",
|
||||
"name": "price",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Product colors (JSON array)",
|
||||
"name": "colors",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "Product is_active",
|
||||
"name": "is_active",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
@ -7197,7 +7251,7 @@ const docTemplate = `{
|
|||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for creating SalesAgent",
|
||||
"description": "API for creating SalesAgent with file upload",
|
||||
"tags": [
|
||||
"SalesAgents"
|
||||
],
|
||||
|
|
@ -7211,13 +7265,35 @@ const docTemplate = `{
|
|||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.SalesAgentsCreateRequest"
|
||||
}
|
||||
"type": "file",
|
||||
"description": "Upload file",
|
||||
"name": "file",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent name",
|
||||
"name": "name",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent job title",
|
||||
"name": "job_title",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent phone",
|
||||
"name": "phone",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent agent type (JSON array)",
|
||||
"name": "agent_type",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
@ -7309,7 +7385,7 @@ const docTemplate = `{
|
|||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for updating SalesAgent",
|
||||
"description": "API for updating SalesAgent with file upload",
|
||||
"tags": [
|
||||
"SalesAgents"
|
||||
],
|
||||
|
|
@ -7330,13 +7406,40 @@ const docTemplate = `{
|
|||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.SalesAgentsUpdateRequest"
|
||||
}
|
||||
"type": "file",
|
||||
"description": "Upload file",
|
||||
"name": "file",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent name",
|
||||
"name": "name",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent job title",
|
||||
"name": "job_title",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent phone",
|
||||
"name": "phone",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent agent type (JSON array)",
|
||||
"name": "agent_type",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "SalesAgent is_active",
|
||||
"name": "is_active",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
@ -10175,29 +10278,6 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"request.BannersUpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"position": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnail_path": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CitiesCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
@ -10393,32 +10473,6 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"request.ProductsUpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"colors": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"price": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnail_path": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"variant": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.PromotionsUpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
@ -10436,58 +10490,6 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"request.SalesAgentsCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"agent_type": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"job_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"profile_picture_path": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.SalesAgentsUpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_type": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"job_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"profile_picture_path": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.UserEmailValidationRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
|||
|
|
@ -3510,7 +3510,7 @@
|
|||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for updating Banner",
|
||||
"description": "API for updating Banner with file upload",
|
||||
"tags": [
|
||||
"Banners"
|
||||
],
|
||||
|
|
@ -3531,13 +3531,40 @@
|
|||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.BannersUpdateRequest"
|
||||
}
|
||||
"type": "file",
|
||||
"description": "Upload file",
|
||||
"name": "file",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Banner title",
|
||||
"name": "title",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Banner description",
|
||||
"name": "description",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Banner position",
|
||||
"name": "position",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Banner status",
|
||||
"name": "status",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "Banner is_active",
|
||||
"name": "is_active",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
@ -6325,7 +6352,7 @@
|
|||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for updating Product",
|
||||
"description": "API for updating Product with file upload",
|
||||
"tags": [
|
||||
"Products"
|
||||
],
|
||||
|
|
@ -6346,13 +6373,40 @@
|
|||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.ProductsUpdateRequest"
|
||||
}
|
||||
"type": "file",
|
||||
"description": "Upload file",
|
||||
"name": "file",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Product title",
|
||||
"name": "title",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Product variant",
|
||||
"name": "variant",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Product price",
|
||||
"name": "price",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Product colors (JSON array)",
|
||||
"name": "colors",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "Product is_active",
|
||||
"name": "is_active",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
@ -7186,7 +7240,7 @@
|
|||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for creating SalesAgent",
|
||||
"description": "API for creating SalesAgent with file upload",
|
||||
"tags": [
|
||||
"SalesAgents"
|
||||
],
|
||||
|
|
@ -7200,13 +7254,35 @@
|
|||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.SalesAgentsCreateRequest"
|
||||
}
|
||||
"type": "file",
|
||||
"description": "Upload file",
|
||||
"name": "file",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent name",
|
||||
"name": "name",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent job title",
|
||||
"name": "job_title",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent phone",
|
||||
"name": "phone",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent agent type (JSON array)",
|
||||
"name": "agent_type",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
@ -7298,7 +7374,7 @@
|
|||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for updating SalesAgent",
|
||||
"description": "API for updating SalesAgent with file upload",
|
||||
"tags": [
|
||||
"SalesAgents"
|
||||
],
|
||||
|
|
@ -7319,13 +7395,40 @@
|
|||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Required payload",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.SalesAgentsUpdateRequest"
|
||||
}
|
||||
"type": "file",
|
||||
"description": "Upload file",
|
||||
"name": "file",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent name",
|
||||
"name": "name",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent job title",
|
||||
"name": "job_title",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent phone",
|
||||
"name": "phone",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "SalesAgent agent type (JSON array)",
|
||||
"name": "agent_type",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "SalesAgent is_active",
|
||||
"name": "is_active",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
@ -10164,29 +10267,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"request.BannersUpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"position": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnail_path": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.CitiesCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
@ -10382,32 +10462,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"request.ProductsUpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"colors": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"price": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnail_path": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"variant": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.PromotionsUpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
@ -10425,58 +10479,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"request.SalesAgentsCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"agent_type": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"job_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"profile_picture_path": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.SalesAgentsUpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_type": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"job_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"profile_picture_path": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request.UserEmailValidationRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
|||
|
|
@ -281,21 +281,6 @@ definitions:
|
|||
- title
|
||||
- typeId
|
||||
type: object
|
||||
request.BannersUpdateRequest:
|
||||
properties:
|
||||
description:
|
||||
type: string
|
||||
is_active:
|
||||
type: boolean
|
||||
position:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
thumbnail_path:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
type: object
|
||||
request.CitiesCreateRequest:
|
||||
properties:
|
||||
cityName:
|
||||
|
|
@ -427,23 +412,6 @@ definitions:
|
|||
title:
|
||||
type: string
|
||||
type: object
|
||||
request.ProductsUpdateRequest:
|
||||
properties:
|
||||
colors:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
is_active:
|
||||
type: boolean
|
||||
price:
|
||||
type: string
|
||||
thumbnail_path:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
variant:
|
||||
type: string
|
||||
type: object
|
||||
request.PromotionsUpdateRequest:
|
||||
properties:
|
||||
description:
|
||||
|
|
@ -455,40 +423,6 @@ definitions:
|
|||
title:
|
||||
type: string
|
||||
type: object
|
||||
request.SalesAgentsCreateRequest:
|
||||
properties:
|
||||
agent_type:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
job_title:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
profile_picture_path:
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
request.SalesAgentsUpdateRequest:
|
||||
properties:
|
||||
agent_type:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
is_active:
|
||||
type: boolean
|
||||
job_title:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
profile_picture_path:
|
||||
type: string
|
||||
type: object
|
||||
request.UserEmailValidationRequest:
|
||||
properties:
|
||||
newEmail:
|
||||
|
|
@ -3084,7 +3018,7 @@ paths:
|
|||
tags:
|
||||
- Banners
|
||||
put:
|
||||
description: API for updating Banner
|
||||
description: API for updating Banner with file upload
|
||||
parameters:
|
||||
- description: Insert the X-Client-Key
|
||||
in: header
|
||||
|
|
@ -3096,12 +3030,30 @@ paths:
|
|||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Required payload
|
||||
in: body
|
||||
name: payload
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.BannersUpdateRequest'
|
||||
- description: Upload file
|
||||
in: formData
|
||||
name: file
|
||||
type: file
|
||||
- description: Banner title
|
||||
in: formData
|
||||
name: title
|
||||
type: string
|
||||
- description: Banner description
|
||||
in: formData
|
||||
name: description
|
||||
type: string
|
||||
- description: Banner position
|
||||
in: formData
|
||||
name: position
|
||||
type: string
|
||||
- description: Banner status
|
||||
in: formData
|
||||
name: status
|
||||
type: string
|
||||
- description: Banner is_active
|
||||
in: formData
|
||||
name: is_active
|
||||
type: boolean
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
|
|
@ -4879,7 +4831,7 @@ paths:
|
|||
tags:
|
||||
- Products
|
||||
put:
|
||||
description: API for updating Product
|
||||
description: API for updating Product with file upload
|
||||
parameters:
|
||||
- description: Insert the X-Client-Key
|
||||
in: header
|
||||
|
|
@ -4891,12 +4843,30 @@ paths:
|
|||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Required payload
|
||||
in: body
|
||||
name: payload
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.ProductsUpdateRequest'
|
||||
- description: Upload file
|
||||
in: formData
|
||||
name: file
|
||||
type: file
|
||||
- description: Product title
|
||||
in: formData
|
||||
name: title
|
||||
type: string
|
||||
- description: Product variant
|
||||
in: formData
|
||||
name: variant
|
||||
type: string
|
||||
- description: Product price
|
||||
in: formData
|
||||
name: price
|
||||
type: string
|
||||
- description: Product colors (JSON array)
|
||||
in: formData
|
||||
name: colors
|
||||
type: string
|
||||
- description: Product is_active
|
||||
in: formData
|
||||
name: is_active
|
||||
type: boolean
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
|
|
@ -5429,19 +5399,34 @@ paths:
|
|||
tags:
|
||||
- SalesAgents
|
||||
post:
|
||||
description: API for creating SalesAgent
|
||||
description: API for creating SalesAgent with file upload
|
||||
parameters:
|
||||
- description: Insert the X-Client-Key
|
||||
in: header
|
||||
name: X-Client-Key
|
||||
required: true
|
||||
type: string
|
||||
- description: Required payload
|
||||
in: body
|
||||
name: payload
|
||||
- description: Upload file
|
||||
in: formData
|
||||
name: file
|
||||
type: file
|
||||
- description: SalesAgent name
|
||||
in: formData
|
||||
name: name
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.SalesAgentsCreateRequest'
|
||||
type: string
|
||||
- description: SalesAgent job title
|
||||
in: formData
|
||||
name: job_title
|
||||
type: string
|
||||
- description: SalesAgent phone
|
||||
in: formData
|
||||
name: phone
|
||||
type: string
|
||||
- description: SalesAgent agent type (JSON array)
|
||||
in: formData
|
||||
name: agent_type
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
|
|
@ -5536,7 +5521,7 @@ paths:
|
|||
tags:
|
||||
- SalesAgents
|
||||
put:
|
||||
description: API for updating SalesAgent
|
||||
description: API for updating SalesAgent with file upload
|
||||
parameters:
|
||||
- description: Insert the X-Client-Key
|
||||
in: header
|
||||
|
|
@ -5548,12 +5533,30 @@ paths:
|
|||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Required payload
|
||||
in: body
|
||||
name: payload
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.SalesAgentsUpdateRequest'
|
||||
- description: Upload file
|
||||
in: formData
|
||||
name: file
|
||||
type: file
|
||||
- description: SalesAgent name
|
||||
in: formData
|
||||
name: name
|
||||
type: string
|
||||
- description: SalesAgent job title
|
||||
in: formData
|
||||
name: job_title
|
||||
type: string
|
||||
- description: SalesAgent phone
|
||||
in: formData
|
||||
name: phone
|
||||
type: string
|
||||
- description: SalesAgent agent type (JSON array)
|
||||
in: formData
|
||||
name: agent_type
|
||||
type: string
|
||||
- description: SalesAgent is_active
|
||||
in: formData
|
||||
name: is_active
|
||||
type: boolean
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
|
|
|
|||
Loading…
Reference in New Issue