Compare commits

..

No commits in common. "faa4f713c86cd82647c4e0ec92c0b7f03b205ba5" and "9dbb4c8804f31b5a557661ec5df0ae2a94463b62" have entirely different histories.

4 changed files with 16 additions and 17 deletions

View File

@ -30,13 +30,6 @@ pipeline:
- cargo build - cargo build
# =====TESTING=====
test-backend:
image: chewingbever/fej-builder:latest
commands:
- cargo test
# =====LINTING===== # =====LINTING=====
lint-frontend: lint-frontend:
image: node:15-alpine3.13 image: node:15-alpine3.13
@ -52,6 +45,13 @@ pipeline:
- cargo fmt -- --check - cargo fmt -- --check
# This is run here because it requires compilation # This is run here because it requires compilation
- cargo clippy -- -D warnings - cargo clippy -- -D warnings
# =====TESTING=====
test-backend:
image: chewingbever/fej-builder:latest
commands:
- cargo test
# =====REBUILD & FLUSH CACHE===== # =====REBUILD & FLUSH CACHE=====

View File

@ -16,7 +16,10 @@ impl PickupTime {
/// * `date` - Date of pickup time /// * `date` - Date of pickup time
/// * `label` - Type of trash /// * `label` - Type of trash
pub fn new(date: BasicDate, label: String) -> PickupTime { pub fn new(date: BasicDate, label: String) -> PickupTime {
PickupTime { date, label } PickupTime {
date: date,
label: label,
}
} }
} }

View File

@ -8,15 +8,12 @@ fn main() {
let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set"); let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let db_conn = PgConnection::establish(&database_url) let db_conn = PgConnection::establish(&database_url)
.unwrap_or_else(|_| panic!("Error connecting to {}", database_url)); .expect(&format!("Error connecting to {}", database_url));
// Doing this linearly is good enough I'd say // Doing this linearly is good enough I'd say
for c in ABC.chars() { for c in ABC.chars() {
if let Ok(streets) = search_streets(&c.to_string()) { if let Ok(streets) = search_streets(&c.to_string()) {
insert_into(ivago_streets) insert_into(ivago_streets).values(streets).execute(&db_conn);
.values(streets)
.execute(&db_conn)
.expect("Failed to insert rows.");
} }
} }
} }

View File

@ -23,9 +23,9 @@ use rocket_contrib::databases::diesel;
#[cfg(feature = "frontend")] #[cfg(feature = "frontend")]
use rocket_contrib::serve::StaticFiles; use rocket_contrib::serve::StaticFiles;
pub struct Cors; pub struct CORS;
impl Fairing for Cors { impl Fairing for CORS {
fn info(&self) -> Info { fn info(&self) -> Info {
Info { Info {
name: "Add CORS headers to responses", name: "Add CORS headers to responses",
@ -63,9 +63,8 @@ fn run_db_migrations(rocket: Rocket) -> Result<Rocket, Rocket> {
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
// This needs to be muted for the frontend feature // This needs to be muted for the frontend feature
#[allow(unused_mut)]
let mut rocket = rocket::ignite() let mut rocket = rocket::ignite()
.attach(Cors) .attach(CORS)
.attach(FejDbConn::fairing()) .attach(FejDbConn::fairing())
.attach(AdHoc::on_attach("Database Migrations", run_db_migrations)) .attach(AdHoc::on_attach("Database Migrations", run_db_migrations))
.mount("/api/ivago", routes::ivago()) // /api being hardcoded is temporary .mount("/api/ivago", routes::ivago()) // /api being hardcoded is temporary