Changing list_logins to return a ListLoginsResponse object. (#4888)
- Fixes #4873
This commit is contained in:
parent
c8ad0f2d09
commit
ef49a0eb8d
2 changed files with 11 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
use actix_web::web::{Data, Json};
|
use actix_web::web::{Data, Json};
|
||||||
use lemmy_api_common::context::LemmyContext;
|
use lemmy_api_common::{context::LemmyContext, person::ListLoginsResponse};
|
||||||
use lemmy_db_schema::source::login_token::LoginToken;
|
use lemmy_db_schema::source::login_token::LoginToken;
|
||||||
use lemmy_db_views::structs::LocalUserView;
|
use lemmy_db_views::structs::LocalUserView;
|
||||||
use lemmy_utils::error::LemmyResult;
|
use lemmy_utils::error::LemmyResult;
|
||||||
|
@ -7,8 +7,8 @@ use lemmy_utils::error::LemmyResult;
|
||||||
pub async fn list_logins(
|
pub async fn list_logins(
|
||||||
context: Data<LemmyContext>,
|
context: Data<LemmyContext>,
|
||||||
local_user_view: LocalUserView,
|
local_user_view: LocalUserView,
|
||||||
) -> LemmyResult<Json<Vec<LoginToken>>> {
|
) -> LemmyResult<Json<ListLoginsResponse>> {
|
||||||
let logins = LoginToken::list(&mut context.pool(), local_user_view.local_user.id).await?;
|
let logins = LoginToken::list(&mut context.pool(), local_user_view.local_user.id).await?;
|
||||||
|
|
||||||
Ok(Json(logins))
|
Ok(Json(ListLoginsResponse { logins }))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
newtypes::{CommentReplyId, CommunityId, LanguageId, PersonId, PersonMentionId},
|
newtypes::{CommentReplyId, CommunityId, LanguageId, PersonId, PersonMentionId},
|
||||||
sensitive::SensitiveString,
|
sensitive::SensitiveString,
|
||||||
source::site::Site,
|
source::{login_token::LoginToken, site::Site},
|
||||||
CommentSortType,
|
CommentSortType,
|
||||||
ListingType,
|
ListingType,
|
||||||
PostListingMode,
|
PostListingMode,
|
||||||
|
@ -441,3 +441,10 @@ pub struct ListMedia {
|
||||||
pub struct ListMediaResponse {
|
pub struct ListMediaResponse {
|
||||||
pub images: Vec<LocalImageView>,
|
pub images: Vec<LocalImageView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
pub struct ListLoginsResponse {
|
||||||
|
pub logins: Vec<LoginToken>,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue