Skip to content

Sample State

Chris Kim edited this page Sep 18, 2017 · 5 revisions
{
  entities: {
    lodgings: {
      1: {
        id: 1,
        name: "Latitude 38",
        address: "1080 Folsom, San Francisco, 94103, United States",
        rate: 200,
        room_type: "shared",
        image_url: "latitude.com"
        about: "Small but quaint place to live in.",
        guests: 1,
        bedrooms: 1,
        beds: 1,
        bathrooms: 1,
        check_in: "Anytime after 6PM",
        amenities: ["Internet", "Kitchen", "TV", "Essentials"],
        review_ids: [1, 3],
        owner_id: 1, // Might not need
        owner: {
          id: 1,
          name: "Chris Kim",
          image_url: "chrisisawesome.com"
        }
      },
      2: {
        id: 2,
        address: "10 Redhill Circle, Tiburon, 94920, United States",
        rate: 100,
        room_type: "private",
        image_url: "redhillcircle.com"
      },
      3: {
        id: 3,
        address: "431 Tehama St, San Francisco 94103, United States",
        rate: 22000,
        room_type: "shared",
        image_url: "tehama.com"
      }
      // , ...
    },
    reviews: {
      1: {
        id: 1,
        title: "Worst place ever!",
        body: "Please do not go here. Place is in a dangerous neighborhood!",
        lodging_id: 1, // Might not need
        author_id: 2, // Might not need
        author: {
          id: 2,
          name: "Foo",
          image_url: "foo.com"
        }
      },
      3: {
        id: 3,
        title: "I disagree!",
        body: "This place is safer than where I'm from!",
        lodging_id: 1, // Might not need
        author_id: 3, // Might not need
        author: {
          id: 3,
          name: "Bar",
          image_url: "bar.com"
        }
      }
    },
    bookings: {
      5: {
        id: 5,
        start_date: "2017-09-17",
        end_state: "2017-09-20",
        booker_id: 1,
        lodging_id: 2,
        lodging: {
          address: "10 Redhill Circle, Tiburon, 94920, United States",
          rate: 100,
          room_type: "private",
          image_url: "redhillcircle.com"
        }
      }
    },
    viewedUser: {
      id: 2,
      name: "Foo Bar",
      image_url: "foobar@gmail.com",
      about: "This is seriously foo bar.", 
      owned_lodgings_id: [3,5]
    }
  },
  ui: {
    lodgingDisplay: 1,
    userDisplay: 2,
    loading: {
      indexLoading: true,
      lodgingShowLoading: true,
      userShowLoading: true,
    },
    errors: {
      login: ["Incorrect Credentials"],
      signup: ["Name cannot be blank"],
      newLodging: ["Room type cannot be blank"]
    },
    session: {
      currentUser: {
        id: 1,
        name: "Chris Kim",
        image_url: "chrisisawesome.com",
        about: "I am an awesome person who lives in an awesome neighborhood!",
        bookings_id = [1],
        // ^ Am I doing too much here? Maybe I can use this information in a selector to create an array of bookings.
        owned_lodgings_ids = [1]
      }
    }
  }
}

Clone this wiki locally