Skip to content

Commit

Permalink
chore: add person.GetName()
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Sep 2, 2024
1 parent efcda2a commit 1e750f2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions models/people.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ type Person struct {
Properties PersonProperties `json:"properties,omitempty" gorm:"default:null"`
}

func (p Person) GetName() string {
if p.Email != "" {
return p.Email
}
if p.ExternalID != "" {
return p.ExternalID
}
if p.Name != "" {
return p.Name
}
if p.ID != uuid.Nil {
return p.ID.String()
}
return ""
}

func (p Person) PK() string {
return p.ID.String()
}
Expand Down

0 comments on commit 1e750f2

Please sign in to comment.