refactor(api): renamend the field `name` of /user/id to `username`

This commit is contained in:
antifallobst 2023-09-13 07:23:26 +02:00
parent 7bf9e57010
commit 49e193768d
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
4 changed files with 9 additions and 9 deletions

View File

@ -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`

View File

@ -17,11 +17,12 @@ 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. |
### 400 - Error: Bad Request ### 400 - Error: Bad Request

View File

@ -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,
} }

View File

@ -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,
})) }))