Skip to content

Commit

Permalink
Merge pull request #286 from systemli/Add-Property-for-Bluesky-Profil…
Browse files Browse the repository at this point in the history
…e-URL

✨ Add Property for Bluesky Profile URL
  • Loading branch information
0x46616c6b authored Dec 4, 2023
2 parents 3f5311e + eb793c0 commit e4ad444
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/api/response/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type InitTickerInformation struct {
Facebook string `json:"facebook"`
Telegram string `json:"telegram"`
Mastodon string `json:"mastodon"`
Bluesky string `json:"bluesky"`
}

func InitTickerResponse(ticker storage.Ticker) InitTicker {
Expand All @@ -40,6 +41,7 @@ func InitTickerResponse(ticker storage.Ticker) InitTicker {
Facebook: ticker.Information.Facebook,
Telegram: ticker.Information.Telegram,
Mastodon: ticker.Information.Mastodon,
Bluesky: ticker.Information.Bluesky,
},
}
}
4 changes: 4 additions & 0 deletions internal/api/response/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ func (s *InitTickerResponseTestSuite) TestInitTickerResponse() {
Twitter: "example",
Facebook: "example",
Telegram: "example",
Mastodon: "example",
Bluesky: "example",
},
}

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

func TestInitTickerResponseTestSuite(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions internal/api/response/ticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Information struct {
Facebook string `json:"facebook"`
Telegram string `json:"telegram"`
Mastodon string `json:"mastodon"`
Bluesky string `json:"bluesky"`
}

type Telegram struct {
Expand Down Expand Up @@ -68,6 +69,7 @@ func TickerResponse(t storage.Ticker, config config.Config) Ticker {
Facebook: t.Information.Facebook,
Telegram: t.Information.Telegram,
Mastodon: t.Information.Mastodon,
Bluesky: t.Information.Bluesky,
},
Telegram: Telegram{
Active: t.Telegram.Active,
Expand Down
4 changes: 4 additions & 0 deletions internal/api/response/ticker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ func (s *TickersResponseTestSuite) TestTickersResponse() {
Twitter: "@example",
Facebook: "https://facebook.com/example",
Telegram: "example",
Mastodon: "https://systemli.social/@example",
Bluesky: "https://example.com",
},
Telegram: storage.TickerTelegram{
Active: true,
Expand Down Expand Up @@ -72,6 +74,8 @@ func (s *TickersResponseTestSuite) TestTickersResponse() {
s.Equal(ticker.Information.Twitter, tickerResponse[0].Information.Twitter)
s.Equal(ticker.Information.Facebook, tickerResponse[0].Information.Facebook)
s.Equal(ticker.Information.Telegram, tickerResponse[0].Information.Telegram)
s.Equal(ticker.Information.Mastodon, tickerResponse[0].Information.Mastodon)
s.Equal(ticker.Information.Bluesky, tickerResponse[0].Information.Bluesky)
s.Equal(ticker.Telegram.Active, tickerResponse[0].Telegram.Active)
s.Equal(ticker.Telegram.Connected(), tickerResponse[0].Telegram.Connected)
s.Equal(config.Telegram.User.UserName, tickerResponse[0].Telegram.BotUsername)
Expand Down
2 changes: 2 additions & 0 deletions internal/api/tickers.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ func updateTicker(t *storage.Ticker, c *gin.Context) error {
Facebook string `json:"facebook"`
Telegram string `json:"telegram"`
Mastodon string `json:"mastodon"`
Bluesky string `json:"bluesky"`
} `json:"information"`
Location struct {
Lat float64 `json:"lat"`
Expand All @@ -352,6 +353,7 @@ func updateTicker(t *storage.Ticker, c *gin.Context) error {
t.Information.Facebook = body.Information.Facebook
t.Information.Telegram = body.Information.Telegram
t.Information.Mastodon = body.Information.Mastodon
t.Information.Bluesky = body.Information.Bluesky
t.Location.Lat = body.Location.Lat
t.Location.Lon = body.Location.Lon

Expand Down
1 change: 1 addition & 0 deletions internal/storage/ticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type TickerInformation struct {
Facebook string
Telegram string
Mastodon string
Bluesky string
}

type TickerTelegram struct {
Expand Down

0 comments on commit e4ad444

Please sign in to comment.