--- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Sat Oct 09 17:46:12 2021 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Sat Oct 09 20:05:39 2021 +0200 @@ -696,4 +696,43 @@ } //</editor-fold> + + //<editor-fold desc="Issue History"> + + override fun listIssueHistory(projectId: Int, days: Int) = + withStatement( + """ + select evt.*, evtdata.* + from lpit_issue_history_event evt + join lpit_issue using (issueid) + join lpit_issue_history_data evtdata using (eventid) + where project = ? + and time > now() - (? * interval '1' day) + order by time desc + """.trimIndent() + ) { + setInt(1, projectId) + setInt(2, days) + queryAll { rs-> + with(rs) { + IssueHistoryEntry( + getTimestamp("time"), + getEnum("type"), + IssueHistoryData(getInt("issueid"), + component = getString("component") ?: "", + status = getEnum("status"), + category = getEnum("category"), + subject = getString("subject"), + description = getString("description") ?: "", + assignee = getString("assignee") ?: "", + eta = getDate("eta"), + affected = getString("affected") ?: "", + resolved = getString("resolved") ?: "" + ) + ) + } + } + } + + //</editor-fold> } \ No newline at end of file