feat: add change detection module

This commit is contained in:
Shashank S
2024-05-08 11:47:25 +02:00
parent e204029d3c
commit 7adf624e95
6 changed files with 167 additions and 1 deletions

View File

@@ -48,6 +48,14 @@ type AppRelease struct {
type AppReleases []AppRelease
type ChangeWatch struct {
Name string
Url string
LastChanged time.Time
}
type ChangeWatches []ChangeWatch
type Video struct {
ThumbnailUrl string
Title string
@@ -200,6 +208,14 @@ func (r AppReleases) SortByNewest() AppReleases {
return r
}
func (r ChangeWatches) SortByNewest() ChangeWatches {
sort.Slice(r, func(i, j int) bool {
return r[i].LastChanged.After(r[j].LastChanged)
})
return r
}
func (v Videos) SortByNewest() Videos {
sort.Slice(v, func(i, j int) bool {
return v[i].TimePosted.After(v[j].TimePosted)