feat(accounts): sync updated WhatsApp account configs to database
This commit is contained in:
@@ -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)).
|
||||
|
||||
Reference in New Issue
Block a user