Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore(email-service): Hexify list labels endpoint (#1783)

Evan Hutnik5847d2fac20b
diff --git a/js/app/packages/app/component/next-soup/utils.ts b/js/app/packages/app/component/next-soup/utils.ts
index 0149be0111..e71d0c7499 100644
--- a/js/app/packages/app/component/next-soup/utils.ts
+++ b/js/app/packages/app/component/next-soup/utils.ts
@@ -485,7 +485,7 @@ export function trashEmails(ids: string[]): TrashEmailsHandle {
staleTime: 5 * 60 * 1000,
});
const trashLabel = labelsData?.labels.find(
- (l) => l.provider_label_id === 'TRASH'
+ (l) => l.providerLabelId === 'TRASH'
);
const labelId = trashLabel?.id;
if (!labelId) {
diff --git a/js/app/packages/service-clients/service-email/generated/client.ts b/js/app/packages/service-clients/service-email/generated/client.ts
index 69be358b47..9e7b4f4bd4 100644
--- a/js/app/packages/service-clients/service-email/generated/client.ts
+++ b/js/app/packages/service-clients/service-email/generated/client.ts
@@ -1102,18 +1102,13 @@ export const initUser = async (
};
/**
- * @summary List user labels.
+ * @summary List all labels for the user's email link.
*/
export type listLabelsResponse200 = {
data: ListLabelsResponse;
status: 200;
};
-export type listLabelsResponse400 = {
- data: ErrorResponse;
- status: 400;
-};
-
export type listLabelsResponse401 = {
data: ErrorResponse;
status: 401;
@@ -1128,7 +1123,6 @@ export type listLabelsResponseSuccess = listLabelsResponse200 & {
headers: Headers;
};
export type listLabelsResponseError = (
- | listLabelsResponse400
| listLabelsResponse401
| listLabelsResponse500
) & {
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/listLabelsResponse.ts b/js/app/packages/service-clients/service-email/generated/schemas/listLabelsResponse.ts
index bab988bacd..3ac658ddbd 100644
--- a/js/app/packages/service-clients/service-email/generated/schemas/listLabelsResponse.ts
+++ b/js/app/packages/service-clients/service-email/generated/schemas/listLabelsResponse.ts
@@ -4,8 +4,11 @@
* email_service
* OpenAPI spec version: 0.1.0
*/
-import type { Label } from './label';
+import type { ApiLabel } from './apiLabel';
+/**
+ * Response body for listing labels.
+ */
export interface ListLabelsResponse {
- labels: Label[];
+ labels: ApiLabel[];
}
diff --git a/js/app/packages/service-clients/service-email/openapi.json b/js/app/packages/service-clients/service-email/openapi.json
index f9de69189e..b12b7e613e 100644
--- a/js/app/packages/service-clients/service-email/openapi.json
+++ b/js/app/packages/service-clients/service-email/openapi.json
@@ -1037,7 +1037,7 @@
"/email/labels": {
"get": {
"tags": ["Labels"],
- "summary": "List user labels.",
+ "summary": "List all labels for the user's email link.",
"operationId": "list_labels",
"responses": {
"200": {
@@ -1050,16 +1050,6 @@
}
}
},
- "400": {
- "description": "",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorResponse"
- }
- }
- }
- },
"401": {
"description": "",
"content": {
@@ -3640,12 +3630,13 @@
},
"ListLabelsResponse": {
"type": "object",
+ "description": "Response body for listing labels.",
"required": ["labels"],
"properties": {
"labels": {
"type": "array",
"items": {
- "$ref": "#/components/schemas/Label"
+ "$ref": "#/components/schemas/ApiLabel"
}
}
}
diff --git a/rust/cloud-storage/email/.sqlx/query-21ac8784f90a5e311b658fe88195bdf9c83dfc84f0b5a8e8075a7153d7f41818.json b/rust/cloud-storage/email/.sqlx/query-21ac8784f90a5e311b658fe88195bdf9c83dfc84f0b5a8e8075a7153d7f41818.json
new file mode 100644
index 0000000000..cf7c2c61a1
--- /dev/null
+++ b/rust/cloud-storage/email/.sqlx/query-21ac8784f90a5e311b658fe88195bdf9c83dfc84f0b5a8e8075a7153d7f41818.json
@@ -0,0 +1,95 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT\n id,\n link_id,\n provider_label_id,\n name,\n created_at,\n message_list_visibility as \"message_list_visibility: _\",\n label_list_visibility as \"label_list_visibility: _\",\n type as \"type_: _\"\n FROM email_labels\n WHERE link_id = $1\n ORDER BY name\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "link_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 2,
+ "name": "provider_label_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "name",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 4,
+ "name": "created_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 5,
+ "name": "message_list_visibility: _",
+ "type_info": {
+ "Custom": {
+ "name": "email_message_list_visibility_enum",
+ "kind": {
+ "Enum": [
+ "Show",
+ "Hide"
+ ]
+ }
+ }
+ }
+ },
+ {
+ "ordinal": 6,
+ "name": "label_list_visibility: _",
+ "type_info": {
+ "Custom": {
+ "name": "email_label_list_visibility_enum",
+ "kind": {
+ "Enum": [
+ "LabelShow",
+ "LabelShowIfUnread",
+ "LabelHide"
+ ]
+ }
+ }
+ }
+ },
+ {
+ "ordinal": 7,
+ "name": "type_: _",
+ "type_info": {
+ "Custom": {
+ "name": "email_label_type_enum",
+ "kind": {
+ "Enum": [
+ "System",
+ "User"
+ ]
+ }
+ }
+ }
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "21ac8784f90a5e311b658fe88195bdf9c83dfc84f0b5a8e8075a7153d7f41818"
+}
diff --git a/rust/cloud-storage/email/src/domain/ports.rs b/rust/cloud-storage/email/src/domain/ports.rs
index 253621744a..38868bbf50 100644
--- a/rust/cloud-storage/email/src/domain/ports.rs
+++ b/rust/cloud-storage/email/src/domain/ports.rs
@@ -195,6 +195,12 @@ pub trait EmailRepo: Send + Sync + 'static {
link_id: Uuid,
is_starred: bool,
) -> impl Future<Output = Result<(), Self::Err>> + Send;
+
+ /// Fetch all labels for a link.
+ fn list_labels_by_link_id(
+ &self,
+ link_id: Uuid,
+ ) -> impl Future<Output = Result<Vec<LinkLabel>, Self::Err>> + Send;
}
pub trait EmailService: Send + Sync + 'static {
@@ -236,6 +242,12 @@ pub trait EmailService: Send + Sync + 'static {
input: CreateDraftInput,
) -> impl Future<Output = Result<CreatedDraft, EmailErr>> + Send;
+ /// List all labels for the given link.
+ fn list_labels(
+ &self,
+ link: &Link,
+ ) -> impl Future<Output = Result<Vec<LinkLabel>, EmailErr>> + Send;
+
/// Add or remove a label from all messages in a thread.
fn update_thread_labels(
&self,
diff --git a/rust/cloud-storage/email/src/domain/service/mod.rs b/rust/cloud-storage/email/src/domain/service/mod.rs
index 9dd6ac06a8..ab49db3824 100644
--- a/rust/cloud-storage/email/src/domain/service/mod.rs
+++ b/rust/cloud-storage/email/src/domain/service/mod.rs
@@ -7,7 +7,7 @@ mod thread_labels;
use crate::domain::{
models::{
CreateDraftInput, CreatedDraft, EmailErr, EnrichedEmailThreadPreview, GetEmailsRequest,
- Link, Thread, UpdateThreadLabelsResult,
+ Link, LinkLabel, Thread, UpdateThreadLabelsResult,
},
ports::{EmailMessageEnqueuer, EmailRepo, EmailService, GmailLabelModifier},
};
@@ -101,6 +101,13 @@ where
self.send_message_impl(link, input).await
}
+ async fn list_labels(&self, link: &Link) -> Result<Vec<LinkLabel>, EmailErr> {
+ self.email_repo
+ .list_labels_by_link_id(link.id)
+ .await
+ .map_err(|e| EmailErr::RepoErr(e.into()))
+ }
+
async fn update_thread_labels(
&self,
access_token: &str,
diff --git a/rust/cloud-storage/email/src/inbound/axum.rs b/rust/cloud-storage/email/src/inbound/axum.rs
index b52c01d9ee..094cb2010e 100644
--- a/rust/cloud-storage/email/src/inbound/axum.rs
+++ b/rust/cloud-storage/email/src/inbound/axum.rs
@@ -2,6 +2,7 @@ mod api_types;
mod axum_impls;
mod draft_router;
mod get_thread_router;
+mod list_labels_router;
mod previews_router;
mod send_router;
mod thread_labels_router;
@@ -10,6 +11,7 @@ pub use api_types::*;
pub use axum_impls::*;
pub use draft_router::*;
pub use get_thread_router::*;
+pub use list_labels_router::*;
pub use previews_router::*;
pub use send_router::*;
pub use thread_labels_router::*;
diff --git a/rust/cloud-storage/email/src/inbound/axum/api_types/preview.rs b/rust/cloud-storage/email/src/inbound/axum/api_types/preview.rs
index a56f5a562b..45ea4f79c8 100644
--- a/rust/cloud-storage/email/src/inbound/axum/api_types/preview.rs
+++ b/rust/cloud-storage/email/src/inbound/axum/api_types/preview.rs
@@ -8,7 +8,7 @@ use utoipa::ToSchema;
use uuid::Uuid;
use crate::domain::models::{
- Attachment, Contact, EmailThreadPreview, EnrichedEmailThreadPreview, Label,
+ Attachment, Contact, EmailThreadPreview, EnrichedEmailThreadPreview, Label, LinkLabel,
};
use super::label::{ApiLabelListVisibility, ApiLabelType, ApiMessageListVisibility};
@@ -103,6 +103,21 @@ pub struct ApiLabel {
type_: ApiLabelType,
}
+impl From<LinkLabel> for ApiLabel {
+ fn from(l: LinkLabel) -> Self {
+ Self {
+ id: l.id,
+ link_id: l.link_id,
+ provider_label_id: l.provider_label_id,
+ name: l.name,
+ created_at: l.created_at,
+ message_list_visibility: l.message_list_visibility.into(),
+ label_list_visibility: l.label_list_visibility.into(),
+ type_: l.type_.into(),
+ }
+ }
+}
+
#[derive(Debug, ToSchema, Serialize, Deserialize)]
#[cfg_attr(feature = "ai_schema", derive(schemars::JsonSchema))]
pub struct ApiPaginatedThreadCursor {
diff --git a/rust/cloud-storage/email/src/inbound/axum/list_labels_router.rs b/rust/cloud-storage/email/src/inbound/axum/list_labels_router.rs
new file mode 100644
index 0000000000..a7e948656a
--- /dev/null
+++ b/rust/cloud-storage/email/src/inbound/axum/list_labels_router.rs
@@ -0,0 +1,73 @@
+use axum::{Json, Router, extract::State, http::StatusCode, response::IntoResponse, routing::get};
+use axum_extra::extract::Cached;
+use model_error_response::ErrorResponse;
+use thiserror::Error;
+
+use crate::domain::{models::EmailErr, ports::EmailService};
+
+use super::{ApiLabel, EmailLinkExtractor, EmailRouterState};
+
+/// Response body for listing labels.
+#[derive(serde::Serialize, serde::Deserialize, Debug, utoipa::ToSchema)]
+pub struct ListLabelsResponse {
+ pub labels: Vec<ApiLabel>,
+}
+
+/// Errors from the list labels handler.
+#[derive(Debug, Error)]
+pub enum ListLabelsError {
+ /// Internal error.
+ #[error("Internal error")]
+ Internal(EmailErr),
+}
+
+impl IntoResponse for ListLabelsError {
+ fn into_response(self) -> axum::response::Response {
+ tracing::error!(error=?self, "list labels error");
+ let message = self.to_string();
+ (
+ StatusCode::INTERNAL_SERVER_ERROR,
+ Json(ErrorResponse { message: &message }),
+ )
+ .into_response()
+ }
+}
+
+impl From<EmailErr> for ListLabelsError {
+ fn from(err: EmailErr) -> Self {
+ ListLabelsError::Internal(err)
+ }
+}
+
+/// Create the list labels router with a `GET /` handler.
+pub fn list_labels_router<S, T>() -> Router<S>
+where
+ S: Send + Sync + Clone + 'static,
+ T: EmailService,
+ EmailRouterState<T>: axum::extract::FromRef<S>,
+{
+ Router::new().route("/", get(list_labels_handler::<T>))
+}
+
+/// List all labels for the user's email link.
+#[utoipa::path(
+ get,
+ tag = "Labels",
+ path = "/email/labels",
+ operation_id = "list_labels",
+ responses(
+ (status = 200, body = ListLabelsResponse),
+ (status = 401, body = ErrorResponse),
+ (status = 500, body = ErrorResponse),
+ )
+)]
+#[tracing::instrument(err, skip_all)]
+pub async fn list_labels_handler<T: EmailService>(
+ State(state): State<EmailRouterState<T>>,
+ Cached(EmailLinkExtractor(link, _)): Cached<EmailLinkExtractor<T>>,
+) -> Result<Json<ListLabelsResponse>, ListLabelsError> {
+ let labels = state.inner.list_labels(&link).await?;
+ Ok(Json(ListLabelsResponse {
+ labels: labels.into_iter().map(Into::into).collect(),
+ }))
+}
diff --git a/rust/cloud-storage/email/src/outbound/email_pg_repo/label.rs b/rust/cloud-storage/email/src/outbound/email_pg_repo/label.rs
index f2ccc90111..a61a3e5eb3 100644
--- a/rust/cloud-storage/email/src/outbound/email_pg_repo/label.rs
+++ b/rust/cloud-storage/email/src/outbound/email_pg_repo/label.rs
@@ -102,6 +102,35 @@ impl From<SimpleMessageDbRow> for SimpleMessage {
}
}
+#[tracing::instrument(skip(pool), err)]
+pub(crate) async fn list_labels_by_link_id(
+ pool: &PgPool,
+ link_id: Uuid,
+) -> Result<Vec<LinkLabel>, sqlx::Error> {
+ let rows: Vec<LinkLabelDbRow> = sqlx::query_as!(
+ LinkLabelDbRow,
+ r#"
+ SELECT
+ id,
+ link_id,
+ provider_label_id,
+ name,
+ created_at,
+ message_list_visibility as "message_list_visibility: _",
+ label_list_visibility as "label_list_visibility: _",
+ type as "type_: _"
+ FROM email_labels
+ WHERE link_id = $1
+ ORDER BY name
+ "#,
+ link_id
+ )
+ .fetch_all(pool)
+ .await?;
+
+ Ok(rows.into_iter().map(Into::into).collect())
+}
+
#[tracing::instrument(skip(pool), err)]
pub(crate) async fn get_label_by_id(
pool: &PgPool,
diff --git a/rust/cloud-storage/email/src/outbound/email_pg_repo/mod.rs b/rust/cloud-storage/email/src/outbound/email_pg_repo/mod.rs
index 82813adb48..80b2da5361 100644
--- a/rust/cloud-storage/email/src/outbound/email_pg_repo/mod.rs
+++ b/rust/cloud-storage/email/src/outbound/email_pg_repo/mod.rs
@@ -225,4 +225,8 @@ impl EmailRepo for EmailPgRepo {
label::update_message_starred_status_batch(&self.pool, message_ids, link_id, is_starred)
.await
}
+
+ async fn list_labels_by_link_id(&self, link_id: Uuid) -> Result<Vec<LinkLabel>, Self::Err> {
+ label::list_labels_by_link_id(&self.pool, link_id).await
+ }
}
diff --git a/rust/cloud-storage/email/src/outbound/email_pg_repo/test/labels.rs b/rust/cloud-storage/email/src/outbound/email_pg_repo/test/labels.rs
index 7891bc6fd9..98ea3f43b7 100644
--- a/rust/cloud-storage/email/src/outbound/email_pg_repo/test/labels.rs
+++ b/rust/cloud-storage/email/src/outbound/email_pg_repo/test/labels.rs
@@ -1,4 +1,92 @@
use super::*;
+use crate::domain::models::{LabelListVisibility, LabelType, MessageListVisibility};
+
+// ── list_labels_by_link_id ──────────────────────────────────────────
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../../fixtures", scripts("email_thread_labels"))
+)]
+async fn test_list_labels_by_link_id_returns_all_labels(
+ pool: Pool<Postgres>,
+) -> anyhow::Result<()> {
+ let repo = EmailPgRepo::new(pool);
+ let link_id = Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")?;
+
+ let labels = repo.list_labels_by_link_id(link_id).await?;
+
+ // Fixture has 4 labels for this link: INBOX, UNREAD, STARRED, MyCustomLabel
+ assert_eq!(labels.len(), 4);
+
+ // Verify ordering by name
+ let names: Vec<&str> = labels.iter().map(|l| l.name.as_str()).collect();
+ assert_eq!(names, vec!["INBOX", "MyCustomLabel", "STARRED", "UNREAD"]);
+
+ Ok(())
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../../fixtures", scripts("email_thread_labels"))
+)]
+async fn test_list_labels_by_link_id_field_mapping(pool: Pool<Postgres>) -> anyhow::Result<()> {
+ let repo = EmailPgRepo::new(pool);
+ let link_id = Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")?;
+
+ let labels = repo.list_labels_by_link_id(link_id).await?;
+ let inbox = labels.iter().find(|l| l.name == "INBOX").unwrap();
+
+ assert_eq!(
+ inbox.id,
+ Uuid::parse_str("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb")?
+ );
+ assert_eq!(inbox.link_id, link_id);
+ assert_eq!(inbox.provider_label_id, "INBOX");
+ assert_eq!(inbox.message_list_visibility, MessageListVisibility::Show);
+ assert_eq!(inbox.label_list_visibility, LabelListVisibility::LabelShow);
+ assert_eq!(inbox.type_, LabelType::System);
+
+ let custom = labels.iter().find(|l| l.name == "MyCustomLabel").unwrap();
+ assert_eq!(custom.provider_label_id, "Label_123");
+ assert_eq!(custom.type_, LabelType::User);
+
+ Ok(())
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../../fixtures", scripts("email_thread_labels"))
+)]
+async fn test_list_labels_by_link_id_isolates_by_link(pool: Pool<Postgres>) -> anyhow::Result<()> {
+ let repo = EmailPgRepo::new(pool);
+ let other_link_id = Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb")?;
+
+ let labels = repo.list_labels_by_link_id(other_link_id).await?;
+
+ // The other link has only 1 label in the fixture
+ assert_eq!(labels.len(), 1);
+ assert_eq!(labels[0].name, "INBOX");
+ assert_eq!(labels[0].link_id, other_link_id);
+
+ Ok(())
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../../fixtures", scripts("email_thread_labels"))
+)]
+async fn test_list_labels_by_link_id_nonexistent_link(pool: Pool<Postgres>) -> anyhow::Result<()> {
+ let repo = EmailPgRepo::new(pool);
+ let fake_link_id = Uuid::parse_str("99999999-9999-9999-9999-999999999999")?;
+
+ let labels = repo.list_labels_by_link_id(fake_link_id).await?;
+
+ assert!(labels.is_empty());
+
+ Ok(())
+}
+
+// ── labels_by_thread_ids ────────────────────────────────────────────
#[sqlx::test(
migrator = "MACRO_DB_MIGRATIONS",
diff --git a/rust/cloud-storage/email_service/src/api/email/labels/list.rs b/rust/cloud-storage/email_service/src/api/email/labels/list.rs
deleted file mode 100644
index ec041430d1..0000000000
--- a/rust/cloud-storage/email_service/src/api/email/labels/list.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-use crate::api::context::ApiContext;
-use axum::extract::State;
-use axum::http::StatusCode;
-use axum::response::{IntoResponse, Response};
-use axum::{Extension, Json};
-use model::response::ErrorResponse;
-use model::user::UserContext;
-use models_email::service;
-use models_email::service::link::Link;
-use utoipa::ToSchema;
-
-#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema)]
-pub struct ListLabelsResponse {
- pub labels: Vec<service::label::Label>,
-}
-
-/// List user labels.
-#[utoipa::path(
- get,
- tag = "Labels",
- path = "/email/labels",
- operation_id = "list_labels",
- responses(
- (status = 200, body=ListLabelsResponse),
- (status = 400, body=ErrorResponse),
- (status = 401, body=ErrorResponse),
- (status = 500, body=ErrorResponse),
- )
-)]
-#[tracing::instrument(skip(ctx, user_context, link), fields(user_id=user_context.user_id, fusionauth_user_id=user_context.fusion_user_id))]
-pub async fn handler(
- State(ctx): State<ApiContext>,
- user_context: Extension<UserContext>,
- link: Extension<Link>,
-) -> Result<Response, Response> {
- let labels = email_db_client::labels::get::fetch_labels_by_link_id(&ctx.db, link.id)
- .await
- .map_err(|e| {
- tracing::error!(error=?e, "unable to fetch labels");
- (
- StatusCode::INTERNAL_SERVER_ERROR,
- Json(ErrorResponse {
- message: "unable to fetch labels",
- }),
- )
- .into_response()
- })?;
-
- Ok((StatusCode::OK, Json(ListLabelsResponse { labels })).into_response())
-}
diff --git a/rust/cloud-storage/email_service/src/api/email/labels/mod.rs b/rust/cloud-storage/email_service/src/api/email/labels/mod.rs
index 8b1c28ddc3..b728edae09 100644
--- a/rust/cloud-storage/email_service/src/api/email/labels/mod.rs
+++ b/rust/cloud-storage/email_service/src/api/email/labels/mod.rs
@@ -1,13 +1,15 @@
pub mod create;
pub mod delete;
-pub mod list;
use axum::Router;
-use axum::routing::{delete, get, post};
+use axum::routing::{delete, post};
use crate::api::ApiContext;
pub fn router(state: ApiContext) -> Router<ApiContext> {
+ let hex_list_labels_routes =
+ email::inbound::list_labels_router::<ApiContext, crate::api::context::EmailSvc>();
+
Router::new()
.route("/", post(create::handler))
.route("/:id", delete(delete::handler))
@@ -15,9 +17,9 @@ pub fn router(state: ApiContext) -> Router<ApiContext> {
state.clone(),
crate::api::middleware::gmail_token::attach_gmail_token,
))
- .route("/", get(list::handler))
.layer(axum::middleware::from_fn_with_state(
state.email_service,
crate::api::middleware::link::attach_link_context,
))
+ .merge(hex_list_labels_routes)
}
diff --git a/rust/cloud-storage/email_service/src/api/swagger.rs b/rust/cloud-storage/email_service/src/api/swagger.rs
index f4b4efc690..d693ae6161 100644
--- a/rust/cloud-storage/email_service/src/api/swagger.rs
+++ b/rust/cloud-storage/email_service/src/api/swagger.rs
@@ -12,13 +12,13 @@ use crate::api::email::drafts::add_forwarded_attachment::{
use crate::api::email::init::InitResponse;
use crate::api::email::labels::create::CreateLabelRequest;
use crate::api::email::labels::create::CreateLabelResponse;
-use crate::api::email::labels::list::ListLabelsResponse;
use crate::api::email::links::list::ListLinksResponse;
use crate::api::email::messages::labels::{UpdateLabelBatchRequest, UpdateLabelBatchResponse};
use crate::api::email::settings::patch::{PatchSettingsRequest, PatchSettingsResponse};
use crate::api::email::threads::archived::ArchiveThreadRequest;
use crate::api::{email, health};
use ::email::inbound;
+use ::email::inbound::ListLabelsResponse as HexListLabelsResponse;
use ::email::inbound::{
ApiDraftContactInfo, ApiDraftInput, ApiDraftOutput, ApiPaginatedThreadCursor, ApiSortMethod,
ApiThread, CreateDraftRequest as HexCreateDraftRequest,
@@ -73,7 +73,7 @@ use utoipa::OpenApi;
email::links::list::list_links_handler,
email::labels::create::handler,
email::labels::delete::handler,
- email::labels::list::handler,
+ inbound::list_labels_handler,
email::contacts::list::list_contacts_handler,
email::sync::disable::disable_handler,
email::settings::patch::patch_settings_handler,
@@ -101,7 +101,7 @@ use utoipa::OpenApi;
// Label types
CreateLabelRequest,
CreateLabelResponse,
- ListLabelsResponse,
+ HexListLabelsResponse,
Label,
// Message types
UpdateLabelBatchRequest,
diff --git a/rust/cloud-storage/soup/src/domain/service/tests.rs b/rust/cloud-storage/soup/src/domain/service/tests.rs
index 8e26d72886..a587db0fb3 100644
--- a/rust/cloud-storage/soup/src/domain/service/tests.rs
+++ b/rust/cloud-storage/soup/src/domain/service/tests.rs
@@ -72,6 +72,13 @@ impl EmailService for NoopEmailService {
Err(EmailErr::RepoErr(anyhow::anyhow!("not implemented")))
}
+ async fn list_labels(
+ &self,
+ _link: &email::domain::models::Link,
+ ) -> Result<Vec<email::domain::models::LinkLabel>, EmailErr> {
+ Err(EmailErr::RepoErr(anyhow::anyhow!("not implemented")))
+ }
+
async fn update_thread_labels(
&self,
_access_token: &str,
diff --git a/rust/cloud-storage/soup/src/inbound/axum_router/tests.rs b/rust/cloud-storage/soup/src/inbound/axum_router/tests.rs
index 6b518916f3..951ac2afbc 100644
--- a/rust/cloud-storage/soup/src/inbound/axum_router/tests.rs
+++ b/rust/cloud-storage/soup/src/inbound/axum_router/tests.rs
@@ -116,6 +116,13 @@ impl EmailService for MockEmail {
Err(EmailErr::RepoErr(anyhow::anyhow!("Not implemented")))
}
+ async fn list_labels(
+ &self,
+ _link: &email::domain::models::Link,
+ ) -> Result<Vec<email::domain::models::LinkLabel>, EmailErr> {
+ Err(EmailErr::RepoErr(anyhow::anyhow!("Not implemented")))
+ }
+
async fn update_thread_labels(
&self,
_access_token: &str,
@@ -215,6 +222,13 @@ impl EmailService for MockEmailLinkResult {
Err(EmailErr::RepoErr(anyhow::anyhow!("Not implemented")))
}
+ async fn list_labels(
+ &self,
+ _link: &email::domain::models::Link,
+ ) -> Result<Vec<email::domain::models::LinkLabel>, EmailErr> {
+ Err(EmailErr::RepoErr(anyhow::anyhow!("Not implemented")))
+ }
+
async fn update_thread_labels(
&self,
_access_token: &str,