Move json struct in a new module

This commit is contained in:
2026-01-23 18:26:47 +01:00
parent e1fd12e233
commit 4ac0f4243d
10 changed files with 80 additions and 86 deletions

View File

@@ -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,
}