Browse Source

Expose `changed_at` time through the API

No issue

This is already stored and updated in the DB to render the History page but is currently not exposed through the API
James Loh 4 years ago
parent
commit
77dc6aaf27
3 changed files with 5 additions and 0 deletions
  1. 1 0
      client/model.go
  2. 1 0
      model/entry.go
  3. 3 0
      storage/entry_query_builder.go

+ 1 - 0
client/model.go

@@ -189,6 +189,7 @@ type Entry struct {
 	URL         string     `json:"url"`
 	URL         string     `json:"url"`
 	Date        time.Time  `json:"published_at"`
 	Date        time.Time  `json:"published_at"`
 	CreatedAt   time.Time  `json:"created_at"`
 	CreatedAt   time.Time  `json:"created_at"`
+	ChangedAt   time.Time  `json:"changed_at"`
 	Content     string     `json:"content"`
 	Content     string     `json:"content"`
 	Author      string     `json:"author"`
 	Author      string     `json:"author"`
 	ShareCode   string     `json:"share_code"`
 	ShareCode   string     `json:"share_code"`

+ 1 - 0
model/entry.go

@@ -29,6 +29,7 @@ type Entry struct {
 	CommentsURL string        `json:"comments_url"`
 	CommentsURL string        `json:"comments_url"`
 	Date        time.Time     `json:"published_at"`
 	Date        time.Time     `json:"published_at"`
 	CreatedAt   time.Time     `json:"created_at"`
 	CreatedAt   time.Time     `json:"created_at"`
+	ChangedAt   time.Time     `json:"changed_at"`
 	Content     string        `json:"content"`
 	Content     string        `json:"content"`
 	Author      string        `json:"author"`
 	Author      string        `json:"author"`
 	ShareCode   string        `json:"share_code"`
 	ShareCode   string        `json:"share_code"`

+ 3 - 0
storage/entry_query_builder.go

@@ -233,6 +233,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
 			e.starred,
 			e.starred,
 			e.reading_time,
 			e.reading_time,
 			e.created_at,
 			e.created_at,
+			e.changed_at,
 			f.title as feed_title,
 			f.title as feed_title,
 			f.feed_url,
 			f.feed_url,
 			f.site_url,
 			f.site_url,
@@ -294,6 +295,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
 			&entry.Starred,
 			&entry.Starred,
 			&entry.ReadingTime,
 			&entry.ReadingTime,
 			&entry.CreatedAt,
 			&entry.CreatedAt,
+			&entry.ChangedAt,
 			&entry.Feed.Title,
 			&entry.Feed.Title,
 			&entry.Feed.FeedURL,
 			&entry.Feed.FeedURL,
 			&entry.Feed.SiteURL,
 			&entry.Feed.SiteURL,
@@ -322,6 +324,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
 		// Make sure that timestamp fields contains timezone information (API)
 		// Make sure that timestamp fields contains timezone information (API)
 		entry.Date = timezone.Convert(tz, entry.Date)
 		entry.Date = timezone.Convert(tz, entry.Date)
 		entry.CreatedAt = timezone.Convert(tz, entry.CreatedAt)
 		entry.CreatedAt = timezone.Convert(tz, entry.CreatedAt)
+		entry.ChangedAt = timezone.Convert(tz, entry.ChangedAt)
 		entry.Feed.CheckedAt = timezone.Convert(tz, entry.Feed.CheckedAt)
 		entry.Feed.CheckedAt = timezone.Convert(tz, entry.Feed.CheckedAt)
 
 
 		entry.Feed.ID = entry.FeedID
 		entry.Feed.ID = entry.FeedID