Skip to content

Sample State

Justin J. Meyer edited this page Aug 28, 2020 · 8 revisions

{

  • entities: {

    • users: {

        1: {
            id: 1,
            email: "[email protected]",
            authoredReviews: {1,2}, 
            authoredComments: {1,4}
        },
        2: {
            id: 2,
            email: "[email protected]",
            authoredReviews: {3}, 
            authoredComments: {2}
        },
        3: {
            id: 3,
            email: "[email protected]",
            authoredReviews: {},
            authoredComments: {3,7}
        },
        4: {
            id: 4,
            email: "[email protected]",
            authoredReviews: {4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20} ,
            authoredComments: {5,6,8,9}
        },
      

      },

    • businesses: {

        1: {
            id: 1,
            name: "Filona's Fanciful Foods",
            address: "123 Fake St",
            type: 1,
            lat: 445.028428,
            long: 983.9850249,
            phoneNumber: "718-123-4567",
            website: "www.fifafoods.com",
            attributeList: 1,
            menu: 1,
            reviewsRatings: {5,7,11,14},
            owner: 17
        },
        2: {
            id: 2,
            name: "Randery's Rambunctious Raclettery",
            address: "46 Example Rd",
            type: 1,
            lat: 545.028428,
            long: 783.9850249,
            phoneNumber: "718-098-7654",
            website: "www.rararacclettes.com",
            attributeList: 2,
            menu: 2,
            reviewsRatings: {4,7,8,13},
            owner: 32
        },
        3: {
            id: 3,
            name: "Windburg's Wonderful Wands",
            address: "4671 Somewhere Ave",
            type: 3,
            lat: 489.028428,
            long: 793.9850249,
            phoneNumber: "718-765-4321",
            website: "www.wickedwands.com",
            attributeList: 3,
            menu: null,
            reviewsRatings: {21,34,36,43},
            owner: 9
         }
      

      },

    • reviewsRatings: {

        1: {
            id: 1,
            userId: 1,
            businessId: 3,
            rating: 5,
            body: "....",
            comments: {2,3}
            }
        2: {
            id: 2,
            userId: 2,
            businessId: 2,
            rating: 4,
            body: "....",
            comments: {1}
            }
        3: {
            id: 3,
            userId: 4,
            businessId: 1,
            rating: 0.5,
            title: null,
            body: null,
            comments: {}
            }
      

      },

    • attributeLists: {

        1: {
            id: 1,
            businessId: 1,
            priceRating: 3,
            createdAt: datetime,
            updatedAt: datetime,
            hoursOfOperation: {1,2,3,4,5,6,7}
            cuisine: {1,4},
            neighborhood: 8,
            services: null,
            miscAttributes: {1,4,7}
            }
        2: {
            id: 2,
            businessId: 2,
            priceRating: 3,
            createdAt: datetime,
            updatedAt: datetime,
            hoursOfOperation: {1,8,9,4,5,10,11},
            cuisine: {5},
            neighborhood: 1,
            services: null,
            miscAttributes: {1,4,7}
            }
        3: {
            id: 3,
            businessId: 3,
            priceRating: 2,
            createdAt: datetime,
            updatedAt: datetime,
            hoursOfOperation: {1,2,9,4,5,10,7}
            cuisine: null,
            neighborhood: 4,
            services: {4,7},
            miscAttributes: {1,4,7}
            }
      

      },

    • services: {

        1: {
            id: 1,
            name: "Wand Repair",
            }
        2: {
            id: 2,
            name: "Dragon Cleaning",
            }
        3: {
            id: 3,
            name: "Broom Maintenance",
            }
      

      },

    • neighborhoods: {

        1: {
            id: 1,
            name: "Williamsburg",
            }
        2: {
            id: 2,
            name: "East Village",
            }
        3: {
            id: 3,
            name: "Hell's Kitchen",
            }
      

      },

    • hoursOfOperation: {

        1: {
            id: 1,
            day: "Mon"
            open: 8:00, 
            close: 22:00
            }
        2: {
            id: 2, 
            day: "Tues:"
            open: 9:00, 
            close: 22:00
            }
        3: {
            id: 3,
            day: "Wed"
            open: 10:00, 
            close: 22:00 
      

      },

    • cuisine: {

        1: {
            id: 1,
            name: "American",
            }
        2: {
            id: 2,
            name: "Brunch",
            }
        3: {
            id: 3,
            name: "French",
            }
      

      },

    • miscAttributes: {

        1: {
            id: 1,
            name: "Open late",
            }
        2: {
            id: 2,
            name: "Good for groups",
            }
        3: {
            id: 3,
            name: "Full bar",
            }
      

      },

    • menus: {

        1: {
            id: 1,
            businessId: 1,
            menuItems: {1,2,3,4,5,6,7,8,9,10,11,12},
            }
        2: {
            id: 2,
            businessId: 2,
            menuItems: {13,14,15,16,17,18,19,20},
            }
      

      },

    • menuItems: {

        1: {
            id: 1,
            menuId: 1,
            title: 1,
            price: 10,
            description: 1
            }
        2: {
            id: 2,
            menuId: 1,
            title: 1,
            price: 12.50,
            description: 1
            }
        3: {
            id: 3,
            menuId: 1,
            title: 1,
            price: 16,
            description: 1
            }
      

      },

    • comments: {

        1: {
            id: 1,
            userId: 1,
            business_id: 3,
            ratingReviewId: 2,
            parentId: null,
            body: "....",
            created_at: datetime,
            updated_at: datetime,
            children: {7,13}
            }
        2: {
            id: 2,
            userId: 2,
            businessId: 1,
            ratingReviewId: 1,
            parentId: null,
            body: "....",
            created_at: datetime,
            updated_at: datetime,
            children: {5}
            }
        3: {
            id: 3,
            userId: 3,
            businessId: 3,
            ratingReviewId: 2,
            parentId: 1,
            body: "....",
            created_at: datetime,
            updated_at: datetime,
            children: {}
            }
      

      }

    }

  • ui: {

    • search / filter: object / hash containing instances of attributes
    • map: utilizes a library / gem / node }
  • errors: {

    • sign-in: ["Invalid username/password"],
    • sign-up: ["Password must be at least 6 characters"],
    • sign-up: ["Username already taken"],
    • sign-up: ["There is already an account associated wit this email"],
    • sign-up: ["Businesses must have a #{ missing item(s) }"],
    • posting a review / rating: ["Must include rating"],
    • creating a menu item: ["Items must have a #{ title / price }"],
    • creating hours of operation: ["Must include #{ day / opening time / closing time }"],
    • selecting attributes: ["Attribute must include #{ missing item(s) }"]

    }

  • session: {

    • currentUserId: 14 }

}

Clone this wiki locally