aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/database_models.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-12-26 15:16:03 -0800
committerBryan Newbold <bnewbold@robocracy.org>2018-12-26 15:16:06 -0800
commit1e2dd5ce2d2afa1016366f9296c90759c54be623 (patch)
tree7fda85cd02d86938dc5fd5dab85971def136c60a /rust/src/database_models.rs
parent8e179c13a28b0f647b76fc05c5d6b25522866882 (diff)
downloadfatcat-1e2dd5ce2d2afa1016366f9296c90759c54be623.tar.gz
fatcat-1e2dd5ce2d2afa1016366f9296c90759c54be623.zip
fileset/web basic implementation
As well as small consistency and bugfix implementations. No new tests yet...
Diffstat (limited to 'rust/src/database_models.rs')
-rw-r--r--rust/src/database_models.rs155
1 files changed, 151 insertions, 4 deletions
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs
index 2431e0fe..c913b98e 100644
--- a/rust/src/database_models.rs
+++ b/rust/src/database_models.rs
@@ -209,7 +209,7 @@ pub struct FileRevUrlNewRow {
pub struct FileRevRow {
pub id: Uuid,
pub extra_json: Option<serde_json::Value>,
- pub size: Option<i64>,
+ pub size_bytes: Option<i64>,
pub sha1: Option<String>,
pub sha256: Option<String>,
pub md5: Option<String>,
@@ -220,7 +220,7 @@ pub struct FileRevRow {
#[table_name = "file_rev"]
pub struct FileRevNewRow {
pub extra_json: Option<serde_json::Value>,
- pub size: Option<i64>,
+ pub size_bytes: Option<i64>,
pub sha1: Option<String>,
pub sha256: Option<String>,
pub md5: Option<String>,
@@ -237,6 +237,139 @@ entity_structs!(
);
#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
+#[table_name = "fileset_rev_file"]
+pub struct FilesetRevFileRow {
+ pub id: i64,
+ pub fileset_rev: Uuid,
+ pub path_name: String,
+ pub size_bytes: i64,
+ pub md5: Option<String>,
+ pub sha1: Option<String>,
+ pub sha256: Option<String>,
+ pub extra_json: Option<serde_json::Value>,
+}
+
+#[derive(Debug, Queryable, Associations, AsChangeset, Insertable)]
+#[table_name = "fileset_rev_file"]
+pub struct FilesetRevFileNewRow {
+ pub fileset_rev: Uuid,
+ pub path_name: String,
+ pub size_bytes: i64,
+ pub md5: Option<String>,
+ pub sha1: Option<String>,
+ pub sha256: Option<String>,
+ pub extra_json: Option<serde_json::Value>,
+}
+
+#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
+#[table_name = "fileset_rev_url"]
+pub struct FilesetRevUrlRow {
+ pub id: i64,
+ pub fileset_rev: Uuid,
+ pub rel: String,
+ pub url: String,
+}
+
+#[derive(Debug, Queryable, Associations, AsChangeset, Insertable)]
+#[table_name = "fileset_rev_url"]
+pub struct FilesetRevUrlNewRow {
+ pub fileset_rev: Uuid,
+ pub rel: String,
+ pub url: String,
+}
+
+#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
+#[table_name = "fileset_rev"]
+pub struct FilesetRevRow {
+ pub id: Uuid,
+ pub extra_json: Option<serde_json::Value>,
+}
+
+#[derive(Debug, Associations, AsChangeset, Insertable)]
+#[table_name = "fileset_rev"]
+pub struct FilesetRevNewRow {
+ pub extra_json: Option<serde_json::Value>,
+}
+
+entity_structs!(
+ "fileset_edit",
+ FilesetEditRow,
+ FilesetEditNewRow,
+ "fileset_ident",
+ FilesetIdentRow,
+ FilesetIdentNewRow
+);
+#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
+#[table_name = "webcapture_rev_cdx"]
+pub struct WebcaptureRevCdxRow {
+ pub id: i64,
+ pub webcapture_rev: Uuid,
+ pub surt: String,
+ pub timestamp: i64,
+ pub url: String,
+ pub mimetype: Option<String>,
+ pub status_code: i64,
+ pub sha1: String,
+ pub sha256: Option<String>,
+}
+
+#[derive(Debug, Queryable, Associations, AsChangeset, Insertable)]
+#[table_name = "webcapture_rev_cdx"]
+pub struct WebcaptureRevCdxNewRow {
+ pub webcapture_rev: Uuid,
+ pub surt: String,
+ pub timestamp: i64,
+ pub url: String,
+ pub mimetype: Option<String>,
+ pub status_code: i64,
+ pub sha1: String,
+ pub sha256: Option<String>,
+}
+
+#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
+#[table_name = "webcapture_rev_url"]
+pub struct WebcaptureRevUrlRow {
+ pub id: i64,
+ pub webcapture_rev: Uuid,
+ pub rel: String,
+ pub url: String,
+}
+
+#[derive(Debug, Queryable, Associations, AsChangeset, Insertable)]
+#[table_name = "webcapture_rev_url"]
+pub struct WebcaptureRevUrlNewRow {
+ pub webcapture_rev: Uuid,
+ pub rel: String,
+ pub url: String,
+}
+
+#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
+#[table_name = "webcapture_rev"]
+pub struct WebcaptureRevRow {
+ pub id: Uuid,
+ pub extra_json: Option<serde_json::Value>,
+ pub original_url: String,
+ pub timestamp: chrono::NaiveDateTime,
+}
+
+#[derive(Debug, Associations, AsChangeset, Insertable)]
+#[table_name = "webcapture_rev"]
+pub struct WebcaptureRevNewRow {
+ pub extra_json: Option<serde_json::Value>,
+ pub original_url: String,
+ pub timestamp: chrono::NaiveDateTime,
+}
+
+entity_structs!(
+ "webcapture_edit",
+ WebcaptureEditRow,
+ WebcaptureEditNewRow,
+ "webcapture_ident",
+ WebcaptureIdentRow,
+ WebcaptureIdentNewRow
+);
+
+#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
#[table_name = "release_rev"]
pub struct ReleaseRevRow {
pub id: Uuid,
@@ -388,13 +521,27 @@ pub struct ReleaseRefNewRow {
}
#[derive(Debug, Queryable, Insertable, Associations, AsChangeset)]
-#[table_name = "file_release"]
-pub struct FileReleaseRow {
+#[table_name = "file_rev_release"]
+pub struct FileRevReleaseRow {
pub file_rev: Uuid,
pub target_release_ident_id: Uuid,
}
#[derive(Debug, Queryable, Insertable, Associations, AsChangeset)]
+#[table_name = "fileset_rev_release"]
+pub struct FilesetRevReleaseRow {
+ pub fileset_rev: Uuid,
+ pub target_release_ident_id: Uuid,
+}
+
+#[derive(Debug, Queryable, Insertable, Associations, AsChangeset)]
+#[table_name = "webcapture_rev_release"]
+pub struct WebcaptureRevReleaseRow {
+ pub webcapture_rev: Uuid,
+ pub target_release_ident_id: Uuid,
+}
+
+#[derive(Debug, Queryable, Insertable, Associations, AsChangeset)]
#[table_name = "abstracts"]
pub struct AbstractsRow {
pub sha1: String,