mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 10:26:21 +00:00
feat(backend) update (unfinished)
This commit is contained in:
4 files changed
+15
-1
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
#[macro_export]
|
||||||
|
macro_rules! dev_consume {
|
||||||
|
($($var:ident),+) => {
|
||||||
|
$(let _ = $var;)*
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
|
mod dev;
|
||||||
mod include_str;
|
mod include_str;
|
||||||
mod log;
|
mod log;
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
use macros::dev_consume;
|
||||||
|
|
||||||
use axum::response::IntoResponse;
|
use axum::response::IntoResponse;
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::{Path, State},
|
extract::{Path, State},
|
||||||
@@ -13,7 +15,7 @@ pub async fn handler(
|
|||||||
State(db_connection): State<PgPool>,
|
State(db_connection): State<PgPool>,
|
||||||
Path(identifier): Path<String>,
|
Path(identifier): Path<String>,
|
||||||
) -> impl IntoResponse {
|
) -> impl IntoResponse {
|
||||||
let post = if let Ok(id) = identifier.parse::<i64>() {
|
if let Ok(id) = identifier.parse::<i64>() {
|
||||||
select_post_with_i64_id(&db_connection, id).await
|
select_post_with_i64_id(&db_connection, id).await
|
||||||
} else {
|
} else {
|
||||||
select_post_with_str_id(&db_connection, &identifier).await
|
select_post_with_str_id(&db_connection, &identifier).await
|
||||||
@@ -22,9 +24,11 @@ pub async fn handler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn select_post_with_i64_id(db: &PgPool, id: i64) {
|
async fn select_post_with_i64_id(db: &PgPool, id: i64) {
|
||||||
|
dev_consume!(db, id);
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn select_post_with_str_id(db: &PgPool, id: &str) {
|
async fn select_post_with_str_id(db: &PgPool, id: &str) {
|
||||||
|
dev_consume!(db, id);
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
pub mod get_page_count;
|
pub mod get_page_count;
|
||||||
|
|
||||||
|
// todo: remove exception tag
|
||||||
|
#[allow(dead_code)]
|
||||||
pub mod get_post;
|
pub mod get_post;
|
||||||
// pub mod get_post_list;
|
// pub mod get_post_list;
|
||||||
Reference in new issue
Block a user