This commit is contained in:
parent
18207bee18
commit
176d9b09e4
@ -372,6 +372,7 @@ pub struct ReleaseDataWithUsedVersionDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, SimpleObject)]
|
#[derive(Debug, SimpleObject)]
|
||||||
|
#[graphql(complex)]
|
||||||
pub struct ReleaseDataVersionDto {
|
pub struct ReleaseDataVersionDto {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub release_data_id: i32,
|
pub release_data_id: i32,
|
||||||
@ -383,6 +384,16 @@ pub struct ReleaseDataVersionDto {
|
|||||||
pub created_at: NaiveDateTime,
|
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 {
|
impl From<(ReleaseDataModel, ReleaseDataVersionModel)> for ReleaseDataWithUsedVersionDto {
|
||||||
fn from((data, version): (ReleaseDataModel, ReleaseDataVersionModel)) -> Self {
|
fn from((data, version): (ReleaseDataModel, ReleaseDataVersionModel)) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
Loading…
Reference in New Issue
Block a user