diff --git a/ee/tabby-schema/src/dao.rs b/ee/tabby-schema/src/dao.rs index ae89792768fc..73fa84bebbdc 100644 --- a/ee/tabby-schema/src/dao.rs +++ b/ee/tabby-schema/src/dao.rs @@ -10,6 +10,7 @@ use tabby_db::{ use crate::{ integration::{Integration, IntegrationKind, IntegrationStatus}, + interface::UserValue, repository::RepositoryKind, schema::{ auth::{self, OAuthCredential, OAuthProvider}, @@ -242,7 +243,7 @@ impl From for thread::MessageAttachmentDoc { thread::MessageAttachmentDoc::Issue(thread::MessageAttachmentIssueDoc { title: val.title, link: val.link, - author: val.author_user_id.map(|x| thread::MessageAttachmentAuthor { + author: val.author_user_id.map(|x| UserValue { id: x, email: None, name: None, @@ -255,7 +256,7 @@ impl From for thread::MessageAttachmentDoc { thread::MessageAttachmentDoc::Pull(thread::MessageAttachmentPullDoc { title: val.title, link: val.link, - author: val.author_user_id.map(|x| thread::MessageAttachmentAuthor { + author: val.author_user_id.map(|x| UserValue { id: x, email: None, name: None, diff --git a/ee/tabby-schema/src/schema/auth.rs b/ee/tabby-schema/src/schema/auth.rs index c05ed1b6d27b..404da5d72a8c 100644 --- a/ee/tabby-schema/src/schema/auth.rs +++ b/ee/tabby-schema/src/schema/auth.rs @@ -174,7 +174,7 @@ impl JWTPayload { } } -#[derive(Debug, GraphQLObject)] +#[derive(Debug, GraphQLObject, Clone)] #[graphql(context = Context, impl = [UserValue])] pub struct UserSecured { // === implements User === diff --git a/ee/tabby-schema/src/schema/thread/types.rs b/ee/tabby-schema/src/schema/thread/types.rs index c63c68796a80..4587b00fdca6 100644 --- a/ee/tabby-schema/src/schema/thread/types.rs +++ b/ee/tabby-schema/src/schema/thread/types.rs @@ -7,7 +7,7 @@ use tabby_common::api::{ }; use validator::Validate; -use crate::{juniper::relay::NodeType, Context}; +use crate::{interface::UserValue, juniper::relay::NodeType, Context}; #[derive(GraphQLEnum, Serialize, Clone, PartialEq, Eq)] pub enum Role { @@ -55,6 +55,7 @@ pub struct UpdateMessageInput { } #[derive(GraphQLObject, Clone, Default)] +#[graphql(context = Context)] pub struct MessageAttachment { pub code: Vec, pub client_code: Vec, @@ -122,6 +123,7 @@ impl From for MessageCodeSearchHit { } #[derive(GraphQLUnion, Clone)] +#[graphql(context = Context)] pub enum MessageAttachmentDoc { Web(MessageAttachmentWebDoc), Issue(MessageAttachmentIssueDoc), @@ -136,26 +138,21 @@ pub struct MessageAttachmentWebDoc { } #[derive(GraphQLObject, Clone)] +#[graphql(context = Context)] pub struct MessageAttachmentIssueDoc { pub title: String, pub link: String, - pub author: Option, + pub author: Option, pub body: String, pub closed: bool, } #[derive(GraphQLObject, Clone)] -pub struct MessageAttachmentAuthor { - pub id: String, - pub email: Option, - pub name: Option, -} - -#[derive(GraphQLObject, Clone)] +#[graphql(context = Context)] pub struct MessageAttachmentPullDoc { pub title: String, pub link: String, - pub author: Option, + pub author: Option, pub body: String, pub patch: String, pub merged: bool, @@ -191,6 +188,7 @@ impl From for MessageAttachmentDoc { } #[derive(GraphQLObject)] +#[graphql(context = Context)] pub struct MessageDocSearchHit { pub doc: MessageAttachmentDoc, pub score: f64, @@ -256,6 +254,7 @@ pub struct ThreadAssistantMessageAttachmentsCode { } #[derive(GraphQLObject)] +#[graphql(context = Context)] pub struct ThreadAssistantMessageAttachmentsDoc { pub hits: Vec, } @@ -274,6 +273,7 @@ pub struct ThreadAssistantMessageCompleted { /// /// Apart from `thread_message_content_delta`, all other items will only appear once in the stream. #[derive(GraphQLUnion)] +#[graphql(context = Context)] pub enum ThreadRunItem { ThreadCreated(ThreadCreated), ThreadRelevantQuestions(ThreadRelevantQuestions),