Skip to content

Sample State

Hanqing Chen edited this page Aug 2, 2018 · 1 revision

Sample State

Tentative sample state for aA full stack project.


{
  entities: {
    users: {
      1: {
        id: 1,
        username: "user_1",
        profile_pic_url: "profile_pic_url_example_1"
        photos: [1, 2, 3],
        comments: [1, 4, 6],
        albums: [1, 2]
      }
      2: {
        id: 2,
        username: "user_2",
        profile_pic_url: "profile_pic_url_example_2"
        photos: [4, 5],
        comments: [2, 3, 5],
        albums: [3]
      }
    }
    photos: {
      1: {
        id: 1,
        image_url: "example_img_url_1",
        name: "photo_1",
        description: "description_1",
        owner_id: 1,
        album_id: [1, 3],
        comments: [2, 3],
        tags: [1, 3]
      }
      4: {
        id: 2,
        image_url: "example_img_url_4",
        name: "photo_4",
        description: "description_4",
        owner_id: 2,
        album_id: [1, 2],
        comments: [1],
        tags: [1, 2]
    }
    albums: {
      1: {
        id: 1,
        creator_id: 1,
        photo_id: [1, 2]
        name: "album1",
        description: "example_description"
      }
    }
    comments: {
      4: {
        id: 4,
        commentor_id: 1,
        photo_id: 3,
        name: "example_comment",
        body: "example_content",
      }
      1: {
        id: 1,
        commentor_id: 1,
        photo_id: 2,
        name: "example_comment1",
        body: "example_content1",
      }
    }
    tags: {
      1: {
        id: 1,
        user_id: 1,
        photo_id: [1, 2]
      }
    }
  }
  ui: {
    loading: true/false
  }
  errors: {
    session: ["username not found"],
    session: ["incorrect password"],
    commentForm: ["name/body cannot be blank"],
    albumForm: ["name/description cannot be blank"]
  }
}

Clone this wiki locally