added nested routes, added separate config struct, among other items
This commit is contained in:
@@ -1,2 +1,8 @@
|
||||
use crate::routes::comments::CommentInput;
|
||||
use sqlx::PgPool;
|
||||
|
||||
pub struct CommentsDatasource;
|
||||
impl CommentsDatasource {}
|
||||
impl CommentsDatasource {
|
||||
pub async fn get_posts_comments(pool: PgPool) {}
|
||||
pub async fn insert_comment(pool: PgPool, comment_input: CommentInput) {}
|
||||
}
|
||||
|
@@ -1,2 +1,11 @@
|
||||
use sqlx::PgPool;
|
||||
|
||||
pub struct PostsDatasource;
|
||||
impl PostsDatasource {}
|
||||
impl PostsDatasource {
|
||||
pub async fn get_all(pool: PgPool) {
|
||||
sqlx::query("SELECT title, body, created_at FROM posts ORDER BY created_at DESC LIMIT 10")
|
||||
.fetch_all(&pool)
|
||||
.await;
|
||||
}
|
||||
pub async fn get_one(pool: PgPool) {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user