admin: can sort claim by last_update

This commit is contained in:
nemunaire 2020-01-24 18:24:20 +01:00
commit d8584a8a31
4 changed files with 31 additions and 2 deletions

View file

@ -193,6 +193,12 @@ type ClaimDescription struct {
Publish bool `json:"publish"`
}
// GetLastUpdate returns the date of the latest message written for the given Claim.
func (c Claim) GetLastUpdate() (res *time.Time, err error) {
err = DBQueryRow("SELECT MAX(date) FROM claim_descriptions WHERE id_claim = ? GROUP BY id_claim", c.Id).Scan(&res)
return
}
// GetDescriptions returns a list of all descriptions stored in the database for the Claim.
func (c Claim) GetDescriptions() (res []ClaimDescription, err error) {
var rows *sql.Rows