You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

package_form.go 939B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2022 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package forms
  4. import (
  5. "net/http"
  6. "code.gitea.io/gitea/modules/context"
  7. "code.gitea.io/gitea/modules/web/middleware"
  8. "gitea.com/go-chi/binding"
  9. )
  10. type PackageCleanupRuleForm struct {
  11. ID int64
  12. Enabled bool
  13. Type string `binding:"Required;In(composer,conan,conda,container,generic,helm,maven,npm,nuget,pub,pypi,rubygems,vagrant)"`
  14. KeepCount int `binding:"In(0,1,5,10,25,50,100)"`
  15. KeepPattern string `binding:"RegexPattern"`
  16. RemoveDays int `binding:"In(0,7,14,30,60,90,180)"`
  17. RemovePattern string `binding:"RegexPattern"`
  18. MatchFullName bool
  19. Action string `binding:"Required;In(save,remove)"`
  20. }
  21. func (f *PackageCleanupRuleForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
  22. ctx := context.GetContext(req)
  23. return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
  24. }