-
Notifications
You must be signed in to change notification settings - Fork 7
Adds migrations for page events columns #49
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
base: master
Are you sure you want to change the base?
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could abstract this logic into a small function
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * @param {String} action | |
| * @param {string} action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convention is to have String capitalize
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