13 points · by jotto · 18y ago · 5 comments
Ideally the user could authenticate with Facebook and utilize features that exist due to facebook's network, but what about users who dont want to be on the facebook network, but do want to be on the app's network? Meaning they login to the app and make friends, see people nearby geographically, etc...
CREATE TABLE User (
id serial PRIMARY KEY,
full_name varchar(100) NOT NULL DEFAULT 'Anonynous Coward',
...
);
CREATE TABLE FacebookUser (
fb_id int UNIQUE NOT NULL
) INHERITS (User);
CREATE TABLE AppUser (
uid int UNIQUE NOT NULL
) INHERITS (User);
CREATE TABLE Friend (
uid integer REFERENCES User (id),
friends_with integer REFERENCES User (id)
);
If you are able to pull the user data, you pull the list of friends and add to your table. The part where you use session information to check which user is accessing your web app is left as an exercise to the reader.