feat: update ppid data and ppid data files
This commit is contained in:
parent
ff7d19623b
commit
5829753c47
|
|
@ -4,15 +4,13 @@ import "time"
|
||||||
|
|
||||||
type PpidDataFiles struct {
|
type PpidDataFiles struct {
|
||||||
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
||||||
Title string `json:"title" gorm:"type:varchar"`
|
|
||||||
PpidDataId int `json:"ppid_data_id" gorm:"type:int4"`
|
PpidDataId int `json:"ppid_data_id" gorm:"type:int4"`
|
||||||
Description string `json:"description" gorm:"type:varchar"`
|
Title *string `json:"title" gorm:"type:varchar"`
|
||||||
Unit string `json:"unit" gorm:"type:varchar"`
|
FileType *string `json:"file_type" gorm:"type:varchar"`
|
||||||
FileType string `json:"file_type" gorm:"type:varchar"`
|
|
||||||
FileName *string `json:"file_name" gorm:"type:varchar"`
|
FileName *string `json:"file_name" gorm:"type:varchar"`
|
||||||
FilePath *string `json:"file_path" gorm:"type:varchar"`
|
FilePath *string `json:"file_path" gorm:"type:varchar"`
|
||||||
Size *string `json:"size" gorm:"type:varchar"`
|
Size *string `json:"size" gorm:"type:varchar"`
|
||||||
DownloadCount *int `json:"download_count" gorm:"type:int4"`
|
DownloadCount *int `json:"download_count" gorm:"type:int4;default:0"`
|
||||||
CreatedById *int `json:"created_by_id" gorm:"type:int4"`
|
CreatedById *int `json:"created_by_id" gorm:"type:int4"`
|
||||||
StatusId *int `json:"status_id" gorm:"type:int4"`
|
StatusId *int `json:"status_id" gorm:"type:int4"`
|
||||||
IsPublish *bool `json:"is_publish" gorm:"type:bool;default:false"`
|
IsPublish *bool `json:"is_publish" gorm:"type:bool;default:false"`
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,6 @@ func (_i *ppidDataFilesController) Show(c *fiber.Ctx) error {
|
||||||
// @Security Bearer
|
// @Security Bearer
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param files formData file true "Upload file"
|
// @Param files formData file true "Upload file"
|
||||||
// @Param payload body request.PpidDataFilesCreateRequest true "Required payload"
|
|
||||||
// @Param ppidDataId path int true "Ppid Data ID"
|
// @Param ppidDataId path int true "Ppid Data ID"
|
||||||
// @Success 200 {object} response.Response
|
// @Success 200 {object} response.Response
|
||||||
// @Failure 400 {object} response.BadRequestError
|
// @Failure 400 {object} response.BadRequestError
|
||||||
|
|
@ -195,16 +194,13 @@ func (_i *ppidDataFilesController) Delete(c *fiber.Ctx) error {
|
||||||
// @Description API for create PpidDataFiles
|
// @Description API for create PpidDataFiles
|
||||||
// @Tags PPID Files
|
// @Tags PPID Files
|
||||||
// @Security Bearer
|
// @Security Bearer
|
||||||
// @Param id path string true "Ppid Data ID"
|
// @Param filename path string true "Ppid Data Filename"
|
||||||
// @Success 200 {object} response.Response
|
// @Success 200 {object} response.Response
|
||||||
// @Failure 400 {object} response.BadRequestError
|
// @Failure 400 {object} response.BadRequestError
|
||||||
// @Failure 401 {object} response.UnauthorizedError
|
// @Failure 401 {object} response.UnauthorizedError
|
||||||
// @Failure 500 {object} response.InternalServerError
|
// @Failure 500 {object} response.InternalServerError
|
||||||
// @Router /ppid-data-files/viewer/{id} [get]
|
// @Router /ppid-data-files/viewer/{filename} [get]
|
||||||
func (_i *ppidDataFilesController) Viewer(c *fiber.Ctx) error {
|
func (_i *ppidDataFilesController) Viewer(c *fiber.Ctx) error {
|
||||||
id, err := strconv.ParseUint(c.Params("id"), 10, 0)
|
filename := c.Params("filename")
|
||||||
if err != nil {
|
return _i.ppidDataFilesService.Viewer(c, filename)
|
||||||
return err
|
|
||||||
}
|
|
||||||
return _i.ppidDataFilesService.Viewer(c, uint(id))
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,7 @@ func PpidDataFilesResponseMapper(ppidDataFilesReq *entity.PpidDataFiles) (ppidDa
|
||||||
ID: ppidDataFilesReq.ID,
|
ID: ppidDataFilesReq.ID,
|
||||||
Title: ppidDataFilesReq.Title,
|
Title: ppidDataFilesReq.Title,
|
||||||
PpidDataId: ppidDataFilesReq.PpidDataId,
|
PpidDataId: ppidDataFilesReq.PpidDataId,
|
||||||
Description: ppidDataFilesReq.Description,
|
FileUrl: "/ppid-data-files/viewer/" + *ppidDataFilesReq.FileName,
|
||||||
Unit: ppidDataFilesReq.Unit,
|
|
||||||
FileType: ppidDataFilesReq.FileType,
|
FileType: ppidDataFilesReq.FileType,
|
||||||
DownloadCount: ppidDataFilesReq.DownloadCount,
|
DownloadCount: ppidDataFilesReq.DownloadCount,
|
||||||
CreatedById: ppidDataFilesReq.CreatedById,
|
CreatedById: ppidDataFilesReq.CreatedById,
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,9 @@ func (_i *PpidDataFilesRouter) RegisterPpidDataFilesRoutes() {
|
||||||
_i.App.Route("/ppid-data-files", func(router fiber.Router) {
|
_i.App.Route("/ppid-data-files", func(router fiber.Router) {
|
||||||
router.Get("/", ppidDataFilesController.All)
|
router.Get("/", ppidDataFilesController.All)
|
||||||
router.Get("/:id", ppidDataFilesController.Show)
|
router.Get("/:id", ppidDataFilesController.Show)
|
||||||
router.Post("/", ppidDataFilesController.Save)
|
router.Post("/:ppidDataId", ppidDataFilesController.Save)
|
||||||
router.Put("/:id", ppidDataFilesController.Update)
|
router.Put("/:id", ppidDataFilesController.Update)
|
||||||
router.Delete("/:id", ppidDataFilesController.Delete)
|
router.Delete("/:id", ppidDataFilesController.Delete)
|
||||||
router.Get("/viewer/:id", ppidDataFilesController.Viewer)
|
router.Get("/viewer/:filename", ppidDataFilesController.Viewer)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package repository
|
package repository
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/rs/zerolog"
|
||||||
"go-humas-be/app/database"
|
"go-humas-be/app/database"
|
||||||
"go-humas-be/app/database/entity"
|
"go-humas-be/app/database/entity"
|
||||||
"go-humas-be/app/module/ppid_data_files/request"
|
"go-humas-be/app/module/ppid_data_files/request"
|
||||||
|
|
@ -9,20 +10,24 @@ import (
|
||||||
|
|
||||||
type ppidDataFilesRepository struct {
|
type ppidDataFilesRepository struct {
|
||||||
DB *database.Database
|
DB *database.Database
|
||||||
|
Log zerolog.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
// PpidDataFilesRepository define interface of IPpidDataFilesRepository
|
// PpidDataFilesRepository define interface of IPpidDataFilesRepository
|
||||||
type PpidDataFilesRepository interface {
|
type PpidDataFilesRepository interface {
|
||||||
GetAll(req request.PpidDataFilesQueryRequest) (ppidDataFiless []*entity.PpidDataFiles, paging paginator.Pagination, err error)
|
GetAll(req request.PpidDataFilesQueryRequest) (ppidDataFiless []*entity.PpidDataFiles, paging paginator.Pagination, err error)
|
||||||
FindOne(id uint) (ppidDataFiles *entity.PpidDataFiles, err error)
|
FindOne(id uint) (ppidDataFiles *entity.PpidDataFiles, err error)
|
||||||
|
FindByFilename(filename string) (ppidDataFiles *entity.PpidDataFiles, err error)
|
||||||
|
FindByPpidData(ppidDataId uint) (ppidDataFiless []*entity.PpidDataFiles, err error)
|
||||||
Create(ppidDataFiles *entity.PpidDataFiles) (err error)
|
Create(ppidDataFiles *entity.PpidDataFiles) (err error)
|
||||||
Update(id uint, ppidDataFiles *entity.PpidDataFiles) (err error)
|
Update(id uint, ppidDataFiles *entity.PpidDataFiles) (err error)
|
||||||
Delete(id uint) (err error)
|
Delete(id uint) (err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPpidDataFilesRepository(db *database.Database) PpidDataFilesRepository {
|
func NewPpidDataFilesRepository(db *database.Database, logger zerolog.Logger) PpidDataFilesRepository {
|
||||||
return &ppidDataFilesRepository{
|
return &ppidDataFilesRepository{
|
||||||
DB: db,
|
DB: db,
|
||||||
|
Log: logger,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,6 +59,23 @@ func (_i *ppidDataFilesRepository) FindOne(id uint) (ppidDataFiles *entity.PpidD
|
||||||
return ppidDataFiles, nil
|
return ppidDataFiles, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (_i *ppidDataFilesRepository) FindByFilename(filename string) (ppidDataFiles *entity.PpidDataFiles, err error) {
|
||||||
|
|
||||||
|
if err := _i.DB.DB.Where("file_name = ?", filename).First(&ppidDataFiles).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return ppidDataFiles, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_i *ppidDataFilesRepository) FindByPpidData(ppidDataId uint) (ppidDataFiles []*entity.PpidDataFiles, err error) {
|
||||||
|
if err := _i.DB.DB.Where("ppid_data_id = ?", ppidDataId).Find(&ppidDataFiles).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return ppidDataFiles, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (_i *ppidDataFilesRepository) Create(ppidDataFiles *entity.PpidDataFiles) (err error) {
|
func (_i *ppidDataFilesRepository) Create(ppidDataFiles *entity.PpidDataFiles) (err error) {
|
||||||
return _i.DB.DB.Create(ppidDataFiles).Error
|
return _i.DB.DB.Create(ppidDataFiles).Error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,9 @@ type PpidDataFilesQueryRequest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type PpidDataFilesCreateRequest struct {
|
type PpidDataFilesCreateRequest struct {
|
||||||
Title string `json:"title" validate:"required"`
|
|
||||||
PpidDataId int `json:"ppidDataId" validate:"required"`
|
PpidDataId int `json:"ppidDataId" validate:"required"`
|
||||||
Description string `json:"description" validate:"required"`
|
Title *string `json:"title" validate:"required"`
|
||||||
Unit string `json:"unit" validate:"required"`
|
FileType *string `json:"fileType"`
|
||||||
FileType string `json:"fileType" validate:"required"`
|
|
||||||
FileName *string `json:"fileName"`
|
FileName *string `json:"fileName"`
|
||||||
FilePath *string `json:"filePath"`
|
FilePath *string `json:"filePath"`
|
||||||
Size *string `json:"size"`
|
Size *string `json:"size"`
|
||||||
|
|
@ -39,8 +37,6 @@ func (req PpidDataFilesCreateRequest) ToEntity() *entity.PpidDataFiles {
|
||||||
return &entity.PpidDataFiles{
|
return &entity.PpidDataFiles{
|
||||||
Title: req.Title,
|
Title: req.Title,
|
||||||
PpidDataId: req.PpidDataId,
|
PpidDataId: req.PpidDataId,
|
||||||
Description: req.Description,
|
|
||||||
Unit: req.Unit,
|
|
||||||
FileType: req.FileType,
|
FileType: req.FileType,
|
||||||
FileName: req.FileName,
|
FileName: req.FileName,
|
||||||
FilePath: req.FilePath,
|
FilePath: req.FilePath,
|
||||||
|
|
@ -52,11 +48,9 @@ func (req PpidDataFilesCreateRequest) ToEntity() *entity.PpidDataFiles {
|
||||||
|
|
||||||
type PpidDataFilesUpdateRequest struct {
|
type PpidDataFilesUpdateRequest struct {
|
||||||
ID uint `json:"id" validate:"required"`
|
ID uint `json:"id" validate:"required"`
|
||||||
Title string `json:"title" validate:"required"`
|
|
||||||
PpidDataId int `json:"ppidDataId" validate:"required"`
|
PpidDataId int `json:"ppidDataId" validate:"required"`
|
||||||
Description string `json:"description" validate:"required"`
|
Title *string `json:"title"`
|
||||||
Unit string `json:"unit" validate:"required"`
|
FileType *string `json:"fileType"`
|
||||||
FileType string `json:"fileType" validate:"required"`
|
|
||||||
FilePath *string `json:"filePath"`
|
FilePath *string `json:"filePath"`
|
||||||
CreatedById *int `json:"createdById"`
|
CreatedById *int `json:"createdById"`
|
||||||
StatusId *int `json:"statusId"`
|
StatusId *int `json:"statusId"`
|
||||||
|
|
@ -69,8 +63,6 @@ func (req PpidDataFilesUpdateRequest) ToEntity() *entity.PpidDataFiles {
|
||||||
ID: req.ID,
|
ID: req.ID,
|
||||||
Title: req.Title,
|
Title: req.Title,
|
||||||
PpidDataId: req.PpidDataId,
|
PpidDataId: req.PpidDataId,
|
||||||
Description: req.Description,
|
|
||||||
Unit: req.Unit,
|
|
||||||
FileType: req.FileType,
|
FileType: req.FileType,
|
||||||
FilePath: req.FilePath,
|
FilePath: req.FilePath,
|
||||||
CreatedById: req.CreatedById,
|
CreatedById: req.CreatedById,
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ import "time"
|
||||||
|
|
||||||
type PpidDataFilesResponse struct {
|
type PpidDataFilesResponse struct {
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
Title string `json:"title"`
|
Title *string `json:"title"`
|
||||||
PpidDataId int `json:"ppid_data_id"`
|
PpidDataId int `json:"ppidDataId"`
|
||||||
Description string `json:"description"`
|
FileName uint `json:"fileName"`
|
||||||
Unit string `json:"unit"`
|
FileType *string `json:"fileType"`
|
||||||
FileType string `json:"file_type"`
|
FileUrl string `json:"fileUrl"`
|
||||||
DownloadCount *int `json:"download_count"`
|
DownloadCount *int `json:"downloadCount"`
|
||||||
CreatedById *int `json:"created_by_id"`
|
CreatedById *int `json:"createdById"`
|
||||||
StatusId *int `json:"status_id"`
|
StatusId *int `json:"status_id"`
|
||||||
IsPublish *bool `json:"is_publish"`
|
IsPublish *bool `json:"is_publish"`
|
||||||
PublishedAt *time.Time `json:"published_at"`
|
PublishedAt *time.Time `json:"published_at"`
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,11 @@ import (
|
||||||
"go-humas-be/app/module/ppid_data_files/response"
|
"go-humas-be/app/module/ppid_data_files/response"
|
||||||
minioStorage "go-humas-be/config/config"
|
minioStorage "go-humas-be/config/config"
|
||||||
"go-humas-be/utils/paginator"
|
"go-humas-be/utils/paginator"
|
||||||
utilVal "go-humas-be/utils/validator"
|
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
"math/rand"
|
||||||
"mime"
|
"mime"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -34,7 +35,7 @@ type PpidDataFilesService interface {
|
||||||
Save(c *fiber.Ctx) error
|
Save(c *fiber.Ctx) error
|
||||||
Update(id uint, req request.PpidDataFilesUpdateRequest) (err error)
|
Update(id uint, req request.PpidDataFilesUpdateRequest) (err error)
|
||||||
Delete(id uint) error
|
Delete(id uint) error
|
||||||
Viewer(c *fiber.Ctx, id uint) error
|
Viewer(c *fiber.Ctx, filename string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPpidDataFilesService init PpidDataFilesService
|
// NewPpidDataFilesService init PpidDataFilesService
|
||||||
|
|
@ -71,12 +72,8 @@ func (_i *ppidDataFilesService) Show(id uint) (ppidDataFiles *response.PpidDataF
|
||||||
}
|
}
|
||||||
|
|
||||||
func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
|
func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
|
||||||
req := new(request.PpidDataFilesCreateRequest)
|
|
||||||
if err := utilVal.ParseAndValidate(c, req); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
id, err := strconv.ParseUint(c.Params("id"), 10, 0)
|
id, err := strconv.ParseUint(c.Params("ppidDataId"), 10, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -112,19 +109,28 @@ func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
|
||||||
}
|
}
|
||||||
defer src.Close()
|
defer src.Close()
|
||||||
|
|
||||||
objectName := "ppid/upload/" + file.Filename
|
filename := filepath.Base(file.Filename)
|
||||||
//filenameOnly := file.Filename[:len(file.Filename)-len(filepath.Ext(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/upload/" + newFilename
|
||||||
size := strconv.FormatInt(file.Size, 10)
|
size := strconv.FormatInt(file.Size, 10)
|
||||||
|
statusId := 1
|
||||||
|
|
||||||
req := request.PpidDataFilesCreateRequest{
|
req := request.PpidDataFilesCreateRequest{
|
||||||
Title: req.Title,
|
|
||||||
Description: req.Description,
|
|
||||||
Unit: req.Unit,
|
|
||||||
PpidDataId: int(id),
|
PpidDataId: int(id),
|
||||||
FileType: req.FileType,
|
Title: &newFilenameWithoutExt,
|
||||||
FileName: &file.Filename,
|
FileType: &extension,
|
||||||
|
FileName: &newFilename,
|
||||||
FilePath: &objectName,
|
FilePath: &objectName,
|
||||||
Size: &size,
|
Size: &size,
|
||||||
|
StatusId: &statusId,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = _i.Repo.Create(req.ToEntity())
|
err = _i.Repo.Create(req.ToEntity())
|
||||||
|
|
@ -155,8 +161,8 @@ func (_i *ppidDataFilesService) Delete(id uint) error {
|
||||||
return _i.Repo.Delete(id)
|
return _i.Repo.Delete(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (_i *ppidDataFilesService) Viewer(c *fiber.Ctx, id uint) (err error) {
|
func (_i *ppidDataFilesService) Viewer(c *fiber.Ctx, filename string) (err error) {
|
||||||
result, err := _i.Repo.FindOne(id)
|
result, err := _i.Repo.FindByFilename(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ func (_i *ppidDatasController) Save(c *fiber.Ctx) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
authToken := c.Get("Authorization")
|
authToken := c.Get("Authorization")
|
||||||
err := _i.ppidDatasService.Save(*req, authToken)
|
dataResult, err := _i.ppidDatasService.Save(*req, authToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -128,6 +128,7 @@ func (_i *ppidDatasController) Save(c *fiber.Ctx) error {
|
||||||
return utilRes.Resp(c, utilRes.Response{
|
return utilRes.Resp(c, utilRes.Response{
|
||||||
Success: true,
|
Success: true,
|
||||||
Messages: utilRes.Messages{"PpidDatas successfully created"},
|
Messages: utilRes.Messages{"PpidDatas successfully created"},
|
||||||
|
Data: dataResult,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,20 @@ import (
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"go-humas-be/app/database/entity"
|
"go-humas-be/app/database/entity"
|
||||||
ppidDataCategoriesRepository "go-humas-be/app/module/ppid_data_categories/repository"
|
ppidDataCategoriesRepository "go-humas-be/app/module/ppid_data_categories/repository"
|
||||||
|
ppidDataFilesMapper "go-humas-be/app/module/ppid_data_files/mapper"
|
||||||
|
ppidDataFilesRepository "go-humas-be/app/module/ppid_data_files/repository"
|
||||||
|
ppidDataFilesResponse "go-humas-be/app/module/ppid_data_files/response"
|
||||||
res "go-humas-be/app/module/ppid_datas/response"
|
res "go-humas-be/app/module/ppid_datas/response"
|
||||||
usersRepository "go-humas-be/app/module/users/repository"
|
usersRepository "go-humas-be/app/module/users/repository"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func PpidDatasResponseMapper(log zerolog.Logger, ppidDataCategoriesRepo ppidDataCategoriesRepository.PpidDataCategoriesRepository, usersRepo usersRepository.UsersRepository, ppidDatasReq *entity.PpidDatas) (ppidDatasRes *res.PpidDatasResponse) {
|
func PpidDatasResponseMapper(
|
||||||
|
log zerolog.Logger,
|
||||||
|
ppidDataCategoriesRepo ppidDataCategoriesRepository.PpidDataCategoriesRepository,
|
||||||
|
ppidDataFilesRepo ppidDataFilesRepository.PpidDataFilesRepository,
|
||||||
|
usersRepo usersRepository.UsersRepository,
|
||||||
|
ppidDatasReq *entity.PpidDatas,
|
||||||
|
) (ppidDatasRes *res.PpidDatasResponse) {
|
||||||
if ppidDatasReq != nil {
|
if ppidDatasReq != nil {
|
||||||
findCategory, _ := ppidDataCategoriesRepo.FindOne(ppidDatasReq.CategoryId)
|
findCategory, _ := ppidDataCategoriesRepo.FindOne(ppidDatasReq.CategoryId)
|
||||||
categoryName := ""
|
categoryName := ""
|
||||||
|
|
@ -23,9 +31,18 @@ func PpidDatasResponseMapper(log zerolog.Logger, ppidDataCategoriesRepo ppidData
|
||||||
createdByName = findUser.Fullname
|
createdByName = findUser.Fullname
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info().Str("timestamp", time.Now().
|
ppidDataFiles, _ := ppidDataFilesRepo.FindByPpidData(ppidDatasReq.ID)
|
||||||
Format(time.RFC3339)).Str("Service:PpidDatasResponseMapper", "UserInfo:PpidData").
|
|
||||||
Interface("payload", findCategory).Msg("")
|
var ppidDataFilesArr []*ppidDataFilesResponse.PpidDataFilesResponse
|
||||||
|
if len(ppidDataFiles) > 0 {
|
||||||
|
for _, result := range ppidDataFiles {
|
||||||
|
ppidDataFilesArr = append(ppidDataFilesArr, ppidDataFilesMapper.PpidDataFilesResponseMapper(result))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//log.Info().Str("timestamp", time.Now().
|
||||||
|
// Format(time.RFC3339)).Str("Service:PpidDatasResponseMapper", "UserInfo:PpidData").
|
||||||
|
// Interface("payload", ppidDataFiles).Msg("")
|
||||||
|
|
||||||
ppidDatasRes = &res.PpidDatasResponse{
|
ppidDatasRes = &res.PpidDatasResponse{
|
||||||
ID: ppidDatasReq.ID,
|
ID: ppidDatasReq.ID,
|
||||||
|
|
@ -41,6 +58,8 @@ func PpidDatasResponseMapper(log zerolog.Logger, ppidDataCategoriesRepo ppidData
|
||||||
IsActive: ppidDatasReq.IsActive,
|
IsActive: ppidDatasReq.IsActive,
|
||||||
CreatedAt: ppidDatasReq.CreatedAt,
|
CreatedAt: ppidDatasReq.CreatedAt,
|
||||||
UpdatedAt: ppidDatasReq.UpdatedAt,
|
UpdatedAt: ppidDatasReq.UpdatedAt,
|
||||||
|
|
||||||
|
PpidDataFiles: ppidDataFilesArr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ppidDatasRes
|
return ppidDatasRes
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,33 @@ package repository
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/rs/zerolog"
|
||||||
"go-humas-be/app/database"
|
"go-humas-be/app/database"
|
||||||
"go-humas-be/app/database/entity"
|
"go-humas-be/app/database/entity"
|
||||||
"go-humas-be/app/module/ppid_datas/request"
|
"go-humas-be/app/module/ppid_datas/request"
|
||||||
"go-humas-be/utils/paginator"
|
"go-humas-be/utils/paginator"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ppidDatasRepository struct {
|
type ppidDatasRepository struct {
|
||||||
DB *database.Database
|
DB *database.Database
|
||||||
|
Log zerolog.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
// PpidDatasRepository define interface of IPpidDatasRepository
|
// PpidDatasRepository define interface of IPpidDatasRepository
|
||||||
type PpidDatasRepository interface {
|
type PpidDatasRepository interface {
|
||||||
GetAll(req request.PpidDatasQueryRequest) (ppidDatass []*entity.PpidDatas, paging paginator.Pagination, err error)
|
GetAll(req request.PpidDatasQueryRequest) (ppidDatass []*entity.PpidDatas, paging paginator.Pagination, err error)
|
||||||
FindOne(id uint) (ppidDatas *entity.PpidDatas, err error)
|
FindOne(id uint) (ppidDatas *entity.PpidDatas, err error)
|
||||||
Create(ppidDatas *entity.PpidDatas) (err error)
|
Create(ppidDatas *entity.PpidDatas) (ppidDataReturn *entity.PpidDatas, err error)
|
||||||
Update(id uint, ppidDatas *entity.PpidDatas) (err error)
|
Update(id uint, ppidDatas *entity.PpidDatas) (err error)
|
||||||
Delete(id uint) (err error)
|
Delete(id uint) (err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPpidDatasRepository(db *database.Database) PpidDatasRepository {
|
func NewPpidDatasRepository(db *database.Database, logger zerolog.Logger) PpidDatasRepository {
|
||||||
return &ppidDatasRepository{
|
return &ppidDatasRepository{
|
||||||
DB: db,
|
DB: db,
|
||||||
|
Log: logger,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,8 +94,14 @@ func (_i *ppidDatasRepository) FindOne(id uint) (ppidDatas *entity.PpidDatas, er
|
||||||
return ppidDatas, nil
|
return ppidDatas, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (_i *ppidDatasRepository) Create(ppidDatas *entity.PpidDatas) (err error) {
|
func (_i *ppidDatasRepository) Create(ppidDatas *entity.PpidDatas) (ppidDataReturn *entity.PpidDatas, err error) {
|
||||||
return _i.DB.DB.Create(ppidDatas).Error
|
result := _i.DB.DB.Create(ppidDatas)
|
||||||
|
|
||||||
|
_i.Log.Info().Str("timestamp", time.Now().
|
||||||
|
Format(time.RFC3339)).Str("Service:Create", "PpidData:Create").
|
||||||
|
Interface("result", ppidDatas).Msg("")
|
||||||
|
|
||||||
|
return ppidDatas, result.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (_i *ppidDatasRepository) Update(id uint, ppidDatas *entity.PpidDatas) (err error) {
|
func (_i *ppidDatasRepository) Update(id uint, ppidDatas *entity.PpidDatas) (err error) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package response
|
package response
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
ppidDataFilesResponse "go-humas-be/app/module/ppid_data_files/response"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type PpidDatasResponse struct {
|
type PpidDatasResponse struct {
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
|
|
@ -17,4 +20,6 @@ type PpidDatasResponse struct {
|
||||||
IsActive *bool `json:"isActive"`
|
IsActive *bool `json:"isActive"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
|
|
||||||
|
PpidDataFiles []*ppidDataFilesResponse.PpidDataFilesResponse `json:"files"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
|
"go-humas-be/app/database/entity"
|
||||||
ppidDataCategoriesRepository "go-humas-be/app/module/ppid_data_categories/repository"
|
ppidDataCategoriesRepository "go-humas-be/app/module/ppid_data_categories/repository"
|
||||||
|
ppidDataFilesRepository "go-humas-be/app/module/ppid_data_files/repository"
|
||||||
"go-humas-be/app/module/ppid_datas/mapper"
|
"go-humas-be/app/module/ppid_datas/mapper"
|
||||||
"go-humas-be/app/module/ppid_datas/repository"
|
"go-humas-be/app/module/ppid_datas/repository"
|
||||||
"go-humas-be/app/module/ppid_datas/request"
|
"go-humas-be/app/module/ppid_datas/request"
|
||||||
|
|
@ -17,6 +19,7 @@ import (
|
||||||
type ppidDatasService struct {
|
type ppidDatasService struct {
|
||||||
Repo repository.PpidDatasRepository
|
Repo repository.PpidDatasRepository
|
||||||
PpidDataCategoriesRepo ppidDataCategoriesRepository.PpidDataCategoriesRepository
|
PpidDataCategoriesRepo ppidDataCategoriesRepository.PpidDataCategoriesRepository
|
||||||
|
PpidDataFilesRepo ppidDataFilesRepository.PpidDataFilesRepository
|
||||||
UsersRepo usersRepository.UsersRepository
|
UsersRepo usersRepository.UsersRepository
|
||||||
UserLevelsRepo userLevelsRepository.UserLevelsRepository
|
UserLevelsRepo userLevelsRepository.UserLevelsRepository
|
||||||
Log zerolog.Logger
|
Log zerolog.Logger
|
||||||
|
|
@ -26,17 +29,25 @@ type ppidDatasService struct {
|
||||||
type PpidDatasService interface {
|
type PpidDatasService interface {
|
||||||
All(req request.PpidDatasQueryRequest) (ppidDatas []*response.PpidDatasResponse, paging paginator.Pagination, err error)
|
All(req request.PpidDatasQueryRequest) (ppidDatas []*response.PpidDatasResponse, paging paginator.Pagination, err error)
|
||||||
Show(id uint) (ppidDatas *response.PpidDatasResponse, err error)
|
Show(id uint) (ppidDatas *response.PpidDatasResponse, err error)
|
||||||
Save(req request.PpidDatasCreateRequest, authToken string) (err error)
|
Save(req request.PpidDatasCreateRequest, authToken string) (ppidDatas *entity.PpidDatas, err error)
|
||||||
Update(id uint, req request.PpidDatasUpdateRequest) (err error)
|
Update(id uint, req request.PpidDatasUpdateRequest) (err error)
|
||||||
Delete(id uint) error
|
Delete(id uint) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPpidDatasService init PpidDatasService
|
// NewPpidDatasService init PpidDatasService
|
||||||
func NewPpidDatasService(repo repository.PpidDatasRepository, ppidCategoriesRepository ppidDataCategoriesRepository.PpidDataCategoriesRepository, usersRepo usersRepository.UsersRepository, userLevelsRepo userLevelsRepository.UserLevelsRepository, log zerolog.Logger) PpidDatasService {
|
func NewPpidDatasService(
|
||||||
|
repo repository.PpidDatasRepository,
|
||||||
|
ppidDataCategoriesRepo ppidDataCategoriesRepository.PpidDataCategoriesRepository,
|
||||||
|
ppidDataFilesRepo ppidDataFilesRepository.PpidDataFilesRepository,
|
||||||
|
usersRepo usersRepository.UsersRepository,
|
||||||
|
userLevelsRepo userLevelsRepository.UserLevelsRepository,
|
||||||
|
log zerolog.Logger,
|
||||||
|
) PpidDatasService {
|
||||||
|
|
||||||
return &ppidDatasService{
|
return &ppidDatasService{
|
||||||
Repo: repo,
|
Repo: repo,
|
||||||
PpidDataCategoriesRepo: ppidCategoriesRepository,
|
PpidDataCategoriesRepo: ppidDataCategoriesRepo,
|
||||||
|
PpidDataFilesRepo: ppidDataFilesRepo,
|
||||||
UsersRepo: usersRepo,
|
UsersRepo: usersRepo,
|
||||||
UserLevelsRepo: userLevelsRepo,
|
UserLevelsRepo: userLevelsRepo,
|
||||||
Log: log,
|
Log: log,
|
||||||
|
|
@ -51,7 +62,7 @@ func (_i *ppidDatasService) All(req request.PpidDatasQueryRequest) (ppidDatass [
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, result := range results {
|
for _, result := range results {
|
||||||
ppidDatass = append(ppidDatass, mapper.PpidDatasResponseMapper(_i.Log, _i.PpidDataCategoriesRepo, _i.UsersRepo, result))
|
ppidDatass = append(ppidDatass, mapper.PpidDatasResponseMapper(_i.Log, _i.PpidDataCategoriesRepo, _i.PpidDataFilesRepo, _i.UsersRepo, result))
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
@ -63,10 +74,10 @@ func (_i *ppidDatasService) Show(id uint) (ppidDatas *response.PpidDatasResponse
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapper.PpidDatasResponseMapper(_i.Log, _i.PpidDataCategoriesRepo, _i.UsersRepo, result), nil
|
return mapper.PpidDatasResponseMapper(_i.Log, _i.PpidDataCategoriesRepo, _i.PpidDataFilesRepo, _i.UsersRepo, result), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (_i *ppidDatasService) Save(req request.PpidDatasCreateRequest, authToken string) (err error) {
|
func (_i *ppidDatasService) Save(req request.PpidDatasCreateRequest, authToken string) (ppidDatas *entity.PpidDatas, err error) {
|
||||||
_i.Log.Info().Interface("data", req).Msg("")
|
_i.Log.Info().Interface("data", req).Msg("")
|
||||||
newReq := req.ToEntity()
|
newReq := req.ToEntity()
|
||||||
|
|
||||||
|
|
@ -76,7 +87,7 @@ func (_i *ppidDatasService) Save(req request.PpidDatasCreateRequest, authToken s
|
||||||
|
|
||||||
userLevels, err := _i.UserLevelsRepo.FindOne(uint(createdBy.UserLevelId))
|
userLevels, err := _i.UserLevelsRepo.FindOne(uint(createdBy.UserLevelId))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
newReq.Group = userLevels.Group
|
newReq.Group = userLevels.Group
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ level = 0 # panic -> 5, fatal -> 4, error -> 3, warn -> 2, info -> 1, debug -> 0
|
||||||
prettier = true
|
prettier = true
|
||||||
|
|
||||||
[objectstorage.miniostorage]
|
[objectstorage.miniostorage]
|
||||||
endpoint = "103.82.242.92:9009 "
|
endpoint = "103.82.242.92:9009"
|
||||||
access-key-id = "A7USQd6iyinj38nDwnFE"
|
access-key-id = "A7USQd6iyinj38nDwnFE"
|
||||||
secret-access-key = "rTXDKRL8fhXUOaLDonwYThvDBPgNGPxvReTgfVGR"
|
secret-access-key = "rTXDKRL8fhXUOaLDonwYThvDBPgNGPxvReTgfVGR"
|
||||||
use-ssl = false
|
use-ssl = false
|
||||||
|
|
|
||||||
|
|
@ -3457,7 +3457,7 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/ppid-data-files/viewer/{id}": {
|
"/ppid-data-files/viewer/{filename}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -3472,8 +3472,8 @@ const docTemplate = `{
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Ppid Data ID",
|
"description": "Ppid Data Filename",
|
||||||
"name": "id",
|
"name": "filename",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
|
|
@ -3681,15 +3681,6 @@ const docTemplate = `{
|
||||||
"in": "formData",
|
"in": "formData",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"description": "Required payload",
|
|
||||||
"name": "payload",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/request.PpidDataFilesCreateRequest"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "Ppid Data ID",
|
"description": "Ppid Data ID",
|
||||||
|
|
@ -5829,65 +5820,16 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"request.PpidDataFilesCreateRequest": {
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"description",
|
|
||||||
"fileType",
|
|
||||||
"ppidDataId",
|
|
||||||
"title",
|
|
||||||
"unit"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"createdById": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"fileName": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"filePath": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"fileType": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ppidDataId": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"size": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"statusId": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"unit": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"request.PpidDataFilesUpdateRequest": {
|
"request.PpidDataFilesUpdateRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"description",
|
|
||||||
"fileType",
|
|
||||||
"id",
|
"id",
|
||||||
"ppidDataId",
|
"ppidDataId"
|
||||||
"title",
|
|
||||||
"unit"
|
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"createdById": {
|
"createdById": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"filePath": {
|
"filePath": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
@ -5911,9 +5853,6 @@ const docTemplate = `{
|
||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
|
||||||
"unit": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3446,7 +3446,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/ppid-data-files/viewer/{id}": {
|
"/ppid-data-files/viewer/{filename}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -3461,8 +3461,8 @@
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Ppid Data ID",
|
"description": "Ppid Data Filename",
|
||||||
"name": "id",
|
"name": "filename",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
|
|
@ -3670,15 +3670,6 @@
|
||||||
"in": "formData",
|
"in": "formData",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"description": "Required payload",
|
|
||||||
"name": "payload",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/request.PpidDataFilesCreateRequest"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "Ppid Data ID",
|
"description": "Ppid Data ID",
|
||||||
|
|
@ -5818,65 +5809,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"request.PpidDataFilesCreateRequest": {
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"description",
|
|
||||||
"fileType",
|
|
||||||
"ppidDataId",
|
|
||||||
"title",
|
|
||||||
"unit"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"createdById": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"fileName": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"filePath": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"fileType": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ppidDataId": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"size": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"statusId": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"unit": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"request.PpidDataFilesUpdateRequest": {
|
"request.PpidDataFilesUpdateRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"description",
|
|
||||||
"fileType",
|
|
||||||
"id",
|
"id",
|
||||||
"ppidDataId",
|
"ppidDataId"
|
||||||
"title",
|
|
||||||
"unit"
|
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"createdById": {
|
"createdById": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"description": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"filePath": {
|
"filePath": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
@ -5900,9 +5842,6 @@
|
||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
|
||||||
"unit": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -214,41 +214,10 @@ definitions:
|
||||||
- slug
|
- slug
|
||||||
- title
|
- title
|
||||||
type: object
|
type: object
|
||||||
request.PpidDataFilesCreateRequest:
|
|
||||||
properties:
|
|
||||||
createdById:
|
|
||||||
type: integer
|
|
||||||
description:
|
|
||||||
type: string
|
|
||||||
fileName:
|
|
||||||
type: string
|
|
||||||
filePath:
|
|
||||||
type: string
|
|
||||||
fileType:
|
|
||||||
type: string
|
|
||||||
ppidDataId:
|
|
||||||
type: integer
|
|
||||||
size:
|
|
||||||
type: string
|
|
||||||
statusId:
|
|
||||||
type: integer
|
|
||||||
title:
|
|
||||||
type: string
|
|
||||||
unit:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- description
|
|
||||||
- fileType
|
|
||||||
- ppidDataId
|
|
||||||
- title
|
|
||||||
- unit
|
|
||||||
type: object
|
|
||||||
request.PpidDataFilesUpdateRequest:
|
request.PpidDataFilesUpdateRequest:
|
||||||
properties:
|
properties:
|
||||||
createdById:
|
createdById:
|
||||||
type: integer
|
type: integer
|
||||||
description:
|
|
||||||
type: string
|
|
||||||
filePath:
|
filePath:
|
||||||
type: string
|
type: string
|
||||||
fileType:
|
fileType:
|
||||||
|
|
@ -265,15 +234,9 @@ definitions:
|
||||||
type: integer
|
type: integer
|
||||||
title:
|
title:
|
||||||
type: string
|
type: string
|
||||||
unit:
|
|
||||||
type: string
|
|
||||||
required:
|
required:
|
||||||
- description
|
|
||||||
- fileType
|
|
||||||
- id
|
- id
|
||||||
- ppidDataId
|
- ppidDataId
|
||||||
- title
|
|
||||||
- unit
|
|
||||||
type: object
|
type: object
|
||||||
request.PpidDatasCreateRequest:
|
request.PpidDatasCreateRequest:
|
||||||
properties:
|
properties:
|
||||||
|
|
@ -2859,12 +2822,6 @@ paths:
|
||||||
name: files
|
name: files
|
||||||
required: true
|
required: true
|
||||||
type: file
|
type: file
|
||||||
- description: Required payload
|
|
||||||
in: body
|
|
||||||
name: payload
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/request.PpidDataFilesCreateRequest'
|
|
||||||
- description: Ppid Data ID
|
- description: Ppid Data ID
|
||||||
in: path
|
in: path
|
||||||
name: ppidDataId
|
name: ppidDataId
|
||||||
|
|
@ -2894,13 +2851,13 @@ paths:
|
||||||
summary: Create PpidDataFiles
|
summary: Create PpidDataFiles
|
||||||
tags:
|
tags:
|
||||||
- PPID Files
|
- PPID Files
|
||||||
/ppid-data-files/viewer/{id}:
|
/ppid-data-files/viewer/{filename}:
|
||||||
get:
|
get:
|
||||||
description: API for create PpidDataFiles
|
description: API for create PpidDataFiles
|
||||||
parameters:
|
parameters:
|
||||||
- description: Ppid Data ID
|
- description: Ppid Data Filename
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: filename
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
responses:
|
responses:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue