发布版本数据api添加用户name字段
build / build-rust (push) Successful in 1m53s
Details
build / build-rust (push) Successful in 1m53s
Details
This commit is contained in:
parent
18207bee18
commit
176d9b09e4
|
@ -372,6 +372,7 @@ pub struct ReleaseDataWithUsedVersionDto {
|
|||
}
|
||||
|
||||
#[derive(Debug, SimpleObject)]
|
||||
#[graphql(complex)]
|
||||
pub struct ReleaseDataVersionDto {
|
||||
pub id: i32,
|
||||
pub release_data_id: i32,
|
||||
|
@ -383,6 +384,16 @@ pub struct ReleaseDataVersionDto {
|
|||
pub created_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
#[ComplexObject]
|
||||
impl ReleaseDataVersionDto {
|
||||
/// 获取用户name
|
||||
async fn user_name(&self, ctx: &Context<'_>) -> async_graphql::Result<Option<String>> {
|
||||
let loader = ctx.data_unchecked::<DataLoader<RtssDbLoader>>();
|
||||
let name = loader.load_one(UserId::new(self.user_id)).await?;
|
||||
Ok(name)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<(ReleaseDataModel, ReleaseDataVersionModel)> for ReleaseDataWithUsedVersionDto {
|
||||
fn from((data, version): (ReleaseDataModel, ReleaseDataVersionModel)) -> Self {
|
||||
Self {
|
||||
|
|
Loading…
Reference in New Issue