1.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Sat Oct 09 17:46:12 2021 +0200 1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Sat Oct 09 20:05:39 2021 +0200 1.3 @@ -696,4 +696,43 @@ 1.4 } 1.5 1.6 //</editor-fold> 1.7 + 1.8 + //<editor-fold desc="Issue History"> 1.9 + 1.10 + override fun listIssueHistory(projectId: Int, days: Int) = 1.11 + withStatement( 1.12 + """ 1.13 + select evt.*, evtdata.* 1.14 + from lpit_issue_history_event evt 1.15 + join lpit_issue using (issueid) 1.16 + join lpit_issue_history_data evtdata using (eventid) 1.17 + where project = ? 1.18 + and time > now() - (? * interval '1' day) 1.19 + order by time desc 1.20 + """.trimIndent() 1.21 + ) { 1.22 + setInt(1, projectId) 1.23 + setInt(2, days) 1.24 + queryAll { rs-> 1.25 + with(rs) { 1.26 + IssueHistoryEntry( 1.27 + getTimestamp("time"), 1.28 + getEnum("type"), 1.29 + IssueHistoryData(getInt("issueid"), 1.30 + component = getString("component") ?: "", 1.31 + status = getEnum("status"), 1.32 + category = getEnum("category"), 1.33 + subject = getString("subject"), 1.34 + description = getString("description") ?: "", 1.35 + assignee = getString("assignee") ?: "", 1.36 + eta = getDate("eta"), 1.37 + affected = getString("affected") ?: "", 1.38 + resolved = getString("resolved") ?: "" 1.39 + ) 1.40 + ) 1.41 + } 1.42 + } 1.43 + } 1.44 + 1.45 + //</editor-fold> 1.46 } 1.47 \ No newline at end of file