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

View File

@ -16,7 +16,10 @@ impl PickupTime {
/// * `date` - Date of pickup time
/// * `label` - Type of trash
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 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
for c in ABC.chars() {
if let Ok(streets) = search_streets(&c.to_string()) {
insert_into(ivago_streets)
.values(streets)
.execute(&db_conn)
.expect("Failed to insert rows.");
insert_into(ivago_streets).values(streets).execute(&db_conn);
}
}
}

View File

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