d1e92b32fb
Features:
- Cover page generation using Python/Pillow with Apple PingFang font
- CLI commands: cover-create, job-cover for cover page management
- API endpoints: PUT /api/fax/jobs/{id}/cover for cover modification
- Send fax with cover page: --to, --from, --subject, --note options
- Multi-page TIFF parsing for PDF conversion (fix: all pages now sent)
- Preview HTML generation with pan/zoom support
- OCR verification for cover page content
- Class 2 receive support for incoming faxes
Fixes:
- Modem initialization before Class 2 mode entry
- Dial timeout handling with retry logic
- Multi-page fax transmission between pages
- Chinese character rendering in cover pages (Apple native fonts)
52 lines
1.2 KiB
Rust
52 lines
1.2 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
pub type JobId = Uuid;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub enum JobStatus {
|
|
Queued,
|
|
Dialing,
|
|
Sending,
|
|
Completed,
|
|
Failed(String),
|
|
Cancelled,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct FaxJob {
|
|
pub id: JobId,
|
|
pub recipient: String,
|
|
pub document_path: String,
|
|
pub status: JobStatus,
|
|
pub pages: u32,
|
|
pub retries: u8,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
pub cover_to: Option<String>,
|
|
pub cover_from: Option<String>,
|
|
pub cover_subject: Option<String>,
|
|
pub cover_notes: Option<String>,
|
|
}
|
|
|
|
impl FaxJob {
|
|
pub fn new(recipient: String, document_path: String) -> Self {
|
|
let now = Utc::now();
|
|
Self {
|
|
id: Uuid::new_v4(),
|
|
recipient,
|
|
document_path,
|
|
status: JobStatus::Queued,
|
|
pages: 0,
|
|
retries: 0,
|
|
created_at: now,
|
|
updated_at: now,
|
|
cover_to: None,
|
|
cover_from: None,
|
|
cover_subject: None,
|
|
cover_notes: None,
|
|
}
|
|
}
|
|
}
|