chore(doc): implement remainder of documentation
This commit is contained in:
@@ -5,20 +5,27 @@ use rocket::{serde::json::Json, State};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use validator::Validate;
|
||||
|
||||
#[derive(Validate, Serialize, Deserialize)]
|
||||
pub struct Data {
|
||||
/// # Username Information
|
||||
#[derive(Validate, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct DataChangeUsername {
|
||||
/// New username
|
||||
#[validate(length(min = 2, max = 32), regex = "RE_USERNAME")]
|
||||
username: String,
|
||||
/// Current account password
|
||||
#[validate(length(min = 8, max = 1024))]
|
||||
password: String,
|
||||
}
|
||||
|
||||
/// # Change Username
|
||||
///
|
||||
/// Change your username.
|
||||
#[openapi(tag = "User Information")]
|
||||
#[patch("/@me/username", data = "<data>")]
|
||||
pub async fn req(
|
||||
db: &State<Database>,
|
||||
account: Account,
|
||||
mut user: User,
|
||||
data: Json<Data>,
|
||||
data: Json<DataChangeUsername>,
|
||||
) -> Result<Json<User>> {
|
||||
let data = data.into_inner();
|
||||
account
|
||||
|
||||
Reference in New Issue
Block a user