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] `/delete`
|
||||||
- [X] `/id`
|
- [X] `/id`
|
||||||
- [X] `/tokens`
|
- [X] `/tokens`
|
||||||
- [X] `/tokens`
|
|
||||||
- [ ] `/follows`
|
- [ ] `/follows`
|
||||||
- [ ] `/followers`
|
- [ ] `/followers`
|
||||||
- [ ] `/deactivate`
|
- [ ] `/deactivate`
|
||||||
|
|
|
@ -17,10 +17,11 @@ Setting none or two parameters will result in a _400 Bad Request_ Response.
|
||||||
### 200 - Success
|
### 200 - Success
|
||||||
|
|
||||||
__Content - JSON:__
|
__Content - JSON:__
|
||||||
|
|
||||||
| Field | Description |
|
| Field | Description |
|
||||||
|----------|-------------------------------------------------------------------|
|
|----------|-------------------------------------------------------------------|
|
||||||
| id | The users unique id. |
|
| 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. |
|
| joined | The datetime when the user joined. Represented as UNIX timestamp. |
|
||||||
| is_admin | A boolean if the user is an admin. |
|
| is_admin | A boolean if the user is an admin. |
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ pub enum InfoRequest {
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub struct InfoSuccess {
|
pub struct InfoSuccess {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
pub name: String,
|
pub username: String,
|
||||||
pub joined: i64,
|
pub joined: i64,
|
||||||
pub is_admin: bool,
|
pub is_admin: bool,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
api::user::data,
|
|
||||||
accounts::{Account, AccountFlags},
|
accounts::{Account, AccountFlags},
|
||||||
|
api::user::data,
|
||||||
security::is_sql_injection,
|
security::is_sql_injection,
|
||||||
};
|
};
|
||||||
use anyhow::Result;
|
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 {
|
Ok(data::InfoResponse::Success(data::InfoSuccess {
|
||||||
id: account.id.id(),
|
id: account.id.id(),
|
||||||
name: account.username,
|
username: account.username,
|
||||||
joined: account.joined.timestamp(),
|
joined: account.joined.timestamp(),
|
||||||
is_admin,
|
is_admin,
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Reference in New Issue