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] `/id`
- [X] `/tokens`
- [X] `/tokens`
- [ ] `/follows`
- [ ] `/followers`
- [ ] `/deactivate`

View File

@ -17,11 +17,12 @@ Setting none or two parameters will result in a _400 Bad Request_ Response.
### 200 - Success
__Content - JSON:__
| Field | Description |
| Field | Description |
|----------|-------------------------------------------------------------------|
| id | The users unique id. |
| name | The users unique username. |
| joined | The datetime when the user joined. Represented as UNIX timestamp. |
| id | The users unique id. |
| 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. |
### 400 - Error: Bad Request
@ -34,4 +35,4 @@ Blocked for security reasons.
### 404 - Error: Not Found
The user wasn't found.
The user wasn't found.

View File

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

View File

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