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