fix required field zero value issue

This commit is contained in:
caijunqi 2024-03-28 11:00:24 +08:00
parent c5e6007db7
commit 6df673b5ae

View File

@ -7,6 +7,14 @@ package project
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"io"
"net/http"
"os"
"os/exec"
"path"
"strconv"
"strings"
"github.com/zhenorzz/goploy/cmd/server/api" "github.com/zhenorzz/goploy/cmd/server/api"
"github.com/zhenorzz/goploy/cmd/server/api/middleware" "github.com/zhenorzz/goploy/cmd/server/api/middleware"
"github.com/zhenorzz/goploy/config" "github.com/zhenorzz/goploy/config"
@ -17,13 +25,6 @@ import (
"github.com/zhenorzz/goploy/internal/server" "github.com/zhenorzz/goploy/internal/server"
"github.com/zhenorzz/goploy/internal/server/response" "github.com/zhenorzz/goploy/internal/server/response"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"io"
"net/http"
"os"
"os/exec"
"path"
"strconv"
"strings"
) )
type Project api.API type Project api.API
@ -667,7 +668,7 @@ func (Project) Remove(gp *server.Goploy) server.Response {
// @Router /project/uploadFile [post] // @Router /project/uploadFile [post]
func (Project) UploadFile(gp *server.Goploy) server.Response { func (Project) UploadFile(gp *server.Goploy) server.Response {
type ReqData struct { type ReqData struct {
ProjectFileID int64 `schema:"projectFileId" validate:"required,gte=0"` ProjectFileID int64 `schema:"projectFileId" validate:"gte=0"`
ProjectID int64 `schema:"projectId" validate:"required,gt=0"` ProjectID int64 `schema:"projectId" validate:"required,gt=0"`
Filename string `schema:"filename" validate:"required"` Filename string `schema:"filename" validate:"required"`
} }