Compare commits
2 commits
b66c8f0613
...
85f6db499f
Author | SHA1 | Date | |
---|---|---|---|
85f6db499f | |||
4124b08bb2 |
3 changed files with 5 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
use actix_web::{get, post, web, Error, HttpRequest, HttpResponse};
|
||||
use actix_web::{get, patch, web, Error, HttpRequest, HttpResponse};
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::{api::v1::auth::check_access_token, structs::Me, utils::get_auth_header, Data};
|
||||
|
@ -38,7 +38,7 @@ struct NewInfo {
|
|||
email: Option<String>,
|
||||
}
|
||||
|
||||
#[post("/me")]
|
||||
#[patch("/me")]
|
||||
pub async fn update(req: HttpRequest, new_info: web::Json<NewInfo>, data: web::Data<Data>) -> Result<HttpResponse, Error> {
|
||||
let headers = req.headers();
|
||||
|
||||
|
@ -62,7 +62,7 @@ pub async fn update(req: HttpRequest, new_info: web::Json<NewInfo>, data: web::D
|
|||
return Ok(error);
|
||||
}
|
||||
|
||||
let me = me_result;
|
||||
let me = me_result.unwrap();
|
||||
|
||||
if let Some(username) = &new_info.username {
|
||||
todo!();
|
||||
|
|
|
@ -42,7 +42,7 @@ pub async fn res(
|
|||
return Ok(error);
|
||||
}
|
||||
|
||||
let accounts = User::fetch_all(&data.pool, start, amount).await;
|
||||
let accounts = User::fetch_amount(&data.pool, start, amount).await;
|
||||
|
||||
if let Err(error) = accounts {
|
||||
return Ok(error);
|
||||
|
|
|
@ -837,7 +837,7 @@ impl User {
|
|||
Ok(user.build())
|
||||
}
|
||||
|
||||
pub async fn fetch_all(pool: &Pool<Postgres>, start: i32, amount: i32) -> Result<Vec<Self>, HttpResponse> {
|
||||
pub async fn fetch_amount(pool: &Pool<Postgres>, start: i32, amount: i32) -> Result<Vec<Self>, HttpResponse> {
|
||||
let row = sqlx::query_as("SELECT CAST(uuid AS VARCHAR), username, display_name, avatar, email FROM users ORDER BY username LIMIT $1 OFFSET $2")
|
||||
.bind(amount)
|
||||
.bind(start)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue