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 1005B

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