org.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2015 - Present, The Gogs Authors. All rights reserved.
  2. // Copyright 2018 - Present, Gitote. All rights reserved.
  3. //
  4. // This source code is licensed under the MIT license found in the
  5. // LICENSE file in the root directory of this source tree.
  6. package form
  7. import (
  8. "github.com/go-macaron/binding"
  9. "gopkg.in/macaron.v1"
  10. )
  11. // CreateOrg represents CreateOrg
  12. type CreateOrg struct {
  13. OrgName string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
  14. }
  15. // Validate validates fields
  16. func (f *CreateOrg) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  17. return validate(errs, ctx.Data, f, ctx.Locale)
  18. }
  19. // UpdateOrgSetting holds org settings
  20. type UpdateOrgSetting struct {
  21. Name string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
  22. FullName string `binding:"MaxSize(100)"`
  23. Description string `binding:"MaxSize(255)"`
  24. Website string `binding:"Url;MaxSize(100)"`
  25. Location string `binding:"MaxSize(50)"`
  26. IsVerified bool
  27. MaxRepoCreation int
  28. }
  29. // Validate validates fields
  30. func (f *UpdateOrgSetting) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  31. return validate(errs, ctx.Data, f, ctx.Locale)
  32. }
  33. // CreateTeam represents CreateTeam
  34. type CreateTeam struct {
  35. TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"`
  36. Description string `binding:"MaxSize(255)"`
  37. Permission string
  38. }
  39. // Validate validates fields
  40. func (f *CreateTeam) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  41. return validate(errs, ctx.Data, f, ctx.Locale)
  42. }