diff --git a/app/src/api/services/building.ts b/app/src/api/services/building.ts index 38bbc082..79511324 100644 --- a/app/src/api/services/building.ts +++ b/app/src/api/services/building.ts @@ -118,7 +118,7 @@ async function getBuildingById(id: number) { async function getBuildingEditHistory(id: number) { try { return await db.manyOrNone( - `SELECT log_id as revision_id, forward_patch, reverse_patch, date_trunc('minute', log_timestamp), username + `SELECT log_id as revision_id, forward_patch, reverse_patch, date_trunc('minute', log_timestamp) as revision_timestamp, username FROM logs, users WHERE building_id = $1 AND logs.user_id = users.user_id ORDER BY log_timestamp DESC`, diff --git a/app/src/api/services/editHistory.ts b/app/src/api/services/editHistory.ts index 92bf9ca7..e0891621 100644 --- a/app/src/api/services/editHistory.ts +++ b/app/src/api/services/editHistory.ts @@ -3,7 +3,7 @@ import db from '../../db'; async function getGlobalEditHistory() { try { return await db.manyOrNone( - `SELECT log_id as revision_id, forward_patch, reverse_patch, date_trunc('minute', log_timestamp), username, building_id + `SELECT log_id as revision_id, forward_patch, reverse_patch, date_trunc('minute', log_timestamp) as revision_timestamp, username, building_id FROM logs, users WHERE logs.user_id = users.user_id AND log_timestamp >= now() - interval '7 days' diff --git a/app/src/frontend/building/edit-history/building-edit-summary.tsx b/app/src/frontend/building/edit-history/building-edit-summary.tsx index 2ac230cd..e55399f9 100644 --- a/app/src/frontend/building/edit-history/building-edit-summary.tsx +++ b/app/src/frontend/building/edit-history/building-edit-summary.tsx @@ -54,7 +54,7 @@ const BuildingEditSummary: React.FunctionComponent = ( return (
-

Edited on {formatDate(parseDate(historyEntry.date_trunc))}

+

Edited on {formatDate(parseDate(historyEntry.revision_timestamp))}

By {historyEntry.username}

{ showBuildingId && historyEntry.building_id != undefined && diff --git a/app/src/frontend/models/edit-history-entry.ts b/app/src/frontend/models/edit-history-entry.ts index e0f30d00..6abf13d4 100644 --- a/app/src/frontend/models/edit-history-entry.ts +++ b/app/src/frontend/models/edit-history-entry.ts @@ -1,5 +1,5 @@ export interface EditHistoryEntry { - date_trunc: string; + revision_timestamp: string; username: string; revision_id: string; forward_patch: object;