feat(backend) update (unfinished)

This commit is contained in:
lumither committed 2025-02-22 01:15:46 -08:00
1 parent 8358a8ae33
commit ca86dd236e
4 files changed
+15 -1

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
#[macro_export]
macro_rules! dev_consume {
($($var:ident),+) => {
$(let _ = $var;)*
};
}
+1
View File
@@ -1,2 +1,3 @@
mod dev;
mod include_str;
mod log;
@@ -1,3 +1,5 @@
use macros::dev_consume;
use axum::response::IntoResponse;
use axum::{
extract::{Path, State},
@@ -13,7 +15,7 @@ pub async fn handler(
State(db_connection): State<PgPool>,
Path(identifier): Path<String>,
) -> 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
} else {
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) {
dev_consume!(db, id);
todo!()
}
async fn select_post_with_str_id(db: &PgPool, id: &str) {
dev_consume!(db, id);
todo!()
}
@@ -1,3 +1,6 @@
pub mod get_page_count;
// todo: remove exception tag
#[allow(dead_code)]
pub mod get_post;
// pub mod get_post_list;