feat: implement thought thread retrieval with replies and visibility filtering
This commit is contained in:
@@ -10,6 +10,7 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
axum = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
utoipa = { workspace = true, features = ["axum_extras"] }
|
||||
utoipa-swagger-ui = { version = "9.0.2", features = [
|
||||
"axum",
|
||||
@@ -19,5 +20,5 @@ utoipa-scalar = { version = "0.3.0", features = [
|
||||
"axum",
|
||||
], default-features = false }
|
||||
|
||||
api = { path = "../api" }
|
||||
# api = { path = "../api" }
|
||||
models = { path = "../models" }
|
||||
|
@@ -6,28 +6,8 @@ use utoipa::{
|
||||
use utoipa_scalar::{Scalar, Servable as ScalarServable};
|
||||
use utoipa_swagger_ui::SwaggerUi;
|
||||
|
||||
mod api_key;
|
||||
mod auth;
|
||||
mod feed;
|
||||
mod friends;
|
||||
mod root;
|
||||
mod search;
|
||||
mod tag;
|
||||
mod thought;
|
||||
mod user;
|
||||
#[derive(OpenApi)]
|
||||
#[openapi(
|
||||
nest(
|
||||
(path = "/", api = root::RootApi),
|
||||
(path = "/auth", api = auth::AuthApi),
|
||||
(path = "/users", api = user::UserApi),
|
||||
(path = "/users/me/api-keys", api = api_key::ApiKeyApi),
|
||||
(path = "/thoughts", api = thought::ThoughtApi),
|
||||
(path = "/feed", api = feed::FeedApi),
|
||||
(path = "/tags", api = tag::TagApi),
|
||||
(path = "/friends", api = friends::FriendsApi),
|
||||
(path = "/search", api = search::SearchApi),
|
||||
),
|
||||
tags(
|
||||
(name = "root", description = "Root API"),
|
||||
(name = "auth", description = "Authentication API"),
|
||||
@@ -57,12 +37,14 @@ impl Modify for SecurityAddon {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ApiDoc {
|
||||
pub trait ApiDocExt {
|
||||
fn attach_doc(self) -> Self;
|
||||
}
|
||||
|
||||
impl ApiDoc for Router {
|
||||
impl ApiDocExt for Router {
|
||||
fn attach_doc(self) -> Self {
|
||||
tracing::info!("Attaching API documentation");
|
||||
|
||||
self.merge(SwaggerUi::new("/docs").url("/openapi.json", _ApiDoc::openapi()))
|
||||
.merge(Scalar::with_url("/scalar", _ApiDoc::openapi()))
|
||||
}
|
||||
|
@@ -2,15 +2,19 @@ use api::{
|
||||
models::{ApiErrorResponse, ParamsErrorResponse},
|
||||
routers::thought::*,
|
||||
};
|
||||
use models::{params::thought::CreateThoughtParams, schemas::thought::ThoughtSchema};
|
||||
use models::{
|
||||
params::thought::CreateThoughtParams,
|
||||
schemas::thought::{ThoughtSchema, ThoughtThreadSchema},
|
||||
};
|
||||
use utoipa::OpenApi;
|
||||
|
||||
#[derive(OpenApi)]
|
||||
#[openapi(
|
||||
paths(thoughts_post, thoughts_delete, get_thought_by_id),
|
||||
paths(thoughts_post, thoughts_delete, get_thought_by_id, get_thought_thread),
|
||||
components(schemas(
|
||||
CreateThoughtParams,
|
||||
ThoughtSchema,
|
||||
ThoughtThreadSchema,
|
||||
ApiErrorResponse,
|
||||
ParamsErrorResponse
|
||||
))
|
||||
|
Reference in New Issue
Block a user