Remove superseded Material/PrintParameters/PrintJob/Template mirrors

They described the old flat continuum/v1 shape, replaced by the
material/printer/vendor restructure. Nothing outside this repo imported
them (checked continuum-proxy, continuum-ai-worker, continuum-backend,
continuum-app). Left both packages in place as empty shells - add a
hand-written mirror back per new schema file once something actually
consumes it.
This commit is contained in:
2026-09-05 20:54:30 +00:00
parent b35fdf9e6a
commit f94e59a981
17 changed files with 14 additions and 313 deletions
+5 -80
View File
@@ -1,80 +1,5 @@
// Hand-written structs mirroring the JSON Schemas in `schemas/continuum/v1/`
// and the TypeBox schemas in `ts-types/src/schemas/` - this used to be
// prost-generated from `.proto` sources, but nothing here needed protobuf's
// actual value (cross-language binary codegen): both consumers (this crate
// and ts-types) only ever exchange JSON, so a hand-synced struct is less
// machinery than a `protoc`/`prost-build` pipeline for the same three
// flat DTOs. Keep field names and the `PrintJobStatus` string values in
// sync with `ts-types/src/schemas/` by hand when either side changes.
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MaterialProfile {
pub id: String,
pub name: String,
pub filament_type: String,
pub nozzle_temp_c: f64,
pub bed_temp_c: f64,
pub density_g_cm3: f64,
pub color_hex: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PrintParameters {
pub layer_height_mm: f64,
pub infill_percent: i32,
pub infill_pattern: String,
pub print_speed_mm_s: f64,
pub supports_enabled: bool,
pub wall_count: i32,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Template {
pub id: String,
pub name: String,
pub description: String,
pub owner_id: String,
pub model_file_key: String,
pub material: MaterialProfile,
pub print_parameters: PrintParameters,
pub created_at_unix: i64,
pub updated_at_unix: i64,
pub tags: Vec<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum PrintJobStatus {
#[serde(rename = "PRINT_JOB_STATUS_UNSPECIFIED")]
Unspecified,
#[serde(rename = "PRINT_JOB_STATUS_QUEUED")]
Queued,
#[serde(rename = "PRINT_JOB_STATUS_PRINTING")]
Printing,
#[serde(rename = "PRINT_JOB_STATUS_PAUSED")]
Paused,
#[serde(rename = "PRINT_JOB_STATUS_COMPLETED")]
Completed,
#[serde(rename = "PRINT_JOB_STATUS_FAILED")]
Failed,
#[serde(rename = "PRINT_JOB_STATUS_CANCELLED")]
Cancelled,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PrintJob {
pub id: String,
pub farm_id: String,
pub printer_id: String,
pub template_id: String,
pub status: PrintJobStatus,
pub progress_percent: f64,
pub started_at_unix: i64,
pub completed_at_unix: i64,
pub gcode_file_key: String,
}
//! The old MaterialProfile/PrintParameters/PrintJob/Template structs were
//! removed (2026-09) when schemas/continuum/v1/ was restructured into
//! material/printer/vendor - see that directory and its README. Add a
//! hand-written serde struct here per file under schemas/continuum/v1/
//! once something actually consumes it, same convention as before.
@@ -1,31 +0,0 @@
use continuum_types::{PrintJob, PrintJobStatus};
fn sample(status: PrintJobStatus) -> PrintJob {
PrintJob {
id: "job-1".into(),
farm_id: "farm-1".into(),
printer_id: "printer-1".into(),
template_id: "template-1".into(),
status,
progress_percent: 50.0,
started_at_unix: 0,
completed_at_unix: 0,
gcode_file_key: "key".into(),
}
}
// Regression test: PrintJob.status must serialize as the full name string
// (matching ts-types' TypeBox schema), not a bare enum discriminant.
#[test]
fn status_serializes_as_full_proto_enum_name() {
let json = serde_json::to_value(sample(PrintJobStatus::Printing)).unwrap();
assert_eq!(json["status"], "PRINT_JOB_STATUS_PRINTING");
}
#[test]
fn status_round_trips_through_json() {
let original = sample(PrintJobStatus::Completed);
let json = serde_json::to_string(&original).unwrap();
let restored: PrintJob = serde_json::from_str(&json).unwrap();
assert_eq!(restored.status, PrintJobStatus::Completed);
}