diff --git a/flows/msg.go b/flows/msg.go index 881fc820c..7240e07c2 100644 --- a/flows/msg.go +++ b/flows/msg.go @@ -1,9 +1,6 @@ package flows import ( - "database/sql/driver" - "encoding/json" - "errors" "fmt" "slices" @@ -220,14 +217,3 @@ func (b BroadcastTranslations) ForContact(e envs.Environment, c *Contact, baseLa // finally return the base language return b[baseLanguage], baseLanguage } - -// Scan supports reading translation values from JSON in database -func (t *BroadcastTranslations) Scan(value any) error { - b, ok := value.([]byte) - if !ok { - return errors.New("failed type assertion to []byte") - } - return json.Unmarshal(b, &t) -} - -func (t BroadcastTranslations) Value() (driver.Value, error) { return json.Marshal(t) } diff --git a/flows/msg_test.go b/flows/msg_test.go index 28f0b03c2..750d156b9 100644 --- a/flows/msg_test.go +++ b/flows/msg_test.go @@ -146,15 +146,6 @@ func TestBroadcastTranslations(t *testing.T) { assertTranslation("kin", []i18n.Language{"eng", "spa"}, "Hello", "eng") // uses default flow language assertTranslation("kin", []i18n.Language{"spa", "eng"}, "Hola", "spa") // uses default flow language assertTranslation("kin", []i18n.Language{"kin"}, "Hello", "eng") // uses base language - - val, err := bcastTrans.Value() - assert.NoError(t, err) - assert.JSONEq(t, `{"eng": {"text": "Hello"}, "fra": {"text": "Bonjour"}, "spa": {"text": "Hola"}}`, string(val.([]byte))) - - var bt flows.BroadcastTranslations - err = bt.Scan([]byte(`{"spa": {"text": "Adios"}}`)) - assert.NoError(t, err) - assert.Equal(t, flows.BroadcastTranslations{"spa": {Text: "Adios"}}, bt) } func TestMsgTemplating(t *testing.T) {