Skip to content
Permalink
Browse files

Delete old api endpoints

  • Loading branch information...
rogeriochaves committed May 24, 2018
1 parent 7aa6db4 commit 77e177c40645139a5663ccb61fc7360f633bd338
Showing with 7 additions and 26 deletions.
  1. +7 −0 api/CONTRIBUTING.md
  2. +0 −26 api/src/data/vote.rs
@@ -64,6 +64,13 @@ npm install
cd -
```

Create and migrate the database:

```
export DATABASE_URL="postgres://postgres:password@localhost:5432/fakenews"
diesel database setup
```

Then start the app:

```
@@ -81,8 +81,6 @@ struct PeopleVotes {
#[derive(Serialize, Deserialize)]
pub struct AllVotes {
domain: Option<VerifiedVote>,
content: ContentVotes,
title: TitleVotes,
robot: RobinhoPredictions,
people: PeopleVotes,
keywords: Vec<String>,
@@ -185,35 +183,11 @@ pub fn get_all_votes(
let robinho_response = get_robinho_prediction(&title, &content_, &url);
let robinho_votes = robinho_response.predictions;
let keywords = robinho_response.keywords;
let people_content_votes = get_people_votes(&url, &*conn)?;
let people_content_votes_clone = get_people_votes(&url, &*conn)?;
let people_clickbait_votes = get_people_clickbait_votes(&url, &*conn)?;
let people_clickbait_votes_clone = get_people_clickbait_votes(&url, &*conn)?;

let robinho_votes_to_vec = vec![
RobotContentVote {
category_id: 2,
chance: robinho_votes.fake_news,
},
RobotContentVote {
category_id: 4,
chance: robinho_votes.extremely_biased,
},
];

Ok(AllVotes {
domain: domain,
content: ContentVotes {
robot: robinho_votes_to_vec,
people: people_content_votes,
},
title: TitleVotes {
robot: RobotTitleVote {
clickbait: robinho_votes.clickbait > 0.5,
chance: robinho_votes.clickbait,
},
people: people_clickbait_votes,
},
robot: robinho_votes,
people: PeopleVotes {
content: people_content_votes_clone,

0 comments on commit 77e177c

Please sign in to comment.
You can’t perform that action at this time.