Browse Source

Add csv tags in Credential

Andrea Fazzi 6 years ago
parent
commit
23531da040
1 changed files with 9 additions and 5 deletions
  1. 9 5
      orm/credential.go

+ 9 - 5
orm/credential.go

@@ -13,14 +13,14 @@ import (
 type Checkbox bool
 
 type Credential struct {
-	Name            string
-	Surname         string
+	Name            string `csv:"firstname"`
+	Surname         string `csv:"lastname"`
 	Password        string
 	PlainPassword   string
-	Email           string
+	Email           string `csv:"email"`
 	AltEmail        string
-	FromDate        time.Time
-	ToDate          time.Time
+	DateFrom        time.Time
+	DateTo          time.Time
 	TelephoneNumber string
 
 	Regenerate bool `schema:"Regenerate" sql:"default: false"`
@@ -54,3 +54,7 @@ func (c *Credential) GeneratePassword() (string, error) {
 func (c *Credential) CompleteName() string {
 	return fmt.Sprintf("%s, %s", c.Name, c.Surname)
 }
+
+func (c *Credential) MailAddress(domain string) string {
+	return fmt.Sprintf("%s@%s", c.Username(), domain)
+}