Open
Conversation
fxisco
reviewed
Jun 18, 2019
fxisco
approved these changes
Jun 19, 2019
postgres/client.js
Outdated
|
|
||
| // If we have history data, then find the unpublish and archive events | ||
| if (parsedValue.history && parsedValue.history.length) { | ||
| const latestUnpublish = parsedValue.history |
There was a problem hiding this comment.
You could abstract this logic into a small function
Suggested change
| const latestUnpublish = parsedValue.history | |
| const latestUnpublish = getLatestActionByName(parsedValue.history, 'unpublish'), | |
| latestArchived = getLatestActionByName(parsedValue.history, 'archive') |
function getLatestActionByName(history = [], action) {
return history
.filter(event => event.action === action)
.pop() || {};
}| /** | ||
| * Gets the latest entry in the history based on the action | ||
| * @param {Object[]} history | ||
| * @param {String} action |
There was a problem hiding this comment.
Suggested change
| * @param {String} action | |
| * @param {string} action |
Contributor
Author
There was a problem hiding this comment.
Convention is to have String capitalize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
pagestable in postgresputMetamethod to send the data when meta is modifiedQA
In order to be able to test this feature, you should link this package and #49 in a clay project. I've been using https://github.com/clay/clay-starter to develop this feature, that's a good starting point.
Testing steps
clay-starter)makeadmineris up and running usingdocker-compose up -d adminermake bootstrap(where theMakefileis located)appdirectory (or where thepackage.jsonfile is located) and link the previously mentioned packages withnpm link amphora-storage-postgres(make sure the packages are in the correct branch and linked)rs. After it's done, you should see a message statingMigrations Completepostgres; password isexample)published_at,unpublished_at,archive_atandrepublished_at