Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
pub(crate) mod add_attachment;
pub(crate) mod add_forwarded_attachment;
pub(crate) mod attachment_error;
pub(crate) mod complete_attachment;
pub(crate) mod delete;
pub(crate) mod remove_attachment;
pub(crate) mod remove_forwarded_attachment;
pub(crate) mod scheduled;
pub(crate) mod transfer;
use crate::api::ApiContext;
use axum::Router;
use axum::routing::{delete, post};
use email::inbound::axum::draft_router::draft_router;
pub fn router(state: ApiContext) -> Router<ApiContext> {
Router::new()
.merge(draft_router::<
ApiContext,
crate::api::context::EmailSvc,
crate::api::context::AuthorizationService,
>())
.nest("/scheduled", scheduled::router())
.route("/{id}", delete(delete::handler))
.route("/{id}/attachments", post(add_attachment::handler))
.route("/{id}/transfer", post(transfer::handler))
.route(
"/{id}/attachments/{attachment_id}/complete",
post(complete_attachment::handler),
)
.route(
"/{id}/attachments/{attachment_id}",
delete(remove_attachment::handler),
)
.route(
"/{id}/forwarded-attachments",
post(add_forwarded_attachment::handler),
)
.route(
"/{id}/forwarded-attachments/{attachment_id}",
delete(remove_forwarded_attachment::handler),
)
.layer(axum::middleware::from_fn_with_state(
state.clone(),
crate::api::middleware::link::attach_link_context,
))
}
/// generate an S3 key for an attachment based on the draft_id and attachment_id.
#[macro_export]
macro_rules! generate_attachment_s3_key {
($draft_id:expr, $attachment_id:expr) => {
format!("draft/{}/{}", $draft_id, $attachment_id)
};
}