Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix create/update timestamp issues in GraphQL and REST #1847

Merged
merged 7 commits into from Mar 9, 2022

Conversation

parkerduckworth
Copy link
Member

@parkerduckworth parkerduckworth commented Mar 9, 2022

Changes

  1. Set the original creation timestamp before call to put, otherwise it is lost. This is because class is unmarshaled directly from the request body, therefore CreationTimeUnix inherits the zero value.

  2. Add creationTimeUnix and lastUpdateTimeUnix fields to Get graphql query as String's

  3. Write tests to assert both 1. and 2.


Fixes #1844

@codecov
Copy link

codecov bot commented Mar 9, 2022

Codecov Report

Merging #1847 (01a8262) into master (a061cc0) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1847      +/-   ##
==========================================
+ Coverage   65.98%   66.06%   +0.08%     
==========================================
  Files         411      411              
  Lines       30895    30915      +20     
==========================================
+ Hits        20386    20425      +39     
+ Misses       8716     8691      -25     
- Partials     1793     1799       +6     
Flag Coverage Δ
integration 67.27% <ø> (+0.03%) ⬆️
unittests 66.06% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...apters/handlers/graphql/local/get/class_builder.go 95.04% <100.00%> (+0.42%) ⬆️
...handlers/graphql/local/get/class_builder_fields.go 71.07% <100.00%> (+0.50%) ⬆️
usecases/objects/update.go 66.66% <100.00%> (+52.87%) ⬆️
usecases/traverser/explorer.go 70.31% <100.00%> (+0.42%) ⬆️
adapters/repos/db/lsmkv/bucket.go 62.68% <0.00%> (+0.74%) ⬆️
adapters/repos/db/shard_write_batch_objects.go 75.75% <0.00%> (+1.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bec1baa...01a8262. Read the comment docs.

// otherwise it is lost. This is because `class` is unmarshaled
// directly from the request body, therefore `CreationTimeUnix`
// inherits the zero value.
class.CreationTimeUnix = originalObject.Created
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this comment. The perfect level of information about why we do this.

@parkerduckworth
Copy link
Member Author

Just pushed some some tests to traverser/exporer_test.go as I just realized I hadn't covered the code added to that package.

@parkerduckworth
Copy link
Member Author

Documentation will need to be updated on the GraphQL Additional Properties reference page

@parkerduckworth parkerduckworth merged commit de9e196 into master Mar 9, 2022
@parkerduckworth parkerduckworth deleted the bugfix/gql-timestamps branch March 9, 2022 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix create/update timestamp issues in GraphQL and REST
3 participants