32 lines
710 B
Go
32 lines
710 B
Go
package admin
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/ultisuite/ulti-backend/internal/api/apivalidate"
|
|
)
|
|
|
|
const maxQuotaRequestBody = 4 << 10
|
|
|
|
type setQuotaRequest struct {
|
|
MaxStorageBytes int64 `json:"max_storage_bytes"`
|
|
}
|
|
|
|
func validateSetQuota(req *setQuotaRequest) *apivalidate.ValidationError {
|
|
if req.MaxStorageBytes < 0 {
|
|
return apivalidate.NewValidationError(apivalidate.FieldDetail{
|
|
Field: "max_storage_bytes", Message: "must be non-negative",
|
|
})
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func validateUserID(userID string) *apivalidate.ValidationError {
|
|
if strings.TrimSpace(userID) == "" {
|
|
return apivalidate.NewValidationError(apivalidate.FieldDetail{
|
|
Field: "userID", Message: "required",
|
|
})
|
|
}
|
|
return nil
|
|
}
|