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.

1.9 KB
Raw Blame
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

use crate::document::FileType;

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ConvertRequest {
    /// The bucket of the current item
    pub from_bucket: String,
    /// The destination bucket of the current item
    pub to_bucket: String,
    /// The key of the current item we are converting
    pub from_key: String,
    /// The destination key of the current item we are converting
    pub to_key: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConvertQueueMessage {
    /// The job id that was generaeted for this conversion
    /// Used for basic log tracking
    pub job_id: String,
    /// The bucket of the current item
    pub from_bucket: String,
    /// The destination bucket of the current item
    pub to_bucket: String,
    /// The key of the current item we are converting
    pub from_key: String,
    /// The destination key of the current item we are converting
    pub to_key: String,
    /// The source file type, for keys without an extension such as
    /// versioned document keys. Falls back to the `from_key` extension.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub from_file_type: Option<FileType>,
    /// The target file type. Falls back to the `to_key` extension.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub to_file_type: Option<FileType>,
    /// Whether a client job is tracking `job_id`, so the convert service
    /// should report the conversion's outcome to the job update handler.
    /// Producers that mint their own id must set this to `false`: the handler
    /// rejects updates for unknown jobs, and Lambda retries each rejection.
    /// Defaults to `true` for messages from producers that predate the field.
    #[serde(default = "notify_job_default")]
    pub notify_job: bool,
}

fn notify_job_default() -> bool {
    true
}