mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2025-12-13 19:55:21 +00:00
Comments
This commit is contained in:
13
api/album.go
13
api/album.go
@@ -4,9 +4,9 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"codeberg.org/video-prize-ranch/rimgo/types"
|
||||
"codeberg.org/video-prize-ranch/rimgo/utils"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
@@ -35,8 +35,8 @@ func FetchAlbum(albumID string) (types.Album, error) {
|
||||
media = append(media, types.Media{
|
||||
Id: value.Get("id").String(),
|
||||
Name: value.Get("name").String(),
|
||||
MimeType: value.Get("mime_type").String(),
|
||||
Type: value.Get("type").String(),
|
||||
MimeType: value.Get("mime_type").String(),
|
||||
Type: value.Get("type").String(),
|
||||
Title: value.Get("metadata.title").String(),
|
||||
Description: value.Get("metadata.description").String(),
|
||||
Url: url,
|
||||
@@ -46,7 +46,7 @@ func FetchAlbum(albumID string) (types.Album, error) {
|
||||
},
|
||||
)
|
||||
|
||||
createdAt, err := time.Parse("2006-01-02T15:04:05Z", data.Get("created_at").String())
|
||||
createdAt, err := utils.FormatDate(data.Get("created_at").String())
|
||||
if err != nil {
|
||||
return types.Album{}, err
|
||||
}
|
||||
@@ -55,7 +55,10 @@ func FetchAlbum(albumID string) (types.Album, error) {
|
||||
Id: data.Get("id").String(),
|
||||
Title: data.Get("title").String(),
|
||||
Views: data.Get("view_count").Int(),
|
||||
CreatedAt: createdAt.Format("January 2, 2006 3:04 PM"),
|
||||
Upvotes: data.Get("upvote_count").Int(),
|
||||
Downvotes: data.Get("downvote_count").Int(),
|
||||
Comments: data.Get("comment_count").Int(),
|
||||
CreatedAt: createdAt,
|
||||
Media: media,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user