Ver Fonte

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 há 5 anos atrás
pai
commit
77dc6aaf27
3 ficheiros alterados com 5 adições e 0 exclusões
  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"`
 	Date        time.Time  `json:"published_at"`
 	CreatedAt   time.Time  `json:"created_at"`
+	ChangedAt   time.Time  `json:"changed_at"`
 	Content     string     `json:"content"`
 	Author      string     `json:"author"`
 	ShareCode   string     `json:"share_code"`

+ 1 - 0
model/entry.go

@@ -29,6 +29,7 @@ type Entry struct {
 	CommentsURL string        `json:"comments_url"`
 	Date        time.Time     `json:"published_at"`
 	CreatedAt   time.Time     `json:"created_at"`
+	ChangedAt   time.Time     `json:"changed_at"`
 	Content     string        `json:"content"`
 	Author      string        `json:"author"`
 	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.reading_time,
 			e.created_at,
+			e.changed_at,
 			f.title as feed_title,
 			f.feed_url,
 			f.site_url,
@@ -294,6 +295,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
 			&entry.Starred,
 			&entry.ReadingTime,
 			&entry.CreatedAt,
+			&entry.ChangedAt,
 			&entry.Feed.Title,
 			&entry.Feed.FeedURL,
 			&entry.Feed.SiteURL,
@@ -322,6 +324,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
 		// Make sure that timestamp fields contains timezone information (API)
 		entry.Date = timezone.Convert(tz, entry.Date)
 		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.ID = entry.FeedID