Changed import scheme #75
			
				
			
		
		
		
	| 
						 | 
					@ -83,7 +83,7 @@ pipeline:
 | 
				
			||||||
        root: build-cache/
 | 
					        root: build-cache/
 | 
				
			||||||
        flush: true
 | 
					        flush: true
 | 
				
			||||||
        # Delete cache older than 30 days (might lower this)
 | 
					        # Delete cache older than 30 days (might lower this)
 | 
				
			||||||
        flush_age: 30
 | 
					        flush_age: 14
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        secrets: [ cache_s3_access_key, cache_s3_secret_key ]
 | 
					        secrets: [ cache_s3_access_key, cache_s3_secret_key ]
 | 
				
			||||||
        # Push the cache, even on failure
 | 
					        # Push the cache, even on failure
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,11 +1,8 @@
 | 
				
			||||||
use crate::errors::FejError;
 | 
					use crate::errors::FejError;
 | 
				
			||||||
use chrono::{DateTime, NaiveDate, TimeZone};
 | 
					use chrono::{DateTime, NaiveDate, TimeZone};
 | 
				
			||||||
use chrono_tz::Europe::Brussels;
 | 
					use chrono_tz::{Europe::Brussels, Tz};
 | 
				
			||||||
use chrono_tz::Tz;
 | 
					use rocket::{http::RawStr, request::FromFormValue};
 | 
				
			||||||
use rocket::http::RawStr;
 | 
					use serde::{ser::Serializer, Serialize};
 | 
				
			||||||
use rocket::request::FromFormValue;
 | 
					 | 
				
			||||||
use serde::ser::Serializer;
 | 
					 | 
				
			||||||
use serde::Serialize;
 | 
					 | 
				
			||||||
use std::convert::TryFrom;
 | 
					use std::convert::TryFrom;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// This class is a simple wrapper around chrono's DateTime. Its sole purpose
 | 
					/// This class is a simple wrapper around chrono's DateTime. Its sole purpose
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,6 @@
 | 
				
			||||||
use super::Street;
 | 
					use super::Street;
 | 
				
			||||||
use crate::errors::FejError;
 | 
					use crate::{errors::FejError, schema::ivago_streets::dsl::*};
 | 
				
			||||||
use crate::schema::ivago_streets::dsl::*;
 | 
					use {diesel::prelude::*, PgConnection};
 | 
				
			||||||
use diesel::prelude::*;
 | 
					 | 
				
			||||||
use diesel::PgConnection;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn search_streets(db_con: &PgConnection, search_term: &str) -> Result<Vec<Street>, FejError> {
 | 
					pub fn search_streets(db_con: &PgConnection, search_term: &str) -> Result<Vec<Street>, FejError> {
 | 
				
			||||||
    Ok(ivago_streets
 | 
					    Ok(ivago_streets
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,10 @@ use crate::errors::FejError;
 | 
				
			||||||
use chrono::DateTime;
 | 
					use chrono::DateTime;
 | 
				
			||||||
use chrono_tz::Tz;
 | 
					use chrono_tz::Tz;
 | 
				
			||||||
use reqwest::blocking as reqwest;
 | 
					use reqwest::blocking as reqwest;
 | 
				
			||||||
use std::collections::HashMap;
 | 
					use std::{
 | 
				
			||||||
use std::convert::{From, TryFrom};
 | 
					    collections::HashMap,
 | 
				
			||||||
 | 
					    convert::{From, TryFrom},
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mod basic_date;
 | 
					mod basic_date;
 | 
				
			||||||
pub mod db;
 | 
					pub mod db;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,7 @@
 | 
				
			||||||
use crate::schema::ivago_streets;
 | 
					use crate::schema::ivago_streets;
 | 
				
			||||||
use diesel::{Insertable, Queryable};
 | 
					use diesel::{Insertable, Queryable};
 | 
				
			||||||
use regex::Regex;
 | 
					use regex::Regex;
 | 
				
			||||||
use rocket::http::RawStr;
 | 
					use rocket::{http::RawStr, request::FromFormValue};
 | 
				
			||||||
use rocket::request::FromFormValue;
 | 
					 | 
				
			||||||
use serde::ser::{Serialize, SerializeStruct, Serializer};
 | 
					use serde::ser::{Serialize, SerializeStruct, Serializer};
 | 
				
			||||||
use std::convert::TryFrom;
 | 
					use std::convert::TryFrom;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,5 @@
 | 
				
			||||||
use diesel::{insert_into, Connection, PgConnection, RunQueryDsl};
 | 
					use diesel::{insert_into, Connection, PgConnection, RunQueryDsl};
 | 
				
			||||||
use fej::ivago::search_streets;
 | 
					use fej::{ivago::search_streets, schema::ivago_streets::dsl::*};
 | 
				
			||||||
use fej::schema::ivago_streets::dsl::*;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ABC: &str = "abcdefghijklmnopqrstuvwxyz";
 | 
					const ABC: &str = "abcdefghijklmnopqrstuvwxyz";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,10 +15,11 @@ mod routes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Very temporary solution for CORS
 | 
					// Very temporary solution for CORS
 | 
				
			||||||
// https://stackoverflow.com/questions/62412361/how-to-set-up-cors-or-options-for-rocket-rs
 | 
					// https://stackoverflow.com/questions/62412361/how-to-set-up-cors-or-options-for-rocket-rs
 | 
				
			||||||
use rocket::fairing::AdHoc;
 | 
					use rocket::{
 | 
				
			||||||
use rocket::fairing::{Fairing, Info, Kind};
 | 
					    fairing::{AdHoc, Fairing, Info, Kind},
 | 
				
			||||||
use rocket::http::Header;
 | 
					    http::Header,
 | 
				
			||||||
use rocket::{Request, Response, Rocket};
 | 
					    Request, Response, Rocket,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
use rocket_contrib::databases::diesel;
 | 
					use rocket_contrib::databases::diesel;
 | 
				
			||||||
#[cfg(feature = "frontend")]
 | 
					#[cfg(feature = "frontend")]
 | 
				
			||||||
use rocket_contrib::serve::StaticFiles;
 | 
					use rocket_contrib::serve::StaticFiles;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,5 @@
 | 
				
			||||||
use crate::FejDbConn;
 | 
					use crate::FejDbConn;
 | 
				
			||||||
use fej::ivago::db::search_streets;
 | 
					use fej::ivago::{db::search_streets, get_pickup_times, BasicDate, PickupTime, Street};
 | 
				
			||||||
use fej::ivago::{get_pickup_times, BasicDate, PickupTime, Street};
 | 
					 | 
				
			||||||
use rocket::http::Status;
 | 
					use rocket::http::Status;
 | 
				
			||||||
use rocket_contrib::json::Json;
 | 
					use rocket_contrib::json::Json;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,5 @@
 | 
				
			||||||
/// In here, any non-unit tests are placed.
 | 
					/// In here, any non-unit tests are placed.
 | 
				
			||||||
use rocket::http::Status;
 | 
					use rocket::{http::Status, local::Client};
 | 
				
			||||||
use rocket::local::Client;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn rocket() -> rocket::Rocket {
 | 
					fn rocket() -> rocket::Rocket {
 | 
				
			||||||
    rocket::ignite().mount("/", super::routes::ivago())
 | 
					    rocket::ignite().mount("/", super::routes::ivago())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue