refactor(api): renamend the field `name` of /user/id to `username`
This commit is contained in:
parent
7bf9e57010
commit
49e193768d
|
@ -15,7 +15,6 @@ __(ND)__ -> Not designed yet.
|
|||
- [X] `/delete`
|
||||
- [X] `/id`
|
||||
- [X] `/tokens`
|
||||
- [X] `/tokens`
|
||||
- [ ] `/follows`
|
||||
- [ ] `/followers`
|
||||
- [ ] `/deactivate`
|
||||
|
|
|
@ -17,10 +17,11 @@ Setting none or two parameters will result in a _400 Bad Request_ Response.
|
|||
### 200 - Success
|
||||
|
||||
__Content - JSON:__
|
||||
|
||||
| Field | Description |
|
||||
|----------|-------------------------------------------------------------------|
|
||||
| id | The users unique id. |
|
||||
| name | The users unique username. |
|
||||
| username | The users unique username. |
|
||||
| joined | The datetime when the user joined. Represented as UNIX timestamp. |
|
||||
| is_admin | A boolean if the user is an admin. |
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ pub enum InfoRequest {
|
|||
#[derive(Debug, Serialize)]
|
||||
pub struct InfoSuccess {
|
||||
pub id: i64,
|
||||
pub name: String,
|
||||
pub username: String,
|
||||
pub joined: i64,
|
||||
pub is_admin: bool,
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
api::user::data,
|
||||
accounts::{Account, AccountFlags},
|
||||
api::user::data,
|
||||
security::is_sql_injection,
|
||||
};
|
||||
use anyhow::Result;
|
||||
|
@ -24,7 +24,7 @@ pub async fn info(pool: &PgPool, request: data::InfoRequest) -> Result<data::Inf
|
|||
|
||||
Ok(data::InfoResponse::Success(data::InfoSuccess {
|
||||
id: account.id.id(),
|
||||
name: account.username,
|
||||
username: account.username,
|
||||
joined: account.joined.timestamp(),
|
||||
is_admin,
|
||||
}))
|
||||
|
|
Loading…
Reference in New Issue