Files
pruefwerk/compliance-core/src/models/project.rs
T
sharang 202f5ea325
CI / Check (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Docs (push) Skipped
CI / Deploy MCP (push) Successful in 4m18s
CI / Deploy Dashboard (push) Successful in 5m59s
CI / Deploy Agent (push) Successful in 7m20s
feat(projects): assign targets to the tenant's projects (#427)
2026-09-29 14:13:01 +00:00

47 lines
1.3 KiB
Rust

//! A tenant's projects, owned by the platform registry.
//!
//! A project groups targets organisationally: a customer's product or
//! machine, or a topic such as the CRA or the Data Act. It never changes what
//! gets checked. Targets refer to projects by the registry's id.
use serde::{Deserialize, Serialize};
/// What a project stands for.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ProjectKind {
/// A customer's product or machine.
Product,
/// A topic such as the CRA or the Data Act.
Topic,
}
/// One of a tenant's projects, as the registry lists it
/// (`GET /v1/tenants/{id}/projects`).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Project {
/// The registry's id (a UUID).
pub id: String,
pub name: String,
pub kind: ProjectKind,
#[serde(default)]
pub description: String,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn a_registry_project_reads() {
let p: Project = serde_json::from_value(serde_json::json!({
"id": "0b7d51aa-9f1c-4e33-8a1f-2d8c1e0f9a77",
"name": "Rangierlok 3000",
"kind": "product"
}))
.expect("deserialize");
assert_eq!(p.kind, ProjectKind::Product);
assert_eq!(p.description, "");
}
}