Add site contact information
This commit is contained in:
parent
671397ba81
commit
b9c257a635
1 changed files with 13 additions and 2 deletions
|
|
@ -14,15 +14,21 @@ type Site struct {
|
|||
ID int32 `db:"id" json:"id"`
|
||||
Notes string `db:"notes" json:"notes"`
|
||||
OrganizationID int32 `db:"organization_id" json:"organization_id"`
|
||||
Owner *Contact `db:"owner" json:"owner"`
|
||||
Owner Contact `db:"owner" json:"owner"`
|
||||
ParcelID *int32 `db:"parcel_id" json:"parcel_id"`
|
||||
Resident *Contact `db:"resident" json:"resident"`
|
||||
ResidentOwned bool `db:"resident_owned" json:"resident_owned"`
|
||||
ResidentOwned *bool `db:"resident_owned" json:"resident_owned"`
|
||||
Tags map[string]string `db:"tags" json:"tags"`
|
||||
Version int32 `db:"version" json:"version"`
|
||||
}
|
||||
|
||||
func SiteFromModel(s *models.Site) Site {
|
||||
owner_phone := s.OwnerPhoneE164.GetOr("")
|
||||
var resident_owned *bool
|
||||
if s.ResidentOwned.IsValue() {
|
||||
b := s.ResidentOwned.MustGet()
|
||||
resident_owned = &b
|
||||
}
|
||||
return Site{
|
||||
Created: s.Created,
|
||||
CreatorID: s.CreatorID,
|
||||
|
|
@ -30,6 +36,11 @@ func SiteFromModel(s *models.Site) Site {
|
|||
ID: s.ID,
|
||||
Notes: s.Notes,
|
||||
OrganizationID: s.OrganizationID,
|
||||
Owner: Contact{
|
||||
Name: &s.OwnerName,
|
||||
Phone: &owner_phone,
|
||||
},
|
||||
ResidentOwned: resident_owned,
|
||||
//ParcelID: s.ParcelID,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue