Skip to content

Instantly share code, notes, and snippets.

@etgrieco
Last active October 22, 2017 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etgrieco/cb902145edaeebc0e91277de1950acc0 to your computer and use it in GitHub Desktop.
Save etgrieco/cb902145edaeebc0e91277de1950acc0 to your computer and use it in GitHub Desktop.
key type note
id integer pk, not null
email string not null, unique, indexed
first_name string not null
last_name string
img_url string not null
password_digest integer not null
session_token integer not null, unique, indexed
created_at datetime not null
updated_at datetime not null

State Shape

{
  entities: {
    stories: {
      1: {
        id: 1,
        title: "Baking a cake",
        img_url: "story-header-gif",
        author: "Lenny Knowsitall",
        description: "Many people say that baking a cake is hard, but...",
        summary: "This is a summary",
        link: "http://thebakingmaster.com/story/baking-a-cake.html",
        feed_id: 14,
        current_user_favorites: true,
        current_user_read: false
      },
      13: {
        id: 13,
        title: "Jailbreak your iPhone"
        img_url: "story-header-jpeg",
        author: "Lara Croft",
        description: "This is how you can jailbreak your iPhone",
        summary: "This is a summary",
        link: "http://everydayhacking.com/jailbreak-iphone.html",
        feed_id: 3,
        current_user_favorites: false,
        current_user_read: false
      }
    },
    feeds: {
      3: {
        id: 3,
        title: "Everyday Hacking",
        favicon_url: "favicons/31342.jpg",
        link_url: "http://everydayhacking.com",
        unread_count: 8,
        stories: [13],
        description: "This is a description of the feed"
      },
      14: {
        id: 14,
        title: "The Baking Master",
        favicon_url: "favicons/12354.jpg",
        link_url: "http://thebakingmaster.com",
        unread_count: 21,
        stories [3],
        description: "This is a description of the feed"
      }
    },
    collections: {
      1: {
        id: 1,
        title: "Cooking",
        feed_ids: [14, 1, 33]
      },
      2: {
        id: 2,
        title: "Technology",
        feed_ids: [3, 12, 16]
      }
    },
    // 'discoveries' purposes of searching for, browsing, and adding new feeds
    discoveries: {
      feedSearch: {
        results: [21, 34, 19, 211, 7] // feed ids
      }
      // more advanced search mechanisms, possibly for bonus features
      topics: {
        23: {
          id: 23,
          topic: "Sports",
          feeds: [117, 211, 98]
        },
        3: {
          id: 3,
          topic: "Arts",
          feeds: [91, 119, 19, 36, 51]
        },
      },
    }
    storiesSearches: {
      results: [23, 19, 191] // story ids
    }
  },
  ui: {
    loading: false,
    popOutIsOpen: true
  },
  errors: {
    login: ["Incorrect username/password combination"],
    searchForm: ["Search cannot be blank"]
  },
  session: {
    id: 42,
    username: "muhammed360",
    img_url: "imagefarm.org/photo/face-pic.png"
  },
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment