feat: camelCase JSON responses, isFollowedByViewer, customCss, GET /users/me/following-list
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m15s
test / unit (pull_request) Successful in 16m3s
test / integration (pull_request) Failing after 17m19s

This commit is contained in:
2026-05-14 17:04:42 +02:00
parent d3b7ecad15
commit aadd876994
5 changed files with 63 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ use serde::Deserialize;
use uuid::Uuid;
#[derive(Deserialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct RegisterRequest {
/// Username (1-32 chars, alphanumeric + underscore)
pub username: String,
@@ -10,12 +11,14 @@ pub struct RegisterRequest {
}
#[derive(Deserialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct LoginRequest {
pub email: String,
pub password: String,
}
#[derive(Deserialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct CreateThoughtRequest {
/// Up to 128 characters
pub content: String,
@@ -27,11 +30,13 @@ pub struct CreateThoughtRequest {
}
#[derive(Deserialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct EditThoughtRequest {
pub content: String,
}
#[derive(Deserialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct UpdateProfileRequest {
pub display_name: Option<String>,
pub bio: Option<String>,
@@ -41,12 +46,14 @@ pub struct UpdateProfileRequest {
}
#[derive(Deserialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct SetTopFriendsRequest {
/// Ordered list of user UUIDs, max 8
pub friend_ids: Vec<Uuid>,
}
#[derive(Deserialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct CreateApiKeyRequest {
pub name: String,
}

View File

@@ -3,12 +3,14 @@ use serde::Serialize;
use uuid::Uuid;
#[derive(Serialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct AuthResponse {
pub token: String,
pub user: UserResponse,
}
#[derive(Serialize, Clone, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct UserResponse {
pub id: Uuid,
pub username: String,
@@ -16,15 +18,20 @@ pub struct UserResponse {
pub bio: Option<String>,
pub avatar_url: Option<String>,
pub header_url: Option<String>,
pub custom_css: Option<String>,
pub local: bool,
pub is_followed_by_viewer: bool,
#[serde(rename = "joinedAt")]
pub created_at: DateTime<Utc>,
}
#[derive(Serialize, Clone, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ThoughtResponse {
pub id: Uuid,
pub content: String,
pub author: UserResponse,
#[serde(rename = "replyToId")]
pub in_reply_to_id: Option<Uuid>,
pub visibility: String,
pub content_warning: Option<String>,
@@ -39,6 +46,7 @@ pub struct ThoughtResponse {
}
#[derive(Serialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct PagedResponse<T: Serialize + utoipa::ToSchema> {
pub items: Vec<T>,
pub total: i64,
@@ -47,6 +55,7 @@ pub struct PagedResponse<T: Serialize + utoipa::ToSchema> {
}
#[derive(Serialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ApiKeyResponse {
pub id: Uuid,
pub name: String,
@@ -54,6 +63,7 @@ pub struct ApiKeyResponse {
}
#[derive(Serialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct NotificationResponse {
pub id: Uuid,
pub notification_type: String,
@@ -64,11 +74,13 @@ pub struct NotificationResponse {
}
#[derive(Serialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ErrorResponse {
pub error: String,
}
#[derive(Serialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct CreatedApiKeyResponse {
pub id: Uuid,
pub name: String,