Reformat code
This commit is contained in:
parent
271b24b70d
commit
a17a9868fa
8 changed files with 40 additions and 33 deletions
|
@ -1,4 +1,3 @@
|
||||||
use crate::db::models::Periods;
|
|
||||||
use chrono::{NaiveTime, Timelike};
|
use chrono::{NaiveTime, Timelike};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::database::HasArguments;
|
use sqlx::database::HasArguments;
|
||||||
|
@ -7,6 +6,8 @@ use sqlx::error::BoxDynError;
|
||||||
use sqlx::sqlite::{SqliteTypeInfo, SqliteValueRef};
|
use sqlx::sqlite::{SqliteTypeInfo, SqliteValueRef};
|
||||||
use sqlx::{Decode, Encode, Sqlite, Type};
|
use sqlx::{Decode, Encode, Sqlite, Type};
|
||||||
|
|
||||||
|
use crate::db::models::Periods;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||||
pub struct Period {
|
pub struct Period {
|
||||||
#[serde(with = "period_format")]
|
#[serde(with = "period_format")]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::db::model_utils::Period;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::db::model_utils::Period;
|
||||||
use crate::types::EmgauwaUid;
|
use crate::types::EmgauwaUid;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use crate::db::errors::DatabaseError;
|
use std::ops::DerefMut;
|
||||||
use crate::db::models::*;
|
|
||||||
use sqlx::pool::PoolConnection;
|
use sqlx::pool::PoolConnection;
|
||||||
use sqlx::Sqlite;
|
use sqlx::Sqlite;
|
||||||
use std::ops::DerefMut;
|
|
||||||
|
use crate::db::errors::DatabaseError;
|
||||||
|
use crate::db::models::*;
|
||||||
|
|
||||||
pub async fn create_tag(
|
pub async fn create_tag(
|
||||||
conn: &mut PoolConnection<Sqlite>,
|
conn: &mut PoolConnection<Sqlite>,
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
use crate::db::errors::DatabaseError;
|
use std::borrow::Borrow;
|
||||||
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
use actix_web::{delete, get, post, put, web, HttpResponse, Responder};
|
use actix_web::{delete, get, post, put, web, HttpResponse, Responder};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::pool::PoolConnection;
|
use sqlx::pool::PoolConnection;
|
||||||
use sqlx::{Pool, Sqlite};
|
use sqlx::{Pool, Sqlite};
|
||||||
use std::borrow::Borrow;
|
|
||||||
use std::convert::TryFrom;
|
|
||||||
|
|
||||||
|
use crate::db::errors::DatabaseError;
|
||||||
use crate::db::models::{Periods, Schedule};
|
use crate::db::models::{Periods, Schedule};
|
||||||
use crate::db::schedules::*;
|
use crate::db::schedules::*;
|
||||||
use crate::db::tag::get_tag;
|
use crate::db::tag::get_tag;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
extern crate dotenv;
|
extern crate dotenv;
|
||||||
|
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
use actix_web::middleware::TrailingSlash;
|
use actix_web::middleware::TrailingSlash;
|
||||||
use actix_web::{middleware, web, App, HttpServer};
|
use actix_web::{middleware, web, App, HttpServer};
|
||||||
use log::{trace, LevelFilter};
|
use log::{trace, LevelFilter};
|
||||||
use simple_logger::SimpleLogger;
|
use simple_logger::SimpleLogger;
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
mod db;
|
mod db;
|
||||||
mod handlers;
|
mod handlers;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
use std::sync::RwLock;
|
||||||
|
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use serde_derive::Deserialize;
|
use serde_derive::Deserialize;
|
||||||
use std::sync::RwLock;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize)]
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
|
|
@ -2,7 +2,6 @@ use std::convert::TryFrom;
|
||||||
use std::fmt::{Debug, Formatter};
|
use std::fmt::{Debug, Formatter};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use crate::types::EmgauwaUid;
|
|
||||||
use serde::{Serialize, Serializer};
|
use serde::{Serialize, Serializer};
|
||||||
use sqlx::database::HasArguments;
|
use sqlx::database::HasArguments;
|
||||||
use sqlx::encode::IsNull;
|
use sqlx::encode::IsNull;
|
||||||
|
@ -11,6 +10,8 @@ use sqlx::sqlite::{SqliteTypeInfo, SqliteValueRef};
|
||||||
use sqlx::{Decode, Encode, Sqlite, Type};
|
use sqlx::{Decode, Encode, Sqlite, Type};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::types::EmgauwaUid;
|
||||||
|
|
||||||
impl EmgauwaUid {
|
impl EmgauwaUid {
|
||||||
const OFF_STR: &'static str = "off";
|
const OFF_STR: &'static str = "off";
|
||||||
const ON_STR: &'static str = "on";
|
const ON_STR: &'static str = "on";
|
||||||
|
|
Loading…
Reference in a new issue