aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-05-14 18:43:07 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-05-14 18:43:07 -0700
commit8a130e1000a2b49cbfb571ae0b74f0ec8577e9fe (patch)
tree197618e5b1f03bb292d5b32321d52932f72306c4
parent534cd7b3fa0a4cb0c19da05f740942b93e8b3659 (diff)
downloadfatcat-8a130e1000a2b49cbfb571ae0b74f0ec8577e9fe.tar.gz
fatcat-8a130e1000a2b49cbfb571ae0b74f0ec8577e9fe.zip
codegen and rust impl created timestamp
-rw-r--r--python_client/fatcat_client/models/editgroup.py28
-rw-r--r--rust/fatcat-api-spec/README.md2
-rw-r--r--rust/fatcat-api-spec/api.yaml3
-rw-r--r--rust/fatcat-api-spec/api/swagger.yaml7
-rw-r--r--rust/fatcat-api-spec/src/models.rs5
-rw-r--r--rust/src/database_models.rs7
-rw-r--r--rust/src/endpoint_handlers.rs4
-rw-r--r--rust/src/entity_crud.rs17
8 files changed, 61 insertions, 12 deletions
diff --git a/python_client/fatcat_client/models/editgroup.py b/python_client/fatcat_client/models/editgroup.py
index 336fbff3..06e277a1 100644
--- a/python_client/fatcat_client/models/editgroup.py
+++ b/python_client/fatcat_client/models/editgroup.py
@@ -39,6 +39,7 @@ class Editgroup(object):
'editor_id': 'str',
'editor': 'Editor',
'changelog_index': 'int',
+ 'created': 'datetime',
'submitted': 'datetime',
'description': 'str',
'extra': 'object',
@@ -51,6 +52,7 @@ class Editgroup(object):
'editor_id': 'editor_id',
'editor': 'editor',
'changelog_index': 'changelog_index',
+ 'created': 'created',
'submitted': 'submitted',
'description': 'description',
'extra': 'extra',
@@ -58,13 +60,14 @@ class Editgroup(object):
'edits': 'edits'
}
- def __init__(self, editgroup_id=None, editor_id=None, editor=None, changelog_index=None, submitted=None, description=None, extra=None, annotations=None, edits=None): # noqa: E501
+ def __init__(self, editgroup_id=None, editor_id=None, editor=None, changelog_index=None, created=None, submitted=None, description=None, extra=None, annotations=None, edits=None): # noqa: E501
"""Editgroup - a model defined in Swagger""" # noqa: E501
self._editgroup_id = None
self._editor_id = None
self._editor = None
self._changelog_index = None
+ self._created = None
self._submitted = None
self._description = None
self._extra = None
@@ -80,6 +83,8 @@ class Editgroup(object):
self.editor = editor
if changelog_index is not None:
self.changelog_index = changelog_index
+ if created is not None:
+ self.created = created
if submitted is not None:
self.submitted = submitted
if description is not None:
@@ -192,6 +197,27 @@ class Editgroup(object):
self._changelog_index = changelog_index
@property
+ def created(self):
+ """Gets the created of this Editgroup. # noqa: E501
+
+
+ :return: The created of this Editgroup. # noqa: E501
+ :rtype: datetime
+ """
+ return self._created
+
+ @created.setter
+ def created(self, created):
+ """Sets the created of this Editgroup.
+
+
+ :param created: The created of this Editgroup. # noqa: E501
+ :type: datetime
+ """
+
+ self._created = created
+
+ @property
def submitted(self):
"""Gets the submitted of this Editgroup. # noqa: E501
diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md
index 93ab4016..b34efc73 100644
--- a/rust/fatcat-api-spec/README.md
+++ b/rust/fatcat-api-spec/README.md
@@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
- API version: 0.2.0
-- Build date: 2019-05-14T22:45:05.973Z
+- Build date: 2019-05-15T01:33:17.197Z
This autogenerated project defines an API crate `fatcat` which contains:
* An `Api` trait defining the API in Rust.
diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml
index e739eae1..92253e9d 100644
--- a/rust/fatcat-api-spec/api.yaml
+++ b/rust/fatcat-api-spec/api.yaml
@@ -530,6 +530,9 @@ definitions:
type: integer
example: 1048576
format: int64
+ created:
+ type: string
+ format: date-time
submitted:
type: string
format: date-time
diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml
index 0b3abddd..02cdcf36 100644
--- a/rust/fatcat-api-spec/api/swagger.yaml
+++ b/rust/fatcat-api-spec/api/swagger.yaml
@@ -8345,6 +8345,7 @@ definitions:
username: "zerocool93"
changelog_index: 1048576
submitted: "2000-01-23T04:56:07.000+00:00"
+ created: "2000-01-23T04:56:07.000+00:00"
extra: "{}"
edits:
works:
@@ -8498,6 +8499,7 @@ definitions:
username: "zerocool93"
changelog_index: 1048576
submitted: "2000-01-23T04:56:07.000+00:00"
+ created: "2000-01-23T04:56:07.000+00:00"
extra: "{}"
edits:
works:
@@ -8748,6 +8750,9 @@ definitions:
type: "integer"
format: "int64"
example: 1048576
+ created:
+ type: "string"
+ format: "date-time"
submitted:
type: "string"
format: "date-time"
@@ -8770,6 +8775,7 @@ definitions:
username: "zerocool93"
changelog_index: 1048576
submitted: "2000-01-23T04:56:07.000+00:00"
+ created: "2000-01-23T04:56:07.000+00:00"
extra: "{}"
edits:
works:
@@ -8981,6 +8987,7 @@ definitions:
username: "zerocool93"
changelog_index: 1048576
submitted: "2000-01-23T04:56:07.000+00:00"
+ created: "2000-01-23T04:56:07.000+00:00"
extra: "{}"
edits:
works:
diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs
index ce559ccc..0ceed261 100644
--- a/rust/fatcat-api-spec/src/models.rs
+++ b/rust/fatcat-api-spec/src/models.rs
@@ -274,6 +274,10 @@ pub struct Editgroup {
#[serde(skip_serializing_if = "Option::is_none")]
pub changelog_index: Option<i64>,
+ #[serde(rename = "created")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub created: Option<chrono::DateTime<chrono::Utc>>,
+
#[serde(rename = "submitted")]
#[serde(skip_serializing_if = "Option::is_none")]
pub submitted: Option<chrono::DateTime<chrono::Utc>>,
@@ -302,6 +306,7 @@ impl Editgroup {
editor_id: None,
editor: None,
changelog_index: None,
+ created: None,
submitted: None,
description: None,
extra: None,
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs
index 34ce1de6..79b0137b 100644
--- a/rust/src/database_models.rs
+++ b/rust/src/database_models.rs
@@ -662,12 +662,17 @@ pub struct EditgroupRow {
impl EditgroupRow {
/// Returns an Editgroup API model *without* the entity edits actually populated. Useful for,
/// eg, entity history queries (where we already have the entity edit we want)
- pub fn into_model_partial(self, changelog_index: Option<i64>, editor: Option<Editor>) -> Editgroup {
+ pub fn into_model_partial(
+ self,
+ changelog_index: Option<i64>,
+ editor: Option<Editor>,
+ ) -> Editgroup {
Editgroup {
editgroup_id: Some(uuid2fcid(&self.id)),
editor_id: Some(uuid2fcid(&self.editor_id)),
editor: editor,
changelog_index: changelog_index,
+ created: Some(chrono::DateTime::from_utc(self.created, chrono::Utc)),
submitted: self
.submitted
.map(|v| chrono::DateTime::from_utc(v, chrono::Utc)),
diff --git a/rust/src/endpoint_handlers.rs b/rust/src/endpoint_handlers.rs
index ba8505e1..5c22e21d 100644
--- a/rust/src/endpoint_handlers.rs
+++ b/rust/src/endpoint_handlers.rs
@@ -558,7 +558,9 @@ impl Server {
.into_iter()
.map(|(eg_row, cl_row, editor_row)| ChangelogEntry {
index: cl_row.id,
- editgroup: Some(eg_row.into_model_partial(Some(cl_row.id), Some(editor_row.into_model()))),
+ editgroup: Some(
+ eg_row.into_model_partial(Some(cl_row.id), Some(editor_row.into_model())),
+ ),
editgroup_id: uuid2fcid(&cl_row.editgroup_id),
timestamp: chrono::DateTime::from_utc(cl_row.timestamp, chrono::Utc),
})
diff --git a/rust/src/entity_crud.rs b/rust/src/entity_crud.rs
index 269bfdf6..b72ccd37 100644
--- a/rust/src/entity_crud.rs
+++ b/rust/src/entity_crud.rs
@@ -538,14 +538,15 @@ macro_rules! generic_db_get_history {
) -> Result<Vec<EntityHistoryEntry>> {
let limit = limit.unwrap_or(50); // TODO: make a static
- let rows: Vec<(EditgroupRow, ChangelogRow, Self::EditRow, EditorRow)> = editgroup::table
- .inner_join(changelog::table)
- .inner_join($edit_table::table)
- .inner_join(editor::table)
- .filter($edit_table::ident_id.eq(ident.to_uuid()))
- .order(changelog::id.desc())
- .limit(limit)
- .get_results(conn)?;
+ let rows: Vec<(EditgroupRow, ChangelogRow, Self::EditRow, EditorRow)> =
+ editgroup::table
+ .inner_join(changelog::table)
+ .inner_join($edit_table::table)
+ .inner_join(editor::table)
+ .filter($edit_table::ident_id.eq(ident.to_uuid()))
+ .order(changelog::id.desc())
+ .limit(limit)
+ .get_results(conn)?;
let history: Result<Vec<EntityHistoryEntry>> = rows
.into_iter()