From eb793c086816e598cd3473b8eacefd381494ed43 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 4 Dec 2023 12:02:06 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20Property=20for=20Bluesky=20Pr?= =?UTF-8?q?ofile=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/api/response/init.go | 2 ++ internal/api/response/init_test.go | 4 ++++ internal/api/response/ticker.go | 2 ++ internal/api/response/ticker_test.go | 4 ++++ internal/api/tickers.go | 2 ++ internal/storage/ticker.go | 1 + 6 files changed, 15 insertions(+) diff --git a/internal/api/response/init.go b/internal/api/response/init.go index 5c8a5001..1d218749 100644 --- a/internal/api/response/init.go +++ b/internal/api/response/init.go @@ -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 { @@ -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, }, } } diff --git a/internal/api/response/init_test.go b/internal/api/response/init_test.go index 54e019fb..19078206 100644 --- a/internal/api/response/init_test.go +++ b/internal/api/response/init_test.go @@ -26,6 +26,8 @@ func (s *InitTickerResponseTestSuite) TestInitTickerResponse() { Twitter: "example", Facebook: "example", Telegram: "example", + Mastodon: "example", + Bluesky: "example", }, } @@ -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) { diff --git a/internal/api/response/ticker.go b/internal/api/response/ticker.go index 2ab28fba..f275f179 100644 --- a/internal/api/response/ticker.go +++ b/internal/api/response/ticker.go @@ -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 { @@ -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, diff --git a/internal/api/response/ticker_test.go b/internal/api/response/ticker_test.go index 15884ffc..66e05c77 100644 --- a/internal/api/response/ticker_test.go +++ b/internal/api/response/ticker_test.go @@ -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, @@ -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) diff --git a/internal/api/tickers.go b/internal/api/tickers.go index b56f23cf..7d13833a 100644 --- a/internal/api/tickers.go +++ b/internal/api/tickers.go @@ -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"` @@ -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 diff --git a/internal/storage/ticker.go b/internal/storage/ticker.go index 17a091d4..7649f80c 100644 --- a/internal/storage/ticker.go +++ b/internal/storage/ticker.go @@ -41,6 +41,7 @@ type TickerInformation struct { Facebook string Telegram string Mastodon string + Bluesky string } type TickerTelegram struct {