feat: auth basics

This commit is contained in:
nullishamy 2025-04-24 20:19:54 +01:00
parent 005c13e1d4
commit 9c7c2858cc
Signed by: amy
SSH key fingerprint: SHA256:WmV0uk6WgAQvDJlM8Ld4mFPHZo02CLXXP5VkwQ5xtyk
11 changed files with 215 additions and 29 deletions

View file

@ -1,4 +1,4 @@
use crate::{Db, endpoints::api::user::CredentialAcount};
use crate::{AuthenticatedUser, Db, endpoints::api::user::CredentialAcount};
use rocket::{
get,
serde::{Deserialize, Serialize, json::Json},
@ -32,7 +32,12 @@ pub struct TimelineStatus {
}
#[get("/timelines/home?<limit>")]
pub async fn home(mut db: Connection<Db>, limit: i64) -> Json<Vec<TimelineStatus>> {
pub async fn home(
mut db: Connection<Db>,
limit: i64,
user: AuthenticatedUser,
) -> Json<Vec<TimelineStatus>> {
dbg!(user);
let posts = sqlx::query!(
r#"
SELECT p.id as "post_id", u.id as "user_id", p.content, p.uri as "post_uri",