Skip to content

Commit

Permalink
adds modified date to objects list, #13
Browse files Browse the repository at this point in the history
  • Loading branch information
Danwhy committed Aug 1, 2018
1 parent f100cc5 commit 5f4a368
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lambda/processFile/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function saveToDB (item, callback) {
'active': {
BOOL: (item.objectId && item.title) ? true : false
},
'modification_date': {
'modificationDate': {
S: (new Date(Date.now())).toISOString()
}
};
Expand Down
2 changes: 2 additions & 0 deletions lambda/templates/html-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<tr class="table-header">
<th>ID</th>
<th>Name</th>
<th>Last Modified</th>
<th>Status</th>
<th></th>
<th></th>
Expand All @@ -63,6 +64,7 @@
<tr>
<td>{{#if objectId}}{{objectId.S}}{{else}}<span class="red">missing</span>{{/if}}</td>
<td>{{#if title}}{{title.S}}{{else}}<span class="red">missing</span>{{/if}}</td>
<td>{{#if modificationDate}}{{modificationDate.S}}{{/if}}</td>
<td>
{{#if active.BOOL}}
Active
Expand Down
2 changes: 1 addition & 1 deletion lambda/templates/json-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "{{objectId.S}}",
"path": "{{../bucket}}/{{id.S}}",
"active": {{active.BOOL}},
"modification_date": "{{modification_date.S}}"
"modification_date": "{{modificationDate.S}}"
}{{#if @last}}{{else}},{{/if}}
{{/each}}
]
2 changes: 1 addition & 1 deletion lambda/toggleStatus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports.handler = function (event, context, callback) {

return dynamoDB.updateItem({
TableName: process.env.TABLE_NAME,
UpdateExpression: 'SET active = :a, modification_date = :m',
UpdateExpression: 'SET active = :a, modificationDate = :m',
ExpressionAttributeValues: {
':a': {
BOOL: params.active === 'true'
Expand Down

0 comments on commit 5f4a368

Please sign in to comment.