feat: update ppid files
This commit is contained in:
parent
63b76cd743
commit
ba29705e17
|
|
@ -111,6 +111,7 @@ func (_i *ppidDataFilesController) Show(c *fiber.Ctx) error {
|
||||||
// @Tags PPID Files
|
// @Tags PPID Files
|
||||||
// @Security Bearer
|
// @Security Bearer
|
||||||
// @Produce json
|
// @Produce json
|
||||||
|
// @Param titles formData string false "Titles"
|
||||||
// @Param types formData string false "Types"
|
// @Param types formData string false "Types"
|
||||||
// @Param positions formData string false "Positions"
|
// @Param positions formData string false "Positions"
|
||||||
// @Param urls formData string false "Upload Url"
|
// @Param urls formData string false "Upload Url"
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,8 @@ func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
|
||||||
Format(time.RFC3339)).Str("Service", "Save").
|
Format(time.RFC3339)).Str("Service", "Save").
|
||||||
Interface("form", form).Msg("")
|
Interface("form", form).Msg("")
|
||||||
|
|
||||||
|
titlesString := form.Value["titles"]
|
||||||
|
titles := strings.Split(titlesString[0], ",")
|
||||||
typesString := form.Value["types"]
|
typesString := form.Value["types"]
|
||||||
types := strings.Split(typesString[0], ",")
|
types := strings.Split(typesString[0], ",")
|
||||||
positionsString := form.Value["positions"]
|
positionsString := form.Value["positions"]
|
||||||
|
|
@ -118,7 +120,9 @@ func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
|
||||||
}
|
}
|
||||||
positionInt := int(positionInt64)
|
positionInt := int(positionInt64)
|
||||||
statusId := 1
|
statusId := 1
|
||||||
|
title := titles[index]
|
||||||
req := request.PpidDataFilesCreateRequest{
|
req := request.PpidDataFilesCreateRequest{
|
||||||
|
Title: &title,
|
||||||
PpidDataId: int(id),
|
PpidDataId: int(id),
|
||||||
Type: &fileType,
|
Type: &fileType,
|
||||||
Position: &positionInt,
|
Position: &positionInt,
|
||||||
|
|
@ -132,11 +136,11 @@ func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
|
||||||
if fileType == "url" {
|
if fileType == "url" {
|
||||||
url := urls[urlCounter]
|
url := urls[urlCounter]
|
||||||
filename := path.Base(url)
|
filename := path.Base(url)
|
||||||
filenameWithoutExt := filepath.Clean(filename[:len(filename)-len(filepath.Ext(filename))])
|
//filenameWithoutExt := filepath.Clean(filename[:len(filename)-len(filepath.Ext(filename))])
|
||||||
extension := filepath.Ext(filename)[1:]
|
extension := filepath.Ext(filename)[1:]
|
||||||
title := strings.ReplaceAll(filenameWithoutExt, "-", " ")
|
//title := strings.ReplaceAll(filenameWithoutExt, "-", " ")
|
||||||
|
|
||||||
req.Title = &title
|
//req.Title = &title
|
||||||
req.FileType = &extension
|
req.FileType = &extension
|
||||||
req.FileName = &filename
|
req.FileName = &filename
|
||||||
req.FileUrl = &url
|
req.FileUrl = &url
|
||||||
|
|
@ -184,7 +188,7 @@ func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) {
|
||||||
fileUrl := "/ppid-data-files/viewer/"
|
fileUrl := "/ppid-data-files/viewer/"
|
||||||
fileUrl += host + port + newFilename
|
fileUrl += host + port + newFilename
|
||||||
|
|
||||||
req.Title = &newFilenameWithoutExt
|
//req.Title = &newFilenameWithoutExt
|
||||||
req.FileType = &extension
|
req.FileType = &extension
|
||||||
req.FileName = &newFilename
|
req.FileName = &newFilename
|
||||||
req.FilePath = &objectName
|
req.FilePath = &objectName
|
||||||
|
|
|
||||||
|
|
@ -4521,6 +4521,12 @@ const docTemplate = `{
|
||||||
],
|
],
|
||||||
"summary": "Create PpidDataFiles",
|
"summary": "Create PpidDataFiles",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Titles",
|
||||||
|
"name": "titles",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Types",
|
"description": "Types",
|
||||||
|
|
|
||||||
|
|
@ -4510,6 +4510,12 @@
|
||||||
],
|
],
|
||||||
"summary": "Create PpidDataFiles",
|
"summary": "Create PpidDataFiles",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Titles",
|
||||||
|
"name": "titles",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Types",
|
"description": "Types",
|
||||||
|
|
|
||||||
|
|
@ -3599,6 +3599,10 @@ paths:
|
||||||
post:
|
post:
|
||||||
description: API for create PpidDataFiles
|
description: API for create PpidDataFiles
|
||||||
parameters:
|
parameters:
|
||||||
|
- description: Titles
|
||||||
|
in: formData
|
||||||
|
name: titles
|
||||||
|
type: string
|
||||||
- description: Types
|
- description: Types
|
||||||
in: formData
|
in: formData
|
||||||
name: types
|
name: types
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue