chore: remove all compiler and clippy warnings
parent
f3ede6f9a6
commit
279983c64c
|
@ -17,10 +17,8 @@ use crate::schema::*;
|
||||||
pub struct Device {
|
pub struct Device {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
pub device_id: String,
|
pub device_id: String,
|
||||||
pub user_id: i64,
|
|
||||||
pub caption: String,
|
pub caption: String,
|
||||||
pub type_: DeviceType,
|
pub type_: DeviceType,
|
||||||
pub sync_group_id: Option<i64>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable)]
|
#[derive(Insertable)]
|
||||||
|
|
|
@ -6,8 +6,6 @@ use crate::schema::*;
|
||||||
#[diesel(table_name = device_subscriptions)]
|
#[diesel(table_name = device_subscriptions)]
|
||||||
#[diesel(check_for_backend(diesel::sqlite::Sqlite))]
|
#[diesel(check_for_backend(diesel::sqlite::Sqlite))]
|
||||||
pub struct DeviceSubscription {
|
pub struct DeviceSubscription {
|
||||||
pub id: i64,
|
|
||||||
pub device_id: i64,
|
|
||||||
pub podcast_url: String,
|
pub podcast_url: String,
|
||||||
pub time_changed: i64,
|
pub time_changed: i64,
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
|
|
|
@ -16,9 +16,6 @@ use crate::schema::*;
|
||||||
#[diesel(table_name = episode_actions)]
|
#[diesel(table_name = episode_actions)]
|
||||||
#[diesel(check_for_backend(diesel::sqlite::Sqlite))]
|
#[diesel(check_for_backend(diesel::sqlite::Sqlite))]
|
||||||
pub struct EpisodeAction {
|
pub struct EpisodeAction {
|
||||||
pub id: i64,
|
|
||||||
pub user_id: i64,
|
|
||||||
pub device_id: Option<i64>,
|
|
||||||
pub podcast_url: String,
|
pub podcast_url: String,
|
||||||
pub episode_url: String,
|
pub episode_url: String,
|
||||||
pub time_changed: i64,
|
pub time_changed: i64,
|
||||||
|
|
|
@ -20,7 +20,7 @@ use crate::server::{
|
||||||
pub fn router() -> Router<Context> {
|
pub fn router() -> Router<Context> {
|
||||||
Router::new()
|
Router::new()
|
||||||
.route("/{username}/login.json", post(post_login))
|
.route("/{username}/login.json", post(post_login))
|
||||||
.route("/{username}/logout.json", post(post_logout))
|
.route("/{_username}/logout.json", post(post_logout))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn post_login(
|
async fn post_login(
|
||||||
|
@ -85,7 +85,7 @@ async fn post_login(
|
||||||
|
|
||||||
async fn post_logout(
|
async fn post_logout(
|
||||||
State(ctx): State<Context>,
|
State(ctx): State<Context>,
|
||||||
Path(username): Path<String>,
|
Path(_username): Path<String>,
|
||||||
jar: CookieJar,
|
jar: CookieJar,
|
||||||
) -> AppResult<CookieJar> {
|
) -> AppResult<CookieJar> {
|
||||||
if let Some(session_id) = jar.get(SESSION_ID_COOKIE) {
|
if let Some(session_id) = jar.get(SESSION_ID_COOKIE) {
|
||||||
|
|
|
@ -19,7 +19,10 @@ pub fn router(ctx: Context) -> Router<Context> {
|
||||||
Router::new()
|
Router::new()
|
||||||
.route("/{username}", get(get_devices))
|
.route("/{username}", get(get_devices))
|
||||||
.route("/{username}/{id}", post(post_device))
|
.route("/{username}/{id}", post(post_device))
|
||||||
.layer(middleware::from_fn_with_state(ctx.clone(), auth_api_middleware))
|
.layer(middleware::from_fn_with_state(
|
||||||
|
ctx.clone(),
|
||||||
|
auth_api_middleware,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_devices(
|
async fn get_devices(
|
||||||
|
|
|
@ -22,7 +22,10 @@ pub fn router(ctx: Context) -> Router<Context> {
|
||||||
"/{username}/{id}",
|
"/{username}/{id}",
|
||||||
post(post_subscription_changes).get(get_subscription_changes),
|
post(post_subscription_changes).get(get_subscription_changes),
|
||||||
)
|
)
|
||||||
.layer(middleware::from_fn_with_state(ctx.clone(), auth_api_middleware))
|
.layer(middleware::from_fn_with_state(
|
||||||
|
ctx.clone(),
|
||||||
|
auth_api_middleware,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn post_subscription_changes(
|
pub async fn post_subscription_changes(
|
||||||
|
|
|
@ -21,7 +21,10 @@ pub fn router(ctx: Context) -> Router<Context> {
|
||||||
"/{username}",
|
"/{username}",
|
||||||
get(get_sync_status).post(post_sync_status_changes),
|
get(get_sync_status).post(post_sync_status_changes),
|
||||||
)
|
)
|
||||||
.layer(middleware::from_fn_with_state(ctx.clone(), auth_api_middleware))
|
.layer(middleware::from_fn_with_state(
|
||||||
|
ctx.clone(),
|
||||||
|
auth_api_middleware,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_sync_status(
|
pub async fn get_sync_status(
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl<'de> Deserialize<'de> for StringWithFormat {
|
||||||
{
|
{
|
||||||
struct StrVisitor;
|
struct StrVisitor;
|
||||||
|
|
||||||
impl<'de> Visitor<'de> for StrVisitor {
|
impl Visitor<'_> for StrVisitor {
|
||||||
type Value = StringWithFormat;
|
type Value = StringWithFormat;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
|
|
@ -18,7 +18,10 @@ pub fn router(ctx: Context) -> Router<Context> {
|
||||||
get(get_device_subscriptions).put(put_device_subscriptions),
|
get(get_device_subscriptions).put(put_device_subscriptions),
|
||||||
)
|
)
|
||||||
.route("/{username}", get(get_user_subscriptions))
|
.route("/{username}", get(get_user_subscriptions))
|
||||||
.layer(middleware::from_fn_with_state(ctx.clone(), auth_api_middleware))
|
.layer(middleware::from_fn_with_state(
|
||||||
|
ctx.clone(),
|
||||||
|
auth_api_middleware,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_device_subscriptions(
|
pub async fn get_device_subscriptions(
|
||||||
|
|
Loading…
Reference in New Issue