diff --git a/platform/site.go b/platform/site.go index 824920cc..5e321279 100644 --- a/platform/site.go +++ b/platform/site.go @@ -81,13 +81,19 @@ func SiteList(ctx context.Context, user User, limit int) ([]*types.Site, error) "site.notes AS \"notes\"", "site.owner_name AS \"owner.name\"", "site.owner_phone_e164 AS \"owner.phone\"", - "site.parcel_id AS \"parcel_id\"", + "COALESCE(site.parcel_id, 0) AS \"parcel.id\"", + "COALESCE(parcel.apn, '') AS \"parcel.apn\"", + "COALESCE(parcel.description, '') AS \"parcel.description\"", ), sm.From("site"), sm.InnerJoin("address").OnEQ( psql.Quote("site", "address_id"), psql.Quote("address", "id"), ), + sm.LeftJoin("parcel").OnEQ( + psql.Quote("site", "parcel_id"), + psql.Quote("parcel", "id"), + ), sm.Where(psql.Quote("site", "organization_id").EQ(psql.Arg(user.Organization.ID))), sm.Limit(limit), ), scan.StructMapper[types.Site]()) diff --git a/platform/types/parcel.go b/platform/types/parcel.go new file mode 100644 index 00000000..df43eaae --- /dev/null +++ b/platform/types/parcel.go @@ -0,0 +1,7 @@ +package types + +type Parcel struct { + APN string `db:"apn" json:"apn"` + ID int32 `db:"id" json:"id"` + Description string `db:"description" json:"description"` +} diff --git a/platform/types/site.go b/platform/types/site.go index 2025032f..894e51c9 100644 --- a/platform/types/site.go +++ b/platform/types/site.go @@ -15,7 +15,7 @@ type Site struct { Notes string `db:"notes" json:"notes"` OrganizationID int32 `db:"organization_id" json:"organization_id"` Owner Contact `db:"owner" json:"owner"` - ParcelID *int32 `db:"parcel_id" json:"parcel_id"` + Parcel *Parcel `db:"parcel" json:"parcel"` Resident *Contact `db:"resident" json:"resident"` ResidentOwned *bool `db:"resident_owned" json:"resident_owned"` Tags map[string]string `db:"tags" json:"tags"` diff --git a/ts/components/ReviewSiteColumnDetail.vue b/ts/components/ReviewSiteColumnDetail.vue index 6d01d146..53219b17 100644 --- a/ts/components/ReviewSiteColumnDetail.vue +++ b/ts/components/ReviewSiteColumnDetail.vue @@ -12,6 +12,28 @@ }