summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index c745816..8d6eef8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,15 +4,15 @@ extern crate fern;
extern crate log;
extern crate clap;
+use chrono::Utc;
use clap::App;
use clap::Arg;
use clap::SubCommand;
use diesel::connection::Connection;
use diesel::pg::PgConnection;
+use pjournal::db;
use pjournal::importer;
use pjournal::models;
-use pjournal::db;
-use chrono::Utc;
use serde_json::to_value;
fn setup_logger() -> Result<(), fern::InitError> {
@@ -119,8 +119,7 @@ fn main() {
.arg(Arg::with_name("PASSWORD").required(true).index(2)),
)
.subcommand(
- SubCommand::with_name("process_all_data")
- .about("create a ProcessAllRawData task")
+ SubCommand::with_name("process_all_data").about("create a ProcessAllRawData task"),
)
.get_matches();
@@ -152,12 +151,15 @@ fn main() {
} else if let Some(_matches) = matches.subcommand_matches("process_all_data") {
let command = importer::Command::ProcessAllRawData;
db::insert_task(
- &conn, &models::NewTask {
+ &conn,
+ &models::NewTask {
start_at: Utc::now(),
state: models::TaskState::NEW,
username: "system",
payload: &to_value(command).unwrap(),
- }).expect("insert");
+ },
+ )
+ .expect("insert");
} else {
info!("Start server");
pjournal::server::start(conn, db_url, base_url);