Skip to main content

rebuilderd_common/api/v1/models/
package.rs

1use crate::api::v1::{ArtifactStatus, BuildStatus};
2use chrono::NaiveDateTime;
3#[cfg(feature = "diesel")]
4use diesel::Queryable;
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
8pub struct PackageReport {
9    pub distribution: String,
10    pub release: Option<String>,
11    pub component: Option<String>,
12    pub architecture: String,
13    pub packages: Vec<SourcePackageReport>,
14}
15
16#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
17pub struct SourcePackageReport {
18    pub name: String,
19    pub version: String,
20    pub url: String,
21    pub artifacts: Vec<BinaryPackageReport>,
22}
23
24#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
25pub struct BinaryPackageReport {
26    pub name: String,
27    pub version: String,
28    pub architecture: String,
29    pub url: String,
30}
31
32#[derive(Debug, Serialize, Deserialize)]
33#[cfg_attr(feature = "diesel", derive(Queryable))]
34#[cfg_attr(feature = "diesel", diesel(check_for_backend(diesel::sqlite::Sqlite)))]
35pub struct SourcePackage {
36    pub id: i32,
37    pub name: String,
38    pub version: String,
39    pub distribution: String,
40    pub release: Option<String>,
41    pub component: Option<String>,
42    pub status: Option<BuildStatus>,
43    pub build_id: Option<i32>,
44    pub last_seen: NaiveDateTime,
45    pub seen_in_last_sync: bool,
46}
47
48#[derive(Debug, Serialize, Deserialize)]
49#[cfg_attr(feature = "diesel", derive(Queryable))]
50#[cfg_attr(feature = "diesel", diesel(check_for_backend(diesel::sqlite::Sqlite)))]
51pub struct BinaryPackage {
52    pub id: i32,
53    pub name: String,
54    pub version: String,
55    pub distribution: String,
56    pub release: Option<String>,
57    pub component: Option<String>,
58    pub architecture: String,
59    pub url: String,
60    pub status: Option<ArtifactStatus>,
61    pub build_id: Option<i32>,
62    pub artifact_id: Option<i32>,
63    pub diffoscope_log_id: Option<i32>,
64    pub attestation_log_id: Option<i32>,
65    pub last_seen: NaiveDateTime,
66    pub seen_in_last_sync: bool,
67}