Skip to content

Commit

Permalink
Merge pull request #363 from systemli/Add-missing-information-to-resp…
Browse files Browse the repository at this point in the history
…onse

🐛 Add missing information to response
  • Loading branch information
0x46616c6b authored Feb 9, 2025
2 parents 3e998ad + d4c19ec commit fc8631a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
36 changes: 20 additions & 16 deletions internal/api/response/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ type InitTicker struct {
}

type InitTickerInformation struct {
Author string `json:"author"`
URL string `json:"url"`
Email string `json:"email"`
Twitter string `json:"twitter"`
Facebook string `json:"facebook"`
Telegram string `json:"telegram"`
Mastodon string `json:"mastodon"`
Bluesky string `json:"bluesky"`
Author string `json:"author"`
URL string `json:"url"`
Email string `json:"email"`
Twitter string `json:"twitter"`
Facebook string `json:"facebook"`
Instagram string `json:"instagram"`
Threads string `json:"threads"`
Telegram string `json:"telegram"`
Mastodon string `json:"mastodon"`
Bluesky string `json:"bluesky"`
}

func InitTickerResponse(ticker storage.Ticker) InitTicker {
Expand All @@ -32,14 +34,16 @@ func InitTickerResponse(ticker storage.Ticker) InitTicker {
Title: ticker.Title,
Description: ticker.Description,
Information: InitTickerInformation{
Author: ticker.Information.Author,
URL: ticker.Information.URL,
Email: ticker.Information.Email,
Twitter: ticker.Information.Twitter,
Facebook: ticker.Information.Facebook,
Telegram: ticker.Information.Telegram,
Mastodon: ticker.Information.Mastodon,
Bluesky: ticker.Information.Bluesky,
Author: ticker.Information.Author,
URL: ticker.Information.URL,
Email: ticker.Information.Email,
Twitter: ticker.Information.Twitter,
Facebook: ticker.Information.Facebook,
Instagram: ticker.Information.Instagram,
Threads: ticker.Information.Threads,
Telegram: ticker.Information.Telegram,
Mastodon: ticker.Information.Mastodon,
Bluesky: ticker.Information.Bluesky,
},
}
}
20 changes: 12 additions & 8 deletions internal/api/response/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ func (s *InitTickerResponseTestSuite) TestInitTickerResponse() {
Title: "Example",
Description: "Example",
Information: storage.TickerInformation{
Author: "Example",
URL: "https://example.com",
Email: "[email protected]",
Twitter: "example",
Facebook: "example",
Telegram: "example",
Mastodon: "example",
Bluesky: "example",
Author: "Example",
URL: "https://example.com",
Email: "[email protected]",
Twitter: "example",
Facebook: "example",
Instagram: "example",
Threads: "example",
Telegram: "example",
Mastodon: "example",
Bluesky: "example",
},
}

Expand All @@ -42,6 +44,8 @@ func (s *InitTickerResponseTestSuite) TestInitTickerResponse() {
s.Equal(ticker.Information.Email, response.Information.Email)
s.Equal(ticker.Information.Twitter, response.Information.Twitter)
s.Equal(ticker.Information.Facebook, response.Information.Facebook)
s.Equal(ticker.Information.Instagram, response.Information.Instagram)
s.Equal(ticker.Information.Threads, response.Information.Threads)
s.Equal(ticker.Information.Telegram, response.Information.Telegram)
s.Equal(ticker.Information.Mastodon, response.Information.Mastodon)
s.Equal(ticker.Information.Bluesky, response.Information.Bluesky)
Expand Down

0 comments on commit fc8631a

Please sign in to comment.