generated from VLADIMIR/template
fix
This commit is contained in:
@@ -21,12 +21,14 @@ var (
|
||||
ErrRegistrationClosed = errors.New("Игра не найдена или регистрация уже закрыта")
|
||||
)
|
||||
|
||||
// Registration contains data required to register a team.
|
||||
type Registration struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
ParticipantsCount int32 `json:"participantsCount"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON decodes and normalizes registration data.
|
||||
func (r *Registration) UnmarshalJSON(data []byte) error {
|
||||
var payload struct {
|
||||
Name string `json:"name"`
|
||||
@@ -63,6 +65,7 @@ func validCaptainEmail(email string) bool {
|
||||
return err == nil && address.Address == email && len(email) <= 254
|
||||
}
|
||||
|
||||
// Validate checks registration data.
|
||||
func (r *Registration) Validate() error {
|
||||
r.Name = strings.TrimSpace(r.Name)
|
||||
r.Email = strings.TrimSpace(r.Email)
|
||||
|
||||
Reference in New Issue
Block a user