fix: solve warnings when not all features

This commit is contained in:
əlemi 2024-01-03 23:35:12 +01:00
parent 06bfb9157b
commit beb80cc183
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 6 additions and 2 deletions

View file

@ -1,10 +1,11 @@
use std::sync::Arc; use std::sync::Arc;
use axum::{Json, Form, Router, routing::{put, post, get}, extract::{State, Query}, response::{Redirect, Html}}; use axum::{Json, Form, Router, routing::{put, post, get}, extract::{State, Query}, response::Redirect};
use crate::{notifications::NotificationProcessor, model::{Page, PageOptions, PageInsertion, PageView}, storage::StorageProvider, config::ConfigRouting}; use crate::{notifications::NotificationProcessor, model::{Page, PageOptions, PageInsertion, PageView}, storage::StorageProvider, config::ConfigRouting};
pub fn create_router_with_app_routes(state: Context) -> Router { pub fn create_router_with_app_routes(state: Context) -> Router {
#[allow(unused_mut)]
let mut router = Router::new() let mut router = Router::new()
.route("/api", get(get_suggestion)) .route("/api", get(get_suggestion))
.route("/api", post(send_suggestion_form)) .route("/api", post(send_suggestion_form))
@ -14,6 +15,7 @@ pub fn create_router_with_app_routes(state: Context) -> Router {
{ {
use sailfish::TemplateOnce; use sailfish::TemplateOnce;
use axum_extra::response::{Css, JavaScript}; use axum_extra::response::{Css, JavaScript};
use axum::response::Html;
let template = crate::web::IndexTemplate::from(&state.template) let template = crate::web::IndexTemplate::from(&state.template)
.render_once() .render_once()

View file

@ -27,6 +27,7 @@ pub struct StorageProvider {
// https://github.com/launchbadge/sqlx/issues/2778 // https://github.com/launchbadge/sqlx/issues/2778
// so the `public` field is an integer which is ridicolous // so the `public` field is an integer which is ridicolous
#[cfg(any(feature = "sqlite", feature = "mysql"))]
const SQLITE_SCHEMA : &str = " const SQLITE_SCHEMA : &str = "
CREATE TABLE IF NOT EXISTS pages ( CREATE TABLE IF NOT EXISTS pages (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,
@ -36,8 +37,9 @@ CREATE TABLE IF NOT EXISTS pages (
timestamp INTEGER NOT NULL, timestamp INTEGER NOT NULL,
public INTEGER NOT NULL public INTEGER NOT NULL
); );
"; "; // TODO make schema specific for mysql
#[cfg(feature = "postgres")]
const POSTGRES_SCHEMA : &str = " const POSTGRES_SCHEMA : &str = "
CREATE TABLE IF NOT EXISTS pages ( CREATE TABLE IF NOT EXISTS pages (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,