cityofaustin / joplin

CMS for austin.gov

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Service / Contact Model

ifsimicoded opened this issue · comments

commented

Each Service Model should have a Contacts property containing an array of Contact Models.

Contact Model should have

  1. name/business/dept
  2. email
  3. phone,
  4. address (street, city, state, country)
  5. hours for each day of the week

I feel like the contact & location data should be separate. Here's the current data returned from #29. Does this seem alright?

{
  "locations": [
    {
      "id": 1,
      "meta": {
        "type": "base.ServicePageLocation"
      },
      "location": {
        "id": 1,
        "meta": {
          "type": "base.Location"
        },
        "name": "Austin Recycle and Reuse Drop-off Center",
        "street": "2514 Business Center Dr",
        "city": "Austin",
        "state": "TX",
        "country": "United States",
        "zip": "78744",
        "hours": [
          {
            "id": 1,
            "meta": {
              "type": "base.LocationDayAndDuration"
            },
            "day_of_week": "Monday",
            "start_time": "08:00:00",
            "end_time": "16:00:00"
          }
        ]
      }
    }
  ],
  "contacts": [
    {
      "id": 1,
      "meta": {
        "type": "base.ServicePageContact"
      },
      "contact": {
        "id": 1,
        "meta": {
          "type": "base.Contact"
        },
        "name": "Francine Hammerschmidt",
        "email": "fran@gmail.com",
        "phone": "5553941212"
      }
    }
  ]
}
commented

My thought process was physical locations could have distinct email/phone contacts. For example, a resident may want to go to an Austin Resource Recovery free class at Treehouse and may have questions about that program. The phone/email for Treehouse events and services would be different from the the phone number and email for the Austin Resource Recovery main building where residents go to dump large recycling items.
That said, I think the only required field would be name. So a location wouldn't be required to have a phone and email or a phone and email wouldn't be required to have an affiliated address. But if there was an affiliation, it would be obvious.
Open to thoughts.

This should be set now, let me know if there's anything else to change

Query

{
  default: servicePage(slug: "dropoff") {
    id
    title
    contacts {
      edges {
        node {
          contact {
            name
            email
            phone
            location {
              id
              name
              street
              city
              state
              zip
              country
            }
            hours {
              edges {
                node {
                  dayOfWeek
                  startTime
                  endTime
                }
              }
            }
          }
        }
      }
    }
  }
}

Result

{
  "data": {
    "default": {
      "contacts": {
        "edges": [
          {
            "node": {
              "contact": {
                "email": "fran@gmail.com",
                "hours": {
                  "edges": [
                    {
                      "node": {
                        "dayOfWeek": "MONDAY",
                        "endTime": "18:00:00",
                        "startTime": "10:00:00"
                      }
                    }
                  ]
                },
                "location": {
                  "city": "Austin",
                  "country": "UNITED_STATES",
                  "id": "TG9jYXRpb25Ob2RlOjE=",
                  "name": "Austin Recycle and Reuse Drop-off Center",
                  "state": "TX",
                  "street": "2514 Business Center Dr",
                  "zip": "78744"
                },
                "name": "Francine Hammerschmidt",
                "phone": "5553941212"
              }
            }
          }
        ]
      },
      "id": "U2VydmljZVBhZ2VOb2RlOjU=",
      "title": "Pick Up Free Household Items from the ReUse Store"
    }
  }
}