Skip to content

Sample State

Travis N edited this page Jun 5, 2018 · 14 revisions

Sample State

{
  entities: {
    users: {
      1: {
        id: 1,
        firstName: 'Travis',
        lastName: 'Nguyen',
        username: 'travishn',
        zipcode: 92130,
        imgUrl: "./images/travishn.png",
        listingBookingIds: [8]
      },
      2: {
        id: 2,
        firstName: 'Bob',
        lastName: 'Chillen',
        username: "hipsterdude",
        zipcode: 94704,
        imgUrl: "./images/hipsterdude.png",
        listingBookingIds: [7]
      }
    },

    listings: {
      7: {
        id: 7,
        hostId: 1,
        listing: 'Joshua Tree',
        description: 'Enjoy a night tent camping under the stars with your family and friends',
        checkIn: 'After 2PM',
        checkOut: 'Before 11AM',
        cancellationPolicy: 'Flexible',
        petsAllowed: true,
        terrain: "Mountain",
        price: 50,
        capacity: 4,
        type: "Camping",
        activityIds: [1, 2, 3, 4],
        listingPhotoIds: [1, 4, 3],
        listingReviewIds: [2, 4, 6],
        listingBookingIds: [1,3,7]
      },

      8: {
        id: 8,
        hostId: 2,
        listing: 'My Beach House',
        description: 'Off the coast of crystal cove, come chill to your hearts content in this glamorous beach house',
        checkIn: 'After 2PM',
        checkOut: 'Before 11AM',
        cancellationPolicy: 'Moderate',
        petsAllowed: false,
        terrain: "Beach",
        price: 150,
        capacity: 4,
        type: "Glamping",
        activityIds: [2, 4, 7, 8],
        listingPhotoIds: [9, 14, 17, 23, 26],
        listingReviewIds: [1, 3, 5],
        listingBookingIds: [8, 9]
      }
    },

    // Required joins table?? Many to many relationship
    activities: {
      1: {
        id: 1,
        activity: 'Swimming'
      }
    },

    listingPhotos: {
      9: {
        id: 9,
        listingId: 2,
        imgUrl: './images/crystal_cove.png'
      }
    },

    reviews: {
      6: {
        id: 6,
        listingId: 7,
        authorId: 2,
        body: "Had an awesome time with my brothers!"
        createdAt: "12:34:56 05/30/2018"
      }
    },

      // can look at cats99 to see how to deal with booking conflicts with existing bookings
      bookings: {
        13: {
          id: 13,
          listingId: 8,
          guestId: 1,
          startDate: 06/01/2018,
          endDate: 06/03/2018,
          numGuests: 3
        }
      }
    }

  ui: {
    loading: true/false
  },
  errors: {
    login: ["Incorrect username or password"],
    createReview: ["Comment cannot be blank"],
    createBooking: ["Please select proper check-in and check-out dates"]
  },
  session: { id: 57 }
  }
}

Clone this wiki locally