Skip to content

Commit

Permalink
Add updatedAt field to all remaining relevant structs and query strin…
Browse files Browse the repository at this point in the history
…gs (tested and working)
  • Loading branch information
rhigman committed Mar 19, 2021
1 parent 33933cb commit 9a8f169
Show file tree
Hide file tree
Showing 28 changed files with 78 additions and 0 deletions.
1 change: 1 addition & 0 deletions thoth-app/src/models/funder/create_funder_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const CREATE_FUNDER_MUTATION: &str = "
}){
funderId
funderName
updatedAt
}
}
";
Expand Down
1 change: 1 addition & 0 deletions thoth-app/src/models/funder/delete_funder_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const DELETE_FUNDER_MUTATION: &str = "
){
funderId
funderName
updatedAt
}
}
";
Expand Down
1 change: 1 addition & 0 deletions thoth-app/src/models/funder/funder_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub const FUNDER_QUERY: &str = "
funderId
funderName
funderDoi
updatedAt
}
}
";
Expand Down
1 change: 1 addition & 0 deletions thoth-app/src/models/funder/funders_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub const FUNDERS_QUERY: &str = "
funderId
funderName
funderDoi
updatedAt
}
funderCount(filter: $filter)
}
Expand Down
5 changes: 5 additions & 0 deletions thoth-app/src/models/funder/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use chrono::naive::NaiveDateTime;
use serde::Deserialize;
use serde::Serialize;
use yew::html;
Expand All @@ -14,6 +15,7 @@ pub struct Funder {
pub funder_id: String,
pub funder_name: String,
pub funder_doi: Option<String>,
pub updated_at: serde_json::Value,
}

impl Funder {
Expand Down Expand Up @@ -44,6 +46,8 @@ impl Funder {

pub fn as_table_row(&self, callback: Callback<MouseEvent>) -> Html {
let funder_doi = self.funder_doi.clone().unwrap_or_else(|| "".to_string());
let updated =
NaiveDateTime::from_timestamp(self.updated_at.as_f64().unwrap_or(0.0) as i64, 0);
html! {
<tr
class="row"
Expand All @@ -52,6 +56,7 @@ impl Funder {
<td>{&self.funder_id}</td>
<td>{&self.funder_name}</td>
<td>{funder_doi}</td>
<td>{updated}</td>
</tr>
}
}
Expand Down
1 change: 1 addition & 0 deletions thoth-app/src/models/funder/update_funder_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const UPDATE_FUNDER_MUTATION: &str = "
}){
funderId
funderName
updatedAt
}
}
";
Expand Down
1 change: 1 addition & 0 deletions thoth-app/src/models/funding/create_funding_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const CREATE_FUNDING_MUTATION: &str = "
funder {
funderId
funderName
updatedAt
}
}
}
Expand Down
1 change: 1 addition & 0 deletions thoth-app/src/models/imprint/create_imprint_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const CREATE_IMPRINT_MUTATION: &str = "
imprintId
imprintName
imprintUrl
updatedAt
publisher {
publisherId
publisherName
Expand Down
1 change: 1 addition & 0 deletions thoth-app/src/models/imprint/delete_imprint_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const DELETE_IMPRINT_MUTATION: &str = "
imprintId
imprintName
imprintUrl
updatedAt
publisher {
publisherId
publisherName
Expand Down
2 changes: 2 additions & 0 deletions thoth-app/src/models/imprint/imprint_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ pub const IMPRINT_QUERY: &str = "
imprintId
imprintName
imprintUrl
updatedAt
publisher {
publisherId
publisherName
publisherShortname
publisherUrl
updatedAt
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions thoth-app/src/models/imprint/imprints_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ const IMPRINTS_QUERY: &str = "
imprintId
imprintName
imprintUrl
updatedAt
publisher {
publisherId
publisherName
publisherShortname
publisherUrl
updatedAt
}
}
imprintCount(filter: $filter, publishers: $publishers)
Expand Down
6 changes: 6 additions & 0 deletions thoth-app/src/models/imprint/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use chrono::naive::NaiveDateTime;
use serde::Deserialize;
use serde::Serialize;
use yew::html;
Expand All @@ -15,6 +16,7 @@ pub struct Imprint {
pub imprint_id: String,
pub imprint_name: String,
pub imprint_url: Option<String>,
pub updated_at: serde_json::Value,
pub publisher: Publisher,
}

Expand All @@ -29,6 +31,8 @@ impl Imprint {

pub fn as_table_row(&self, callback: Callback<MouseEvent>) -> Html {
let imprint_url = self.imprint_url.clone().unwrap_or_else(|| "".to_string());
let updated =
NaiveDateTime::from_timestamp(self.updated_at.as_f64().unwrap_or(0.0) as i64, 0);
html! {
<tr
class="row"
Expand All @@ -38,6 +42,7 @@ impl Imprint {
<td>{&self.imprint_name}</td>
<td>{&self.publisher.publisher_name}</td>
<td>{imprint_url}</td>
<td>{updated}</td>
</tr>
}
}
Expand All @@ -49,6 +54,7 @@ impl Default for Imprint {
imprint_id: "".to_string(),
imprint_name: "".to_string(),
imprint_url: None,
updated_at: Default::default(),
publisher: Default::default(),
}
}
Expand Down
2 changes: 2 additions & 0 deletions thoth-app/src/models/imprint/update_imprint_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ const UPDATE_IMPRINT_MUTATION: &str = "
imprintId
imprintName
imprintUrl
updatedAt
publisher {
publisherId
publisherName
publisherShortname
publisherUrl
updatedAt
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions thoth-app/src/models/issue/create_issue_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ const CREATE_ISSUE_MUTATION: &str = "
issnPrint
issnDigital
seriesUrl
updatedAt
imprint {
imprintId
imprintName
updatedAt
publisher {
publisherId
publisherName
publisherShortname
publisherUrl
updatedAt
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions thoth-app/src/models/publication/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use chrono::naive::NaiveDateTime;
use serde::Deserialize;
use serde::Serialize;
use thoth_api::publication::model::PublicationType;
Expand Down Expand Up @@ -68,6 +69,8 @@ impl crate::models::publication::publications_query::DetailedPublication {
.publication_url
.clone()
.unwrap_or_else(|| "".to_string());
let updated =
NaiveDateTime::from_timestamp(self.updated_at.as_f64().unwrap_or(0.0) as i64, 0);
html! {
<tr
class="row"
Expand All @@ -80,6 +83,7 @@ impl crate::models::publication::publications_query::DetailedPublication {
<td>{&self.publication_type}</td>
<td>{isbn}</td>
<td>{publication_url}</td>
<td>{updated}</td>
</tr>
}
}
Expand Down
5 changes: 5 additions & 0 deletions thoth-app/src/models/publication/publications_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub const PUBLICATIONS_QUERY: &str = "
workId
isbn
publicationUrl
updatedAt
work {
workId
workType
Expand All @@ -22,14 +23,17 @@ pub const PUBLICATIONS_QUERY: &str = "
title
edition
copyrightHolder
updatedAt
imprint {
imprintId
imprintName
updatedAt
publisher {
publisherId
publisherName
publisherShortname
publisherUrl
updatedAt
}
}
}
Expand Down Expand Up @@ -67,6 +71,7 @@ pub struct DetailedPublication {
pub work_id: String,
pub isbn: Option<String>,
pub publication_url: Option<String>,
pub updated_at: serde_json::Value,
pub work: Work,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const CREATE_PUBLISHER_MUTATION: &str = "
}){
publisherId
publisherName
updatedAt
}
}
";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const DELETE_PUBLISHER_MUTATION: &str = "
){
publisherId
publisherName
updatedAt
}
}
";
Expand Down
6 changes: 6 additions & 0 deletions thoth-app/src/models/publisher/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use chrono::naive::NaiveDateTime;
use serde::Deserialize;
use serde::Serialize;
use yew::html;
Expand All @@ -15,6 +16,7 @@ pub struct Publisher {
pub publisher_name: String,
pub publisher_shortname: Option<String>,
pub publisher_url: Option<String>,
pub updated_at: serde_json::Value,
}

impl Publisher {
Expand All @@ -32,6 +34,8 @@ impl Publisher {
.clone()
.unwrap_or_else(|| "".to_string());
let publisher_url = self.publisher_url.clone().unwrap_or_else(|| "".to_string());
let updated =
NaiveDateTime::from_timestamp(self.updated_at.as_f64().unwrap_or(0.0) as i64, 0);
html! {
<tr
class="row"
Expand All @@ -41,6 +45,7 @@ impl Publisher {
<td>{&self.publisher_name}</td>
<td>{publisher_shortname}</td>
<td>{publisher_url}</td>
<td>{updated}</td>
</tr>
}
}
Expand All @@ -53,6 +58,7 @@ impl Default for Publisher {
publisher_name: "".to_string(),
publisher_shortname: None,
publisher_url: None,
updated_at: Default::default(),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions thoth-app/src/models/publisher/publisher_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub const PUBLISHER_QUERY: &str = "
publisherName
publisherShortname
publisherUrl
updatedAt
}
}
";
Expand Down
1 change: 1 addition & 0 deletions thoth-app/src/models/publisher/publishers_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const PUBLISHERS_QUERY: &str = "
publisherName
publisherShortname
publisherUrl
updatedAt
}
publisherCount(filter: $filter, publishers: $publishers)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const UPDATE_PUBLISHER_MUTATION: &str = "
}){
publisherId
publisherName
updatedAt
}
}
";
Expand Down
6 changes: 6 additions & 0 deletions thoth-app/src/models/series/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use chrono::naive::NaiveDateTime;
use serde::Deserialize;
use serde::Serialize;
use thoth_api::series::model::SeriesType;
Expand All @@ -19,6 +20,7 @@ pub struct Series {
pub issn_print: String,
pub issn_digital: String,
pub series_url: Option<String>,
pub updated_at: serde_json::Value,
pub imprint: Imprint,
}

Expand All @@ -43,6 +45,7 @@ impl Default for Series {
issn_print: "".to_string(),
issn_digital: "".to_string(),
series_url: None,
updated_at: Default::default(),
imprint: Default::default(),
}
}
Expand All @@ -69,6 +72,8 @@ impl Series {
}

pub fn as_table_row(&self, callback: Callback<MouseEvent>) -> Html {
let updated =
NaiveDateTime::from_timestamp(self.updated_at.as_f64().unwrap_or(0.0) as i64, 0);
html! {
<tr
class="row"
Expand All @@ -79,6 +84,7 @@ impl Series {
<td>{&self.series_type}</td>
<td>{&self.issn_print}</td>
<td>{&self.issn_digital}</td>
<td>{updated}</td>
</tr>
}
}
Expand Down
3 changes: 3 additions & 0 deletions thoth-app/src/models/series/series_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ pub const SERIES_QUERY: &str = "
issnPrint
issnDigital
seriesUrl
updatedAt
imprint {
imprintId
imprintName
updatedAt
publisher {
publisherId
publisherName
publisherShortname
publisherUrl
updatedAt
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions thoth-app/src/models/series/serieses_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ pub const SERIESES_QUERY: &str = "
issnPrint
issnDigital
seriesUrl
updatedAt
imprint {
imprintId
imprintName
updatedAt
publisher {
publisherId
publisherName
publisherShortname
publisherUrl
updatedAt
}
}
}
Expand Down
Loading

0 comments on commit 9a8f169

Please sign in to comment.