autosklo/models.go

26 lines
566 B
Go
Raw Normal View History

2024-01-05 14:49:46 +00:00
package main
type Message struct {
Name string `json:"name"`
NameError string `json:"name_error"`
Phone string `json:"phone"`
PhoneError string `json:"phone_error"`
Email string `json:"email"`
Service string `json:"service"`
Note string `json:"note"`
VIN string `json:"vin"`
Errors int `json:"errors"`
}
func (m *Message) Validate() {
m.Errors = 0
if m.Name == "" {
m.NameError = "Jméno je povinné"
m.Errors += 1
}
if m.Phone == "" {
m.PhoneError = "Telefonní číslo je povinné"
m.Errors += 1
}
}