Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 31 additions & 50 deletions crapmap_fb_db
Original file line number Diff line number Diff line change
@@ -1,83 +1,64 @@

CREATE TABLE Pledges
(
pledge_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT,
pledge_text varchar(160),
pledge_create_timestamp timestamp,
id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT,
pledgetext varchar(160),
created timestamp
);

CREATE TABLE FacebookUsers
(
fb_id int(50) unsigned NOT NULL PRIMARY KEY AUTOINCREMENT,
fb_id int(50) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
firstname varchar(30) NOT NULL,
lastname varchar(30),
user_create_timestamp timestamp,
created timestamp
);

CREATE TABLE Location
(
location_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT,
location_latitude decimal(7,5),
location_longitude decimal(8,5),
location_description varchar(1000),
location_name varchar(50),
location_create_timestamp timestamp,
id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT,
latitude decimal(7,5),
longitude decimal(8,5),
description varchar(1000),
name varchar(50),
created timestamp
);

CREATE TABLE PhoneNumbers
CREATE TABLE PhoneUsers
(
phone_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT,
phone_number varchar(20),
phone_number_create_timestamp timestamp,
id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT,
phonenumber varchar(20),
created timestamp
);

CREATE TABLE CrapHistory
(
crap_history_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT,
crap_quantity_count int(1000),
crap_sighting_count int(1000),
location_id int(50),
phone_id int(50),
fb_id int(50),
crap_history_create_timestamp timestamp,
id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT,
quantity int,
sighting tinyint,
location_id int,
phoneuser_id int,
facebookuser_id int,
created timestamp
);

CREATE TABLE PledgeLocations
(
pledge_locations_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT,
location_id int(50),
pledge_1 varchar(160),
pledge_2 varchar(160),
pledge_3 varchar(160),
pledge_locations_create_timestamp timestamp,
id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT,
location_id int,
pledge1 int,
pledge2 int,
pledge3 int,
created timestamp
);

CREATE TABLE UserPledges
(
user_pledges_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT,
id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT,
user_id int(50),
location_id int(50),
pledge_id int(50),
phone_id int(20),
user_pledges_create_timestamp timestamp,
phonenumber_id int(20),
created timestamp
);


==================================

JSON API

GET: from SMS app:

request: /location/<hashtag>
response:
success: crap sighting_count - see crap history table
failure: null

POST: from SMS app:

request: /location/<hashtag>
phone_number - set in PhoneNumbers table