-- LEGISLATORS

-- @app.route('/congress/legislator/<state_code> methods=['GET'])
select fname, lname, party, 
       (strftime("%d",birthday) || '-' || strftime("%m",birthday) || '-' || strftime("%Y",birthday)) birthday, 
       url, twitter, facebook, youtube
from SENATOR
where state = ''' + "'" + state_code + "'" + '''
order by lname, fname

select fname, lname, party, 
       (strftime("%d",birthday) || '-' || strftime("%m",birthday) || '-' || strftime("%Y",birthday)) birthday, 
       url, twitter, facebook, youtube, district
from HREP
where state = ''' + "'" + state_code + "'" + '''
order by district


-- SENATORS

-- @app.route('/congress/senator/<state_code> methods=['GET'])
select fname, lname, party, 
       (strftime("%d",birthday) || '-' || strftime("%m",birthday) || '-' || strftime("%Y",birthday)) birthday, 
       url, twitter, facebook, youtube
from SENATOR
where state = ''' + "'" + state_code + "'" + '''
order by lname, fname

-- @app.route('/congress/senator/party/<party> methods=['GET'])
select state, fname, lname, 
       (strftime("%d",birthday) || '-' || strftime("%m",birthday) || '-' || strftime("%Y",birthday)) birthday, 
       url, twitter, facebook, youtube
from SENATOR
where party = ''' + "'" + party + "'" + '''
order by state

-- HREPS

-- @app.route('/congress/hrep/<state_code> methods=['GET'])
select fname, lname, party, 
       (strftime("%d",birthday) || '-' || strftime("%m",birthday) || '-' || strftime("%Y",birthday)) birthday, url, twitter, facebook, youtube, district
from HREP
where state = ''' + "'" + state_code + "'" + '''
order by district

-- @app.route('/congress/hrep/party/<party> methods=['GET'])
select state, fname, lname, 
       (strftime("%d",birthday) || '-' || strftime("%m",birthday) || '-' || strftime("%Y",birthday)) birthday, 
       url, twitter, facebook, youtube, district
from HREP
where party = ''' + "'" + party + "'" + '''
order by state