From 8732b332a1b5dfd2b23176739cd81c119687ac5d Mon Sep 17 00:00:00 2001 From: Hein Date: Fri, 20 Feb 2026 23:22:03 +0200 Subject: [PATCH] feat(database): include BusinessAPI config in WhatsApp account sync --- pkg/whatshooked/whatshooked.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/whatshooked/whatshooked.go b/pkg/whatshooked/whatshooked.go index 0577127..c4c16c0 100644 --- a/pkg/whatshooked/whatshooked.go +++ b/pkg/whatshooked/whatshooked.go @@ -388,11 +388,19 @@ func (wh *WhatsHooked) syncConfigToDatabase(ctx context.Context) error { accountType = "whatsmeow" } + cfgJSON := "" + if wa.BusinessAPI != nil { + if b, err := json.Marshal(wa.BusinessAPI); err == nil { + cfgJSON = string(b) + } + } + row := models.ModelPublicWhatsappAccount{ ID: resolvespec_common.NewSqlString(wa.ID), AccountType: resolvespec_common.NewSqlString(accountType), PhoneNumber: resolvespec_common.NewSqlString(wa.PhoneNumber), SessionPath: resolvespec_common.NewSqlString(wa.SessionPath), + Config: resolvespec_common.NewSqlString(cfgJSON), Active: !wa.Disabled, UserID: resolvespec_common.NewSqlString(adminID), CreatedAt: resolvespec_common.NewSqlTimeStamp(now), @@ -405,6 +413,7 @@ func (wh *WhatsHooked) syncConfigToDatabase(ctx context.Context) error { Set("account_type = EXCLUDED.account_type"). Set("phone_number = EXCLUDED.phone_number"). Set("session_path = EXCLUDED.session_path"). + Set("config = EXCLUDED.config"). Set("active = EXCLUDED.active"). Set("updated_at = EXCLUDED.updated_at"). Exec(ctx)