Fix a bunch of warnings

This commit is contained in:
Joshua Coles 2024-03-02 09:22:47 +00:00
parent 43399c28b1
commit b9b211723e
7 changed files with 16 additions and 31 deletions

View File

@ -1,5 +1,5 @@
use crate::entity::{client, project, time_entry}; use crate::entity::{client, project, time_entry};
use crate::toggl_api::types::{Project, ProjectClient, ReportEntry, TimeEntry}; use crate::toggl_api::types::{Project, ProjectClient, ReportEntry};
use sea_orm::sea_query::OnConflict; use sea_orm::sea_query::OnConflict;
use sea_orm::{NotSet, Set}; use sea_orm::{NotSet, Set};

View File

@ -1,4 +1,5 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2 //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
#![allow(unused_imports)]
pub use super::client::Entity as Client; pub use super::client::Entity as Client;
pub use super::project::Entity as Project; pub use super::project::Entity as Project;

View File

@ -1,27 +1,11 @@
use crate::toggl_api::TogglApiClient; use crate::toggl_api::TogglApiClient;
use crate::entity::prelude::TimeEntry;
use crate::entity::time_entry;
use crate::entity::time_entry::ActiveModel;
use crate::toggl_api::types::{Current, Project, ProjectClient, ReportEntry, TogglQuery};
use anyhow::anyhow;
use axum::extract::multipart::Field;
use axum::extract::{Multipart, Query};
use axum::http::StatusCode;
use axum::response::IntoResponse;
use axum::routing::{get, post}; use axum::routing::{get, post};
use axum::{Extension, Json, Router}; use axum::{Extension, Router};
use utils::{Result, shutdown_signal}; use utils::{Result, shutdown_signal};
use chrono::{NaiveDate, NaiveTime};
use clap::Parser; use clap::Parser;
use migration::{Migrator, MigratorTrait}; use migration::{Migrator, MigratorTrait};
use sea_orm::sea_query::IntoCondition;
use sea_orm::{ColumnTrait, Condition, DatabaseConnection, EntityTrait, QueryFilter};
use serde::Deserialize;
use serde_json::Value;
use std::collections::HashMap;
use std::net::SocketAddr; use std::net::SocketAddr;
use tower_http::trace::TraceLayer; use tower_http::trace::TraceLayer;
use tracing::{debug, instrument};
mod db; mod db;
mod entity; mod entity;

View File

@ -1,5 +1,5 @@
use crate::toggl_api::TogglApiClient; use crate::toggl_api::TogglApiClient;
use crate::entity::{client, project, time_entry}; use crate::entity::{client, project};
use crate::toggl_api::types::{Project, ProjectClient, TogglQuery}; use crate::toggl_api::types::{Project, ProjectClient, TogglQuery};
use sea_orm::{DatabaseConnection, EntityTrait, QuerySelect}; use sea_orm::{DatabaseConnection, EntityTrait, QuerySelect};
use tracing::instrument; use tracing::instrument;

View File

@ -7,10 +7,10 @@ use axum::http::StatusCode;
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter}; use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter};
use anyhow::anyhow; use anyhow::anyhow;
use axum::extract::{Multipart, Query}; use axum::extract::{Multipart, Query};
use migration::{Condition, IntoCondition}; use migration::{Condition};
use chrono::{NaiveDate, NaiveTime}; use chrono::{NaiveDate};
use serde::Deserialize; use serde::Deserialize;
use crate::entity::time_entry::{ActiveModel, Entity as TimeEntry}; use crate::entity::time_entry::{Entity as TimeEntry};
use crate::toggl_api::TogglApiClient; use crate::toggl_api::TogglApiClient;
use crate::toggl_api::types::{Current, Project, ProjectClient, ReportEntry, TogglQuery}; use crate::toggl_api::types::{Current, Project, ProjectClient, ReportEntry, TogglQuery};
use crate::{entity, utils}; use crate::{entity, utils};
@ -146,7 +146,7 @@ pub async fn import_csv(
} }
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Deserialize)]
struct RefreshQuery { pub struct RefreshQuery {
start_date: Option<String>, start_date: Option<String>,
} }

View File

@ -5,7 +5,6 @@ use std::time::Duration;
use base64::Engine; use base64::Engine;
use base64::engine::general_purpose::STANDARD; use base64::engine::general_purpose::STANDARD;
use hyper::HeaderMap; use hyper::HeaderMap;
use migration::cli::Cli;
use tracing::instrument; use tracing::instrument;
use tracing::log::debug; use tracing::log::debug;
use crate::toggl_api::types::{Current, Project, ProjectClient, ReportEntry, TogglQuery}; use crate::toggl_api::types::{Current, Project, ProjectClient, ReportEntry, TogglQuery};

View File

@ -79,7 +79,6 @@ pub struct ProjectClient {
pub wid: i32, pub wid: i32,
} }
#[allow(non_snake_case)]
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Serialize, Deserialize, Clone, Default)] #[derive(Serialize, Deserialize, Clone, Default)]
pub struct TogglQuery { pub struct TogglQuery {
@ -97,11 +96,13 @@ pub struct TogglQuery {
pub min_duration_seconds: Option<u64>, pub min_duration_seconds: Option<u64>,
pub order_by: Option<String>, pub order_by: Option<String>,
pub order_dir: Option<String>, pub order_dir: Option<String>,
pub postedFields: Option<Vec<String>>, #[serde(rename = "postedFields")]
pub posted_fields: Option<Vec<String>>,
pub project_ids: Option<Vec<u64>>, pub project_ids: Option<Vec<u64>>,
pub rounding: Option<u64>, pub rounding: Option<u64>,
pub rounding_minutes: Option<u64>, pub rounding_minutes: Option<u64>,
pub startTime: Option<String>, #[serde(rename = "startTime")]
pub start_time: Option<String>,
pub start_date: Option<String>, pub start_date: Option<String>,
pub tag_ids: Option<Vec<u64>>, pub tag_ids: Option<Vec<u64>>,
pub task_ids: Option<Vec<u64>>, pub task_ids: Option<Vec<u64>>,
@ -160,8 +161,8 @@ impl fmt::Debug for TogglQuery {
if let Some(order_dir) = &self.order_dir { if let Some(order_dir) = &self.order_dir {
ds.field("order_dir", order_dir); ds.field("order_dir", order_dir);
} }
if let Some(postedFields) = &self.postedFields { if let Some(posted_fields) = &self.posted_fields {
ds.field("postedFields", postedFields); ds.field("postedFields", posted_fields);
} }
if let Some(project_ids) = &self.project_ids { if let Some(project_ids) = &self.project_ids {
ds.field("project_ids", project_ids); ds.field("project_ids", project_ids);
@ -172,8 +173,8 @@ impl fmt::Debug for TogglQuery {
if let Some(rounding_minutes) = &self.rounding_minutes { if let Some(rounding_minutes) = &self.rounding_minutes {
ds.field("rounding_minutes", rounding_minutes); ds.field("rounding_minutes", rounding_minutes);
} }
if let Some(startTime) = &self.startTime { if let Some(start_time) = &self.start_time {
ds.field("startTime", startTime); ds.field("startTime", start_time);
} }
if let Some(start_date) = &self.start_date { if let Some(start_date) = &self.start_date {
ds.field("start_date", start_date); ds.field("start_date", start_date);