Move json struct in a new module
This commit is contained in:
@@ -4,16 +4,12 @@ import (
|
||||
"net/http"
|
||||
|
||||
"git.artlef.fr/PersonalLibraryManager/internal/appcontext"
|
||||
"git.artlef.fr/PersonalLibraryManager/internal/dto"
|
||||
"git.artlef.fr/PersonalLibraryManager/internal/fileutils"
|
||||
"git.artlef.fr/PersonalLibraryManager/internal/model"
|
||||
"git.artlef.fr/PersonalLibraryManager/internal/myvalidator"
|
||||
)
|
||||
|
||||
type fileInfoPost struct {
|
||||
FileID uint `json:"fileId"`
|
||||
FilePath string `json:"filepath"`
|
||||
}
|
||||
|
||||
func PostUploadBookCoverHandler(ac appcontext.AppContext) {
|
||||
file, err := ac.C.FormFile("file")
|
||||
if err != nil {
|
||||
@@ -28,8 +24,8 @@ func PostUploadBookCoverHandler(ac appcontext.AppContext) {
|
||||
ac.C.JSON(http.StatusOK, staticFileDbToWs(&staticFile))
|
||||
}
|
||||
|
||||
func staticFileDbToWs(f *model.StaticFile) fileInfoPost {
|
||||
return fileInfoPost{
|
||||
func staticFileDbToWs(f *model.StaticFile) dto.FileInfoPost {
|
||||
return dto.FileInfoPost{
|
||||
FileID: f.ID,
|
||||
FilePath: fileutils.GetWsLinkPrefix() + f.Path,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user