mirror of
https://git.alemi.dev/guestbook.rs.git
synced 2024-12-19 02:54:52 +01:00
fix: solve warnings when not all features
This commit is contained in:
parent
06bfb9157b
commit
beb80cc183
2 changed files with 6 additions and 2 deletions
|
@ -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()
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue