1
0
Fork 0
forked from gorb/backend

docs: partially document codebase

Should make it easier for frontend to figure out what stuff actually does, more will be added as the project goes on
This commit is contained in:
Radical 2025-05-27 11:52:17 +00:00
parent 1aa38631b8
commit 16ccf94631
10 changed files with 226 additions and 18 deletions

View file

@ -1,3 +1,5 @@
//! `/api/v1/users` Contains endpoints related to all users
use actix_web::{HttpRequest, HttpResponse, Scope, get, web};
use crate::{
@ -12,12 +14,42 @@ mod uuid;
pub fn web() -> Scope {
web::scope("/users")
.service(res)
.service(uuid::res)
.service(get)
.service(uuid::get)
}
/// `GET /api/v1/users` Returns all users on this instance
///
/// requires auth: yes
///
/// requires admin: yes
///
/// ### Response Example
/// ```
/// json!([
/// {
/// "uuid": "155d2291-fb23-46bd-a656-ae7c5d8218e6",
/// "username": "user1",
/// "display_name": "Nullable Name",
/// "avatar": "https://nullable-url.com/path/to/image.png"
/// },
/// {
/// "uuid": "d48a3317-7b4d-443f-a250-ea9ab2bb8661",
/// "username": "user2",
/// "display_name": "John User 2",
/// "avatar": "https://also-supports-jpg.com/path/to/image.jpg"
/// },
/// {
/// "uuid": "12c4b3f8-a25b-4b9b-8136-b275c855ed4a",
/// "username": "user3",
/// "display_name": null,
/// "avatar": null
/// }
/// ]);
/// ```
/// NOTE: UUIDs in this response are made using `uuidgen`, UUIDs made by the actual backend will be UUIDv7 and have extractable timestamps
#[get("")]
pub async fn res(
pub async fn get(
req: HttpRequest,
request_query: web::Query<StartAmountQuery>,
data: web::Data<Data>,