feat(accounts): sync updated WhatsApp account configs to database
Some checks failed
CI / Test (1.23) (push) Failing after -22m19s
CI / Test (1.22) (push) Failing after -22m12s
CI / Build (push) Failing after -22m19s
CI / Lint (push) Failing after -22m2s

This commit is contained in:
2026-02-20 23:10:46 +02:00
parent 011d9d7b21
commit 80a4c2b70a
3 changed files with 55 additions and 1 deletions

View File

@@ -200,6 +200,18 @@ func (r *WhatsAppAccountRepository) GetByPhoneNumber(ctx context.Context, phoneN
return &account, nil
}
// UpdateConfig updates the config JSON column and phone number for a WhatsApp account
func (r *WhatsAppAccountRepository) UpdateConfig(ctx context.Context, id string, phoneNumber string, cfgJSON string, active bool) error {
_, err := r.db.NewUpdate().Model((*models.ModelPublicWhatsappAccount)(nil)).
Set("config = ?", cfgJSON).
Set("phone_number = ?", phoneNumber).
Set("active = ?", active).
Set("updated_at = ?", time.Now()).
Where("id = ?", id).
Exec(ctx)
return err
}
// UpdateStatus updates the status of a WhatsApp account
func (r *WhatsAppAccountRepository) UpdateStatus(ctx context.Context, id string, status string) error {
query := r.db.NewUpdate().Model((*models.ModelPublicWhatsappAccount)(nil)).