feat: update ppidDataCategories for Thumbnail
This commit is contained in:
parent
c4cffd4308
commit
66e51218d9
|
|
@ -3,11 +3,12 @@ package entity
|
|||
import "time"
|
||||
|
||||
type PpidDataCategories struct {
|
||||
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
||||
Title string `json:"title" gorm:"type:varchar"`
|
||||
Description string `json:"description" gorm:"type:varchar"`
|
||||
Slug string `json:"slug" gorm:"type:varchar"`
|
||||
IsActive *bool `json:"is_active" gorm:"type:bool;default:true"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
|
||||
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
||||
Title string `json:"title" gorm:"type:varchar"`
|
||||
Description string `json:"description" gorm:"type:varchar"`
|
||||
Slug string `json:"slug" gorm:"type:varchar"`
|
||||
ThumbnailPath *string `json:"thumbnail_path" gorm:"type:varchar"`
|
||||
IsActive *bool `json:"is_active" gorm:"type:bool;default:true"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,10 @@ type PpidDataCategoriesController interface {
|
|||
All(c *fiber.Ctx) error
|
||||
Show(c *fiber.Ctx) error
|
||||
Save(c *fiber.Ctx) error
|
||||
SaveThumbnail(c *fiber.Ctx) error
|
||||
Update(c *fiber.Ctx) error
|
||||
Delete(c *fiber.Ctx) error
|
||||
Viewer(c *fiber.Ctx) error
|
||||
}
|
||||
|
||||
func NewPpidDataCategoriesController(ppidDataCategoriesService service.PpidDataCategoriesService) PpidDataCategoriesController {
|
||||
|
|
@ -124,6 +126,31 @@ func (_i *ppidDataCategoriesController) Save(c *fiber.Ctx) error {
|
|||
})
|
||||
}
|
||||
|
||||
// SaveThumbnail PpidDataFiles
|
||||
// @Summary Upload PpidDataCategories Thumbnail
|
||||
// @Description API for Upload PpidDataCategories Thumbnail
|
||||
// @Tags PPID Categories
|
||||
// @Security Bearer
|
||||
// @Produce json
|
||||
// @Param files formData file true "Upload thumbnail"
|
||||
// @Param id path int true "Ppid Data Category ID"
|
||||
// @Success 200 {object} response.Response
|
||||
// @Failure 400 {object} response.BadRequestError
|
||||
// @Failure 401 {object} response.UnauthorizedError
|
||||
// @Failure 500 {object} response.InternalServerError
|
||||
// @Router /ppid-data-categories/thumbnail/{id} [post]
|
||||
func (_i *ppidDataCategoriesController) SaveThumbnail(c *fiber.Ctx) error {
|
||||
err := _i.ppidDataCategoriesService.SaveThumbnail(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return utilRes.Resp(c, utilRes.Response{
|
||||
Success: true,
|
||||
Messages: utilRes.Messages{"PpidDataFiles successfully created"},
|
||||
})
|
||||
}
|
||||
|
||||
// Update PpidDataCategories
|
||||
// @Summary update PpidDataCategories
|
||||
// @Description API for update PpidDataCategories
|
||||
|
|
@ -159,7 +186,7 @@ func (_i *ppidDataCategoriesController) Update(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
// Delete PpidDataCategories
|
||||
// @Summary delete PpidDataCategories
|
||||
// @Summary Delete PpidDataCategories
|
||||
// @Description API for delete PpidDataCategories
|
||||
// @Tags PPID Categories
|
||||
// @Security Bearer
|
||||
|
|
@ -185,3 +212,18 @@ func (_i *ppidDataCategoriesController) Delete(c *fiber.Ctx) error {
|
|||
Messages: utilRes.Messages{"PpidDataCategories successfully deleted"},
|
||||
})
|
||||
}
|
||||
|
||||
// Viewer PpidDataCategories
|
||||
// @Summary Viewer PpidDataCategories
|
||||
// @Description API for View Thumbnail of PpidDataCategories
|
||||
// @Tags PPID Categories
|
||||
// @Security Bearer
|
||||
// @Param id path string true "PPID Categories ID"
|
||||
// @Success 200 {object} response.Response
|
||||
// @Failure 400 {object} response.BadRequestError
|
||||
// @Failure 401 {object} response.UnauthorizedError
|
||||
// @Failure 500 {object} response.InternalServerError
|
||||
// @Router /ppid-data-categories/viewer/{id} [get]
|
||||
func (_i *ppidDataCategoriesController) Viewer(c *fiber.Ctx) error {
|
||||
return _i.ppidDataCategoriesService.Viewer(c)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,16 +3,18 @@ package mapper
|
|||
import (
|
||||
"go-humas-be/app/database/entity"
|
||||
res "go-humas-be/app/module/ppid_data_categories/response"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func PpidDataCategoriesResponseMapper(ppidDataCategoriesReq *entity.PpidDataCategories) (ppidDataCategoriesRes *res.PpidDataCategoriesResponse) {
|
||||
if ppidDataCategoriesReq != nil {
|
||||
ppidDataCategoriesRes = &res.PpidDataCategoriesResponse{
|
||||
ID: ppidDataCategoriesReq.ID,
|
||||
Title: ppidDataCategoriesReq.Title,
|
||||
Description: ppidDataCategoriesReq.Description,
|
||||
Slug: ppidDataCategoriesReq.Slug,
|
||||
IsActive: ppidDataCategoriesReq.IsActive,
|
||||
ID: ppidDataCategoriesReq.ID,
|
||||
Title: ppidDataCategoriesReq.Title,
|
||||
Description: ppidDataCategoriesReq.Description,
|
||||
Slug: ppidDataCategoriesReq.Slug,
|
||||
ThumbnailUrl: "/ppid-data-categories/viewer/" + strconv.Itoa(int(ppidDataCategoriesReq.ID)),
|
||||
IsActive: ppidDataCategoriesReq.IsActive,
|
||||
CreatedAt: ppidDataCategoriesReq.CreatedAt,
|
||||
UpdatedAt: ppidDataCategoriesReq.UpdatedAt,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ func (_i *PpidDataCategoriesRouter) RegisterPpidDataCategoriesRoutes() {
|
|||
router.Get("/", ppidDataCategoriesController.All)
|
||||
router.Get("/:id", ppidDataCategoriesController.Show)
|
||||
router.Post("/", ppidDataCategoriesController.Save)
|
||||
router.Get("/viewer/:id", ppidDataCategoriesController.Viewer)
|
||||
router.Post("/thumbnail/:id", ppidDataCategoriesController.SaveThumbnail)
|
||||
router.Put("/:id", ppidDataCategoriesController.Update)
|
||||
router.Delete("/:id", ppidDataCategoriesController.Delete)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -17,33 +17,37 @@ type PpidDataCategoriesQueryRequest struct {
|
|||
}
|
||||
|
||||
type PpidDataCategoriesCreateRequest struct {
|
||||
Title string `json:"title" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
Slug string `json:"slug" validate:"required"`
|
||||
Title string `json:"title" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
Slug string `json:"slug" validate:"required"`
|
||||
ThumbnailPath *string `json:"thumbnailPath"`
|
||||
}
|
||||
|
||||
func (req PpidDataCategoriesCreateRequest) ToEntity() *entity.PpidDataCategories {
|
||||
return &entity.PpidDataCategories{
|
||||
Title: req.Title,
|
||||
Description: req.Description,
|
||||
Slug: req.Slug,
|
||||
Title: req.Title,
|
||||
Description: req.Description,
|
||||
Slug: req.Slug,
|
||||
ThumbnailPath: req.ThumbnailPath,
|
||||
}
|
||||
}
|
||||
|
||||
type PpidDataCategoriesUpdateRequest struct {
|
||||
ID uint `json:"id" validate:"required"`
|
||||
Title string `json:"title" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
Slug string `json:"slug" validate:"required"`
|
||||
ID uint `json:"id" validate:"required"`
|
||||
Title string `json:"title" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
Slug string `json:"slug" validate:"required"`
|
||||
ThumbnailPath *string `json:"thumbnailPath"`
|
||||
}
|
||||
|
||||
func (req PpidDataCategoriesUpdateRequest) ToEntity() *entity.PpidDataCategories {
|
||||
return &entity.PpidDataCategories{
|
||||
ID: req.ID,
|
||||
Title: req.Title,
|
||||
Description: req.Description,
|
||||
Slug: req.Slug,
|
||||
UpdatedAt: time.Now(),
|
||||
ID: req.ID,
|
||||
Title: req.Title,
|
||||
Description: req.Description,
|
||||
Slug: req.Slug,
|
||||
ThumbnailPath: req.ThumbnailPath,
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@ package response
|
|||
import "time"
|
||||
|
||||
type PpidDataCategoriesResponse struct {
|
||||
ID uint `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Slug string `json:"slug"`
|
||||
IsActive *bool `json:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID uint `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Slug string `json:"slug"`
|
||||
ThumbnailUrl string `json:"thumbnailUrl"`
|
||||
IsActive *bool `json:"isActive"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,31 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/rs/zerolog"
|
||||
"go-humas-be/app/module/ppid_data_categories/mapper"
|
||||
"go-humas-be/app/module/ppid_data_categories/repository"
|
||||
"go-humas-be/app/module/ppid_data_categories/request"
|
||||
"go-humas-be/app/module/ppid_data_categories/response"
|
||||
minioStorage "go-humas-be/config/config"
|
||||
"go-humas-be/utils/paginator"
|
||||
"io"
|
||||
"log"
|
||||
"math/rand"
|
||||
"mime"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// PpidDataCategoriesService
|
||||
type ppidDataCategoriesService struct {
|
||||
Repo repository.PpidDataCategoriesRepository
|
||||
Log zerolog.Logger
|
||||
Repo repository.PpidDataCategoriesRepository
|
||||
Log zerolog.Logger
|
||||
MinioStorage *minioStorage.MinioStorage
|
||||
}
|
||||
|
||||
// PpidDataCategoriesService define interface of IPpidDataCategoriesService
|
||||
|
|
@ -20,16 +33,19 @@ type PpidDataCategoriesService interface {
|
|||
All(req request.PpidDataCategoriesQueryRequest) (ppidDataCategories []*response.PpidDataCategoriesResponse, paging paginator.Pagination, err error)
|
||||
Show(id uint) (ppidDataCategories *response.PpidDataCategoriesResponse, err error)
|
||||
Save(req request.PpidDataCategoriesCreateRequest) (err error)
|
||||
SaveThumbnail(c *fiber.Ctx) (err error)
|
||||
Update(id uint, req request.PpidDataCategoriesUpdateRequest) (err error)
|
||||
Delete(id uint) error
|
||||
Viewer(c *fiber.Ctx) error
|
||||
}
|
||||
|
||||
// NewPpidDataCategoriesService init PpidDataCategoriesService
|
||||
func NewPpidDataCategoriesService(repo repository.PpidDataCategoriesRepository, log zerolog.Logger) PpidDataCategoriesService {
|
||||
func NewPpidDataCategoriesService(repo repository.PpidDataCategoriesRepository, log zerolog.Logger, minioStorage *minioStorage.MinioStorage) PpidDataCategoriesService {
|
||||
|
||||
return &ppidDataCategoriesService{
|
||||
Repo: repo,
|
||||
Log: log,
|
||||
Repo: repo,
|
||||
Log: log,
|
||||
MinioStorage: minioStorage,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -62,6 +78,80 @@ func (_i *ppidDataCategoriesService) Save(req request.PpidDataCategoriesCreateRe
|
|||
return _i.Repo.Create(req.ToEntity())
|
||||
}
|
||||
|
||||
func (_i *ppidDataCategoriesService) SaveThumbnail(c *fiber.Ctx) (err error) {
|
||||
|
||||
id, err := strconv.ParseUint(c.Params("id"), 10, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service:SaveThumbnail", "Categories:SaveThumbnail").
|
||||
Interface("id", id).Msg("")
|
||||
|
||||
bucketName := _i.MinioStorage.Cfg.ObjectStorage.MinioStorage.BucketName
|
||||
|
||||
form, err := c.MultipartForm()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
files := form.File["files"]
|
||||
|
||||
// Create minio connection.
|
||||
minioClient, err := _i.MinioStorage.ConnectMinio()
|
||||
if err != nil {
|
||||
// Return status 500 and minio connection error.
|
||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||
"error": true,
|
||||
"msg": err.Error(),
|
||||
})
|
||||
}
|
||||
|
||||
// Iterasi semua file yang diunggah
|
||||
for _, file := range files {
|
||||
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service:Resource", "Uploader:: loop1").
|
||||
Interface("data", file).Msg("")
|
||||
|
||||
src, err := file.Open()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer src.Close()
|
||||
|
||||
filename := filepath.Base(file.Filename)
|
||||
filenameWithoutExt := filepath.Clean(filename[:len(filename)-len(filepath.Ext(filename))])
|
||||
extension := filepath.Ext(file.Filename)[1:]
|
||||
|
||||
rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
randUniqueId := rand.Intn(1000000)
|
||||
|
||||
newFilenameWithoutExt := filenameWithoutExt + "_" + strconv.Itoa(randUniqueId)
|
||||
newFilename := newFilenameWithoutExt + "." + extension
|
||||
objectName := "ppid/category/thumbnail/" + newFilename
|
||||
|
||||
findCategory, err := _i.Repo.FindOne(uint(id))
|
||||
findCategory.ThumbnailPath = &objectName
|
||||
err = _i.Repo.Update(uint(id), findCategory)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Upload file ke MinIO
|
||||
_, err = minioClient.PutObject(context.Background(), bucketName, objectName, src, file.Size, minio.PutObjectOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service:Resource", "User:All").
|
||||
Interface("data", "Successfully uploaded").Msg("")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (_i *ppidDataCategoriesService) Update(id uint, req request.PpidDataCategoriesUpdateRequest) (err error) {
|
||||
_i.Log.Info().Interface("data", req).Msg("")
|
||||
return _i.Repo.Update(id, req.ToEntity())
|
||||
|
|
@ -77,3 +167,65 @@ func (_i *ppidDataCategoriesService) Delete(id uint) error {
|
|||
result.IsActive = &isActive
|
||||
return _i.Repo.Update(id, result)
|
||||
}
|
||||
|
||||
func (_i *ppidDataCategoriesService) Viewer(c *fiber.Ctx) (err error) {
|
||||
id, err := strconv.ParseUint(c.Params("id"), 10, 0)
|
||||
result, err := _i.Repo.FindOne(uint(id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if result.ThumbnailPath == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
bucketName := _i.MinioStorage.Cfg.ObjectStorage.MinioStorage.BucketName
|
||||
objectName := result.ThumbnailPath
|
||||
|
||||
_i.Log.Info().Str("timestamp", time.Now().
|
||||
Format(time.RFC3339)).Str("Service:Resource", "Article:Uploads").
|
||||
Interface("data", objectName).Msg("")
|
||||
|
||||
// Create minio connection.
|
||||
minioClient, err := _i.MinioStorage.ConnectMinio()
|
||||
if err != nil {
|
||||
// Return status 500 and minio connection error.
|
||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||
"error": true,
|
||||
"msg": err.Error(),
|
||||
})
|
||||
}
|
||||
|
||||
fileContent, err := minioClient.GetObject(ctx, bucketName, *objectName, minio.GetObjectOptions{})
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
defer fileContent.Close()
|
||||
|
||||
contentType := mime.TypeByExtension("." + getFileExtension(*objectName))
|
||||
if contentType == "" {
|
||||
contentType = "application/octet-stream"
|
||||
}
|
||||
|
||||
c.Set("Content-Type", contentType)
|
||||
|
||||
if _, err := io.Copy(c.Response().BodyWriter(), fileContent); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func getFileExtension(filename string) string {
|
||||
// split file name
|
||||
parts := strings.Split(filename, ".")
|
||||
|
||||
// jika tidak ada ekstensi, kembalikan string kosong
|
||||
if len(parts) == 1 || (len(parts) == 2 && parts[0] == "") {
|
||||
return ""
|
||||
}
|
||||
|
||||
// ambil ekstensi terakhir
|
||||
return parts[len(parts)-1]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,10 @@ func (_i *ppidDataFilesService) Viewer(c *fiber.Ctx, filename string) (err error
|
|||
return err
|
||||
}
|
||||
|
||||
if result.FilePath == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
bucketName := _i.MinioStorage.Cfg.ObjectStorage.MinioStorage.BucketName
|
||||
objectName := result.FilePath
|
||||
|
|
|
|||
|
|
@ -3289,6 +3289,114 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"/ppid-data-categories/thumbnail/{id}": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for Upload PpidDataCategories Thumbnail",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"PPID Categories"
|
||||
],
|
||||
"summary": "Upload PpidDataCategories Thumbnail",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "file",
|
||||
"description": "Upload thumbnail",
|
||||
"name": "files",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Ppid Data Category ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.BadRequestError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.UnauthorizedError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.InternalServerError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ppid-data-categories/viewer/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for View Thumbnail of PpidDataCategories",
|
||||
"tags": [
|
||||
"PPID Categories"
|
||||
],
|
||||
"summary": "Viewer PpidDataCategories",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "PPID Categories ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.BadRequestError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.UnauthorizedError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.InternalServerError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ppid-data-categories/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
|
|
@ -3403,7 +3511,7 @@ const docTemplate = `{
|
|||
"tags": [
|
||||
"PPID Categories"
|
||||
],
|
||||
"summary": "delete PpidDataCategories",
|
||||
"summary": "Delete PpidDataCategories",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
|
|
@ -5977,6 +6085,9 @@ const docTemplate = `{
|
|||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnailPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
}
|
||||
|
|
@ -6000,6 +6111,9 @@ const docTemplate = `{
|
|||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnailPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3278,6 +3278,114 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/ppid-data-categories/thumbnail/{id}": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for Upload PpidDataCategories Thumbnail",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"PPID Categories"
|
||||
],
|
||||
"summary": "Upload PpidDataCategories Thumbnail",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "file",
|
||||
"description": "Upload thumbnail",
|
||||
"name": "files",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Ppid Data Category ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.BadRequestError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.UnauthorizedError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.InternalServerError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ppid-data-categories/viewer/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "API for View Thumbnail of PpidDataCategories",
|
||||
"tags": [
|
||||
"PPID Categories"
|
||||
],
|
||||
"summary": "Viewer PpidDataCategories",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "PPID Categories ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.BadRequestError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.UnauthorizedError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.InternalServerError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ppid-data-categories/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
|
|
@ -3392,7 +3500,7 @@
|
|||
"tags": [
|
||||
"PPID Categories"
|
||||
],
|
||||
"summary": "delete PpidDataCategories",
|
||||
"summary": "Delete PpidDataCategories",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
|
|
@ -5966,6 +6074,9 @@
|
|||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnailPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
}
|
||||
|
|
@ -5989,6 +6100,9 @@
|
|||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnailPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,6 +250,8 @@ definitions:
|
|||
type: string
|
||||
slug:
|
||||
type: string
|
||||
thumbnailPath:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
required:
|
||||
|
|
@ -265,6 +267,8 @@ definitions:
|
|||
type: integer
|
||||
slug:
|
||||
type: string
|
||||
thumbnailPath:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
required:
|
||||
|
|
@ -2696,7 +2700,7 @@ paths:
|
|||
$ref: '#/definitions/response.InternalServerError'
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: delete PpidDataCategories
|
||||
summary: Delete PpidDataCategories
|
||||
tags:
|
||||
- PPID Categories
|
||||
get:
|
||||
|
|
@ -2765,6 +2769,75 @@ paths:
|
|||
summary: update PpidDataCategories
|
||||
tags:
|
||||
- PPID Categories
|
||||
/ppid-data-categories/thumbnail/{id}:
|
||||
post:
|
||||
description: API for Upload PpidDataCategories Thumbnail
|
||||
parameters:
|
||||
- description: Upload thumbnail
|
||||
in: formData
|
||||
name: files
|
||||
required: true
|
||||
type: file
|
||||
- description: Ppid Data Category ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/response.Response'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/response.BadRequestError'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/response.UnauthorizedError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.InternalServerError'
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Upload PpidDataCategories Thumbnail
|
||||
tags:
|
||||
- PPID Categories
|
||||
/ppid-data-categories/viewer/{id}:
|
||||
get:
|
||||
description: API for View Thumbnail of PpidDataCategories
|
||||
parameters:
|
||||
- description: PPID Categories ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/response.Response'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/response.BadRequestError'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/response.UnauthorizedError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.InternalServerError'
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Viewer PpidDataCategories
|
||||
tags:
|
||||
- PPID Categories
|
||||
/ppid-data-files:
|
||||
get:
|
||||
description: API for getting all PpidDataFiles
|
||||
|
|
|
|||
Loading…
Reference in New Issue